This repository has been archived by the owner on Aug 26, 2023. It is now read-only.
forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-common-java.xml
236 lines (211 loc) · 6.76 KB
/
build-common-java.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?xml version="1.0"?>
<project name="build-common-java" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-common.xml" />
<if>
<and>
<equals arg1="${app.server.type}" arg2="tomcat" />
<antelope:endswith string="${app.server.portal.dir}" with="/portal-web/docroot" />
</and>
<then>
<property name="portal-impl.classes.dir" value="${project.dir}/portal-web/docroot/WEB-INF/classes" />
</then>
<else>
<property name="portal-impl.classes.dir" value="${project.dir}/portal-impl/classes" />
</else>
</if>
<target name="clean">
<delete dir="classes" />
<delete dir="test-classes" />
<delete dir="test-coverage" />
<delete dir="test-results" />
<delete dir="woven-classes" />
<delete dir="${doc.dir}/${ant.project.name}/javadocs" />
<delete file="${jar.file}.jar" failonerror="false" />
<delete file="${jar.file}-javadoc.jar" failonerror="false" />
<delete file="${jar.file}-sources.jar" failonerror="false" />
</target>
<target name="compile">
<if>
<not>
<uptodate targetfile="classes/.touch">
<srcfiles dir="src" includes="**/*.*" />
</uptodate>
</not>
<then>
<if>
<available file="$${javac.destdir}" />
<then>
<!--
Clean up stale dir that was accidentally introduced in
0b63ac06aec90d42d428a1b23140303324125042.
-->
<delete dir="$${javac.destdir}" />
</then>
</if>
<mkdir dir="classes" />
<antcall target="compile-java">
<param name="javac.classpathref" value="project.classpath" />
<param name="javac.destdir" value="classes" />
<param name="javac.srcdir" value="src" />
</antcall>
</then>
</if>
</target>
<target name="compile-java">
<copy todir="${javac.destdir}" preservelastmodified="true">
<fileset dir="${javac.srcdir}" excludes="**/*.java" />
</copy>
<javac
classpathref="${javac.classpathref}"
compiler="${javac.compiler}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${javac.destdir}"
encoding="${javac.encoding}"
includeAntRuntime="false"
nowarn="${javac.nowarn}"
srcdir="${javac.srcdir}"
/>
<echo file="${javac.destdir}/.touch"></echo>
</target>
<target name="deploy" depends="jar">
<if>
<not>
<uptodate targetfile="${deploy.dir}/${jar.file}.jar">
<srcfiles dir="${basedir}" includes="${jar.file}.jar" />
</uptodate>
</not>
<then>
<copy file="${jar.file}.jar" todir="${deploy.dir}" preservelastmodified="true" />
</then>
</if>
</target>
<target name="jar" depends="compile">
<if>
<not>
<uptodate targetfile="${jar.file}.jar">
<srcfiles dir="classes" includes="**/*.*" />
</uptodate>
</not>
<then>
<if>
<available file="bnd.bnd" />
<then>
<baseline-jar-macro
bndRootFile="${project.dir}/common.bnd"
file="bnd.bnd"
outputPath="."
rootProjectDir="${project.dir}"
sourcePath="."
/>
</then>
<else>
<antcall target="manifest" />
<jar
basedir="classes"
jarfile="${jar.file}.jar"
manifest="classes/META-INF/MANIFEST.MF"
/>
</else>
</if>
</then>
</if>
</target>
<target name="jar-javadoc" depends="javadoc">
<jar
basedir="${doc.dir}/${ant.project.name}/javadocs"
jarfile="${jar.file}-javadoc.jar"
/>
</target>
<target name="jar-sources">
<jar
basedir="src"
jarfile="${jar.file}-sources.jar"
/>
</target>
<target name="javadoc">
<mkdir dir="${doc.dir}/${ant.project.name}/javadocs" />
<javadoc
breakiterator="yes"
classpathref="project.classpath"
destdir="${doc.dir}/${ant.project.name}/javadocs"
encoding="UTF-8"
maxmemory="2048m"
packagenames="*.*"
sourcepath="src"
stylesheetfile="${project.dir}/tools/javadoc.css"
useexternalfile="yes"
>
<arg line="-quiet -tag generated" />
</javadoc>
</target>
<target name="manifest">
<if>
<not>
<available file="classes/META-INF/MANIFEST.MF" />
</not>
<then>
<manifest-helper analyze="true" />
<mkdir dir="classes/META-INF" />
<tstamp>
<format property="build.time" pattern="EEE MMM d HH:mm:ss z yyyy" />
</tstamp>
<manifest file="classes/META-INF/MANIFEST.MF">
<attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.5" />
<attribute name="Bundle-Vendor" value="${release.info.vendor}" />
<attribute name="Bundle-Version" value="${release.info.version}" />
<attribute name="Export-Package" value="${export.packages}" />
<attribute name="Import-Package" value="${import.packages}" />
<attribute name="Javac-Compiler" value="${javac.compiler}" />
<attribute name="Javac-Debug" value="${javac.debug}" />
<attribute name="Javac-Deprecation" value="${javac.deprecation}" />
<attribute name="Javac-Encoding" value="${javac.encoding}" />
<attribute name="Jsp-Precompile" value="${jsp.precompile}" />
<attribute name="Liferay-Portal-Build-Date" value="${release.info.build.date}" />
<attribute name="Liferay-Portal-Build-Number" value="${release.info.build.number}" />
<attribute name="Liferay-Portal-Build-Revision" value="${build.revision}" />
<attribute name="Liferay-Portal-Build-Time" value="${build.time}" />
<attribute name="Liferay-Portal-Code-Name" value="${release.info.code.name}" />
<attribute name="Liferay-Portal-Parent-Build-Number" value="${release.info.parent.build.number}" />
<attribute name="Liferay-Portal-Release-Info" value="${release.info.release.info}" />
<attribute name="Liferay-Portal-Server-Info" value="${release.info.server.info}" />
<attribute name="Liferay-Portal-Version" value="${release.info.version}" />
</manifest>
<if>
<and>
<isset property="manifest.bundle.name" />
<isset property="manifest.bundle.symbolic.name" />
</and>
<then>
<manifest file="classes/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Name" value="${manifest.bundle.name}" />
<attribute name="Bundle-SymbolicName" value="${manifest.bundle.symbolic.name}" />
</manifest>
</then>
</if>
<if>
<isset property="manifest.premain.class" />
<then>
<manifest file="classes/META-INF/MANIFEST.MF" mode="update">
<attribute name="Can-Redefine-Classes" value="${manifest.can.redefine.classes}" />
<attribute name="Can-Retransform-Classes" value="${manifest.can.retransform.classes}" />
<attribute name="Premain-Class" value="${manifest.premain.class}" />
</manifest>
</then>
</if>
</then>
</if>
</target>
<target name="release" depends="jar">
<if>
<available file="bnd.bnd" />
<then>
<release-to-repo-macro
bndRootFile="${project.dir}/common.bnd"
file="${jar.file}.jar"
/>
</then>
</if>
</target>
</project>