forked from ringo/ringojs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
302 lines (279 loc) · 13.3 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
<?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=" docs --> generates the API docs"/>
<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="0.10.1-SNAPSHOT"/>
<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="docs" value="${home}/docs"/>
<property name="jsdocs" value="${home}/docs/modules"/>
<property name="javadocs" value="${home}/docs/java"/>
<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]"/>
<get src="https://oss.sonatype.org/content/repositories/snapshots/org/mozilla/rhino/1.7R5-SNAPSHOT/rhino-1.7R5-20120629.144839-4.jar"
dest="lib/ivy/rhino-1.7R5-SNAPSHOT.jar" usetimestamp="true"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${classes}"/>
<javac srcdir="${src}"
source="1.5"
target="1.5"
destdir="${classes}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"
includeAntRuntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath refid="classpath"/>
<!-- fix for openjdk rhino bootclasspath bug -->
<compilerarg value="-Xbootclasspath/p:${lib}/js.jar"/>
</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="${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="docs" depends="jar">
<mkdir dir="${javadocs}"/>
<javadoc packagenames="org.ringojs.*"
destdir="${javadocs}"
windowtitle="RingoJS Java API"
doctitle="RingoJS Java API">
<fileset dir="${src}" includes="**/*.java" />
<classpath refid="classpath"/>
</javadoc>
<delete dir="${jsdocs}"/>
<java jar="run.jar" fork="true">
<arg value="${home}/tools/jsdoc/main.js"/>
<arg value="--file-urls"/>
<arg value="--source=${home}/modules"/>
<arg value="--directory=${jsdocs}"/>
<arg value="--name=Ringo Modules"/>
</java>
</target>
<!-- =================================================================== -->
<!-- Create zipped files for distribution -->
<!-- =================================================================== -->
<target name="package" depends="jar,docs,test">
<zip zipfile="../${project}-${version}.zip">
<zipfileset dir="${home}" prefix="${project}-${version}"
excludes="build/**,*.zip,*.o,*.tar,*.tar.gz,.*/**" />
</zip>
<tar tarfile="../${project}-${version}.tar">
<tarfileset dir="${home}" prefix="${project}-${version}"
filemode="755" includes="bin/ringo,bin/ringo-admin,bin/ringo-web,bin/narwhal" />
<tarfileset dir="${home}" prefix="${project}-${version}"
excludes="bin/ringo,bin/ringo-admin,bin/ringo-web,bin/narwhal,build/**,*.zip,*.o,*.tar,*.tar.gz,.*/**" />
</tar>
<gzip src="../${project}-${version}.tar" destfile="../${project}-${version}.tar.gz"/>
<delete file="../${project}-${version}.tar"/>
</target>
<!-- =================================================================== -->
<!-- Create a debian package -->
<!-- =================================================================== -->
<target name="dpkg">
<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>
</project>