-
Notifications
You must be signed in to change notification settings - Fork 101
/
build.xml
333 lines (303 loc) · 15.2 KB
/
build.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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<?xml version="1.0"?>
<project name="RingoJS" default="usage" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="usage">
<echo message=""/>
<echo message="RingoJS build targets"/>
<echo message=""/>
<echo message=" update --> retrieve dependencies via Apache Ivy"/>
<echo message=" compile --> compiles the source code to ./build/classes"/>
<echo message=" jar --> generates the ./lib/ringo.jar file"/>
<echo message=" test --> run JUnit and RingoJS tests"/>
<echo message=" test-dates --> runs ringo/utils/dates test in different timezones"/>
<echo message=" javadoc --> generates the Javadoc for Ringo's core"/>
<echo message=" package --> creates RingoJS distribution"/>
<echo message=" dpkg --> creates RingoJS debian package"/>
<echo message=" clean --> clean up compiled resources"/>
</target>
<!-- =================================================================== -->
<!-- Initializes some variables -->
<!-- =================================================================== -->
<target name="init">
<property name="project" value="ringojs"/>
<property name="version" value="3.0.0"/>
<!-- pom.xml generation -->
<property name="ivy.pom.name" value="RingoJS" />
<property name="ivy.pom.description" value="RingoJS is a JavaScript platform built on the JVM and optimized for server-side applications." />
<property name="ivy.pom.url" value="https://ringojs.org/" />
<property name="ivy.pom.header" value="" />
<property name="ivy.pom.license" value="<!-- RingoJS is licensed under Apache License Version 2.0 -->" />
<property name="ivy.pom.groupId" value="org.ringojs" />
<property name="ivy.pom.artifactId" value="ringojs" />
<property name="ivy.pom.version" value="${version}" />
<!-- javac default targets for cross compilation on newer JDKs -->
<property name="ant.build.javac.source" value="8"/>
<property name="ant.build.javac.target" value="8"/>
<property name="home" value="."/>
<property name="src" value="${home}/src"/>
<property name="lib" value="${home}/lib"/>
<property name="build" value="${home}/build"/>
<property name="classes" value="${build}/classes"/>
<property name="javadoc" value="${home}/docs/java/"/>
<property name="pom.templatefile" value="${home}/tools/pom-template.xml" />
<property name="ringo-core.jar" value="${lib}/ringo-core.jar"/>
<property name="ringo-modules.jar" value="${lib}/ringo-modules.jar"/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="on"/>
<property name="testclasses" value=""/>
<path id="classpath">
<fileset dir="lib">
<include name="**/*.jar"/>
<exclude name="${ringo-core.jar}"/>
</fileset>
<pathelement location="${classes}"/>
</path>
</target>
<!-- =================================================================== -->
<!-- Fetches dependencies via Apache Ivy -->
<!-- =================================================================== -->
<target name="update">
<ivy:retrieve type="jar" sync="true" pattern="${ivy.lib.dir}/ivy/[originalname].[ext]"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${classes}"/>
<javac srcdir="${src}"
destdir="${classes}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
includeAntRuntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="classpath"/>
</javac>
</target>
<!-- =================================================================== -->
<!-- Runs the JUnit and RingoJS test cases -->
<!-- =================================================================== -->
<target name="test" depends="jar">
<java jar="run.jar" fork="true" failonerror="yes">
<arg value="test/all.js"/>
</java>
<junit haltonfailure="true">
<classpath refid="classpath"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${src}">
<include name="**/*Test*.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- =================================================================== -->
<!-- Runs the date test cases -->
<!-- =================================================================== -->
<target name="test-dates" depends="jar">
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=UTC"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+0"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<!-- GMT + Offset -->
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+1"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+2"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+3"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+4"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+5"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+6"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+7"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+8"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+9"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+10"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+11"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT+12"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<!-- GMT - Offset -->
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-1"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-2"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-3"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-4"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-5"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-6"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-7"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-8"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-9"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-10"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-11"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
<java jar="run.jar" fork="true" failonerror="yes">
<jvmarg value="-Duser.timezone=GMT-12"/>
<arg value="test/ringo/utils/dates_test.js"/>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates a jar file in the lib-directory -->
<!-- =================================================================== -->
<target name="jar" depends="compile">
<jar jarfile="${ringo-core.jar}">
<fileset dir="${home}" includes="pom.xml"/>
<fileset dir="${classes}"/>
<fileset dir="${src}" excludes="**/*.java,**/package.html"/>
</jar>
<jar jarfile="${ringo-modules.jar}">
<fileset dir="${home}" includes="modules/**"/>
</jar>
<jar jarfile="run.jar"
basedir="${classes}"
includes="**/tools/launcher/**"
manifest="${src}/org/ringojs/tools/launcher/manifest.txt"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadoc" depends="jar">
<mkdir dir="${javadoc}"/>
<javadoc packagenames="org.ringojs.*"
destdir="${javadoc}"
windowtitle="RingoJS Java API"
doctitle="RingoJS Java API">
<fileset dir="${src}" includes="**/*.java" />
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Checks if /packages is empty to prevent shipping its content -->
<!-- =================================================================== -->
<target name="packages-empty" depends="init">
<fail message="/packages is not empty, but needs to be for a packaged build!">
<condition>
<resourcecount when="greater" count="0">
<dirset dir="${home}/packages/" includes="*" />
</resourcecount>
</condition>
</fail>
</target>
<!-- =================================================================== -->
<!-- Create zipped files for distribution -->
<!-- =================================================================== -->
<target name="package" depends="packages-empty,jar,javadoc,test">
<!-- These files need chmod 755 -->
<property name="package-binaries" value="bin/ringo,bin/ringo-admin,bin/ringo-web"/>
<property name="package-excludes" value="bin/ringo,bin/ringo-admin,bin/ringo-web,bin/rp,build/**,*.zip,*.o,*.tar,*.tar.gz,.*/**,bin/rp" />
<zip zipfile="../${project}-${version}.zip">
<zipfileset dir="${home}" prefix="${project}-${version}" filemode="755" includes="${package-binaries}" />
<zipfileset dir="${home}" prefix="${project}-${version}" excludes="${package-excludes}" />
</zip>
<tar tarfile="../${project}-${version}.tar">
<tarfileset dir="${home}" prefix="${project}-${version}" filemode="755" includes="${package-binaries}" />
<tarfileset dir="${home}" prefix="${project}-${version}" excludes="${package-excludes}" />
</tar>
<gzip src="../${project}-${version}.tar" destfile="../${project}-${version}.tar.gz"/>
<delete file="../${project}-${version}.tar"/>
</target>
<!-- =================================================================== -->
<!-- Creates a POM -->
<!-- =================================================================== -->
<target name="pom" depends="init">
<ivy:makepom ivyfile="ivy.xml" pomfile="pom.xml" templatefile="${pom.templatefile}" conf="default">
<mapping conf="default" scope="compile"/>
</ivy:makepom>
</target>
<!-- =================================================================== -->
<!-- Create a debian package -->
<!-- =================================================================== -->
<target name="dpkg" depends="packages-empty,package">
<exec executable="dpkg-buildpackage">
<arg value="-rfakeroot"/>
<arg value="-b"/>
</exec>
<exec executable="dh_clean">
<arg value="debian/stamp-ant-build"/>
</exec>
</target>
<!-- =================================================================== -->
<!-- Clean up compiled resources -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${build}"/>
<delete file="${ringo-core.jar}"/>
<delete file="${ringo-modules.jar}"/>
<delete file="run.jar"/>
<!-- transitional: delete old ringo.jar file -->
<delete file="lib/ringo.jar"/>
</target>
<!-- =================================================================== -->
<!-- Clean up the ivy cache -->
<!-- =================================================================== -->
<target name="clean-cache" depends="init">
<ivy:cleancache />
</target>
</project>