forked from ceylon/ceylon.language
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
446 lines (404 loc) · 20.1 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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<project name="Ceylon Language module" default="publish" basedir=".">
<property file="../ceylon-common/common-build.properties"/>
<property file="build.properties"/>
<!-- Set build directories for all formats. -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes" location="${build.dir}/classes"/>
<property name="build.dist" location="${build.dir}/dist"/>
<property name="build.dist.repo" location="${build.dist}/repo"/>
<property name="build.lib" location="${build.dir}/lib"/>
<property name="build.test" location="${build.dir}/test"/>
<property name="build.test.repo" location="${build.dir}/test-repo"/>
<property name="ide.dist" location="${basedir}/ide-dist"/>
<!-- The Java/JS source files for the runtime -->
<property name="runtime.src" location="runtime"/>
<property name="runtime-js.src" location="runtime-js"/>
<property name="test.src" location="test"/>
<property name="test.java.src" location="test-java"/>
<property name="test-jvm.src" location="test-jvm"/>
<property name="test-js.src" location="test-js"/>
<property name="test.reports" location="${build.dir}/test-reports"/>
<tstamp/>
<!-- Local repository -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo"/>
<property name="ceylon.dist.dir" location="${basedir}/../ceylon-dist/dist"/>
<!-- ceylon.language -->
<property name="module.language.src" value="${basedir}/src"/>
<property name="module.language.dir" value="ceylon/language"/>
<property name="module.language.name" value="ceylon.language"/>
<property name="module.language.runtime" value="${basedir}/runtime"/>
<!-- module archives -->
<property name="ceylon.language.name" value="${module.language.name}-${module.ceylon.language.version}"/>
<property name="ceylon.language.dir" value="${module.language.dir}/${module.ceylon.language.version}"/>
<property name="ceylon.language.src" value="${ceylon.language.dir}/${ceylon.language.name}.src"/>
<property name="ceylon.language.car" value="${ceylon.language.dir}/${ceylon.language.name}.car"/>
<property name="ceylon.language.js" value="${ceylon.language.dir}/${ceylon.language.name}.js"/>
<property name="ceylon.language.repo" value="${ceylon.repo.dir}/${ceylon.language.dir}"/>
<property name="ceylon.language.dist" value="${build.dist.repo}/${ceylon.language.dir}"/>
<property name="ceylon.compiler.loc" value="${ceylon.dist.dir}/bin/ceylon"/>
<property name="ceylon.compiler.dir" value="com/redhat/ceylon/compiler/java/${module.com.redhat.ceylon.compiler.version}"/>
<property name="ceylon.compiler.jar" value="${ceylon.compiler.dir}/com.redhat.ceylon.compiler.java-${module.com.redhat.ceylon.compiler.version}.jar"/>
<property name="ceylon.compiler.lib" location="${ceylon.repo.dir}/${ceylon.compiler.jar}"/>
<property name="ceylon.common.dir" value="com/redhat/ceylon/common/${module.com.redhat.ceylon.common.version}"/>
<property name="ceylon.common.jar" value="${ceylon.common.dir}/com.redhat.ceylon.common-${module.com.redhat.ceylon.common.version}.jar"/>
<property name="ceylon.common.lib" location="${ceylon.repo.dir}/${ceylon.common.jar}"/>
<!-- For JS -->
<property name="ceylon.compiler-js.dir" value="com/redhat/ceylon/compiler/js/${module.com.redhat.ceylon.compiler.js.version}"/>
<property name="ceylon.compiler-js.jar" value="${ceylon.compiler-js.dir}/com.redhat.ceylon.compiler.js-${module.com.redhat.ceylon.compiler.js.version}.jar"/>
<property name="ceylon.compiler-js.lib" location="${ceylon.repo.dir}/${ceylon.compiler-js.jar}"/>
<property name="ceylon.module-resolver.dir" value="com/redhat/ceylon/module-resolver/${module.com.redhat.ceylon.module-resolver.version}"/>
<property name="ceylon.module-resolver.jar" value="${ceylon.module-resolver.dir}/com.redhat.ceylon.module-resolver-${module.com.redhat.ceylon.module-resolver.version}.jar"/>
<property name="ceylon.module-resolver.lib" location="${ceylon.repo.dir}/${ceylon.module-resolver.jar}"/>
<property name="ceylon.typechecker.dir" value="com/redhat/ceylon/typechecker/${module.com.redhat.ceylon.typechecker.version}"/>
<property name="ceylon.typechecker.jar" value="${ceylon.typechecker.dir}/com.redhat.ceylon.typechecker-${module.com.redhat.ceylon.typechecker.version}.jar"/>
<property name="ceylon.typechecker.lib" location="${ceylon.repo.dir}/${ceylon.typechecker.jar}"/>
<property name="ceylon.ant.lib" location="${ceylon.dist.dir}/lib/ceylon-ant.jar"/>
<property name="tests.car" value="${build.test}/default/default.car"/>
<path id="compile.classpath">
<pathelement path="${ceylon.common.lib}"/>
</path>
<path id="test.compile.classpath">
<pathelement path="${build.dist.repo}/${ceylon.language.car}"/>
<pathelement path="${junit.lib}"/>
</path>
<path id="test.run.classpath">
<path refid="test.compile.classpath"/>
<pathelement path="${build.test}"/>
<pathelement path="${ceylon.common.lib}"/>
<pathelement path="${ceylon.module-resolver.lib}"/>
<pathelement path="${ceylon.typechecker.lib}"/>
<pathelement path="${ceylon.compiler.lib}"/>
</path>
<path id="ant-tasks">
<pathelement path="${ceylon.ant.lib}"/>
</path>
<path id="js.compiler.classpath">
<pathelement path="${antlr.lib}"/>
<pathelement path="${json.lib}" />
<pathelement path="${ceylon.common.lib}"/>
<pathelement path="${ceylon.module-resolver.lib}"/>
<pathelement path="${ceylon.typechecker.lib}"/>
<pathelement path="${ceylon.compiler-js.lib}"/>
</path>
<path id="js.test.compile.classpath">
<path refid="js.compiler.classpath"/>
<pathelement path="${basedir}/../ceylon-js/build/lib/compiler.js.test.jar"/>
</path>
<typedef resource="com/redhat/ceylon/ant/antlib.xml" classpathref="ant-tasks"/>
<!-- ################################################################## -->
<!-- constant to declare a file binary for checksumsum -->
<property name="checksum.binary-prefix" value=" *" />
<!-- Helper target, used to create a sha1 checksum file -->
<!-- Requires 'file' as a parameter. -->
<target name="sha1sum">
<fail unless="file"/>
<fail if="filename"/>
<fail if="value"/>
<basename file="${file}" property="filename"/>
<checksum file="${file}" property="value" algorithm="sha1"/>
<echo file="${file}.sha1" message="${value}"/>
</target>
<!-- Rule to clean everything up -->
<target name="clean" description="Clean up everything">
<delete dir="${build.dir}"/>
</target>
<target name="ide" depends="dist,ide-quick">
</target>
<target name="ide-quick">
<copy
overwrite="true"
todir="../ceylon-ide-eclipse/plugins/com.redhat.ceylon.eclipse.ui/defaultRepository">
<fileset dir="${build.dist.repo}">
<include name="**/*"/>
<exclude name="**/module-doc/**/*"/>
</fileset>
</copy>
</target>
<target name="dist"
depends="build"
description="Create Ceylon language distribution">
<delete file="${build.dist.repo}/${ceylon.language.src}"/>
<delete file="${build.dist.repo}/${ceylon.language.src}.sha1"/>
<zip destfile="${build.dist.repo}/${ceylon.language.src}">
<fileset dir="${module.language.src}">
<include name="ceylon/language/**/*.ceylon"/>
</fileset>
<fileset dir="${module.language.runtime}">
<include name="**/*.java"/>
</fileset>
</zip>
<antcall target="sha1sum">
<param name="file" value="${build.dist.repo}/${ceylon.language.src}" />
</antcall>
</target>
<!-- Repository targets -->
<target name="publish"
depends="clean.repo,init.repo,dist,publish-internal"
description="Publish Ceylon language module to default repo">
</target>
<target name="publish-internal" depends="init.repo">
<copy todir="${ceylon.repo.dir}" overwrite="true">
<fileset dir="${build.dist.repo}"/>
</copy>
</target>
<target name="init.repo"
description="Create default local Ceylon module repository">
<mkdir dir="${ceylon.language.repo}"/>
</target>
<target name="clean.repo"
description="Clean default local Ceylon module repository">
<delete dir="${ceylon.language.repo}"/>
</target>
<!-- Tasks related to building the ceylon.language module -->
<!-- Rule to build runtime classes from their Java and Ceylon sources -->
<target name="ceylon.language.java">
<!-- toplevel types -->
<ceylon-compile
executable="${ceylon.compiler.loc}"
verbose="false"
encoding="UTF-8"
noMtimeCheck="true"
src="${module.language.src}:${runtime.src}"
out="${build.dist.repo}">
<javacoption>-Xbootstrapceylon</javacoption>
<javacoption>-g</javacoption>
<files>
<include name="**/*.ceylon"/>
<include name="com/redhat/**/*.java"/>
<!-- We swap the nativily implemented files for their Java counter parts -->
<exclude name="ceylon/language/Array.ceylon"/>
<include name="ceylon/language/Array.java"/>
<exclude name="ceylon/language/ArraySequence.ceylon"/>
<include name="ceylon/language/ArraySequence.java"/>
<include name="ceylon/language/arrayOfSize_.java"/>
<exclude name="ceylon/language/Boolean.ceylon"/>
<include name="ceylon/language/Boolean.java"/>
<include name="ceylon/language/true_.java"/>
<include name="ceylon/language/false_.java"/>
<exclude name="ceylon/language/Callable.ceylon"/>
<include name="ceylon/language/Callable.java"/>
<exclude name="ceylon/language/Character.ceylon"/>
<include name="ceylon/language/Character.java"/>
<exclude name="ceylon/language/className.ceylon"/>
<include name="ceylon/language/className_.java"/>
<exclude name="ceylon/language/Exception.ceylon"/>
<include name="ceylon/language/Exception.java"/>
<exclude name="ceylon/language/suppressedExceptions.ceylon"/>
<include name="ceylon/language/suppressedExceptions_.java"/>
<exclude name="ceylon/language/Float.ceylon"/>
<include name="ceylon/language/Float.java"/>
<include name="ceylon/language/parseFloat_.java"/>
<include name="ceylon/language/infinity_.java"/>
<exclude name="ceylon/language/identityHash.ceylon"/>
<include name="ceylon/language/identityHash_.java"/>
<exclude name="ceylon/language/Integer.ceylon"/>
<include name="ceylon/language/Integer.java"/>
<exclude name="ceylon/language/language.ceylon"/>
<include name="ceylon/language/language_.java"/>
<exclude name="ceylon/language/runtime.ceylon"/>
<include name="ceylon/language/runtime_.java"/>
<exclude name="ceylon/language/operatingSystem.ceylon"/>
<include name="ceylon/language/operatingSystem_.java"/>
<exclude name="ceylon/language/process.ceylon"/>
<include name="ceylon/language/process_.java"/>
<exclude name="ceylon/language/integerRangeByIterable.ceylon"/>
<include name="ceylon/language/integerRangeByIterable_.java"/>
<exclude name="ceylon/language/SequenceBuilder.ceylon"/>
<include name="ceylon/language/SequenceBuilder.java"/>
<include name="ceylon/language/SequenceAppender.java"/>
<exclude name="ceylon/language/system.ceylon"/>
<include name="ceylon/language/system_.java"/>
<exclude name="ceylon/language/printStackTrace.ceylon"/>
<include name="ceylon/language/printStackTrace_.java"/>
<exclude name="ceylon/language/internalSort.ceylon"/>
<include name="ceylon/language/internalSort_.java"/>
<exclude name="ceylon/language/String.ceylon"/>
<include name="ceylon/language/String.java"/>
<include name="ceylon/language/string_.java"/>
<exclude name="ceylon/language/StringBuilder.ceylon"/>
<include name="ceylon/language/StringBuilder.java"/>
<exclude name="ceylon/language/Tuple.ceylon"/>
<include name="ceylon/language/Tuple.java"/>
<exclude name="ceylon/language/flatten.ceylon"/>
<include name="ceylon/language/flatten_.java"/>
<include name="ceylon/language/unflatten_.java"/>
<exclude name="ceylon/language/meta/metamodel.ceylon"/>
<include name="ceylon/language/meta/type_.java"/>
<include name="ceylon/language/meta/typeLiteral_.java"/>
<exclude name="ceylon/language/meta/annotations.ceylon"/>
<include name="ceylon/language/meta/annotations_.java"/>
<exclude name="ceylon/language/meta/modules.ceylon"/>
<include name="ceylon/language/meta/modules_.java"/>
</files>
</ceylon-compile>
</target>
<!-- generate the ceylon.language.js file -->
<target name="ceylon.language.js">
<mkdir dir="${ceylon.language.dist}"/>
<java classname="com.redhat.ceylon.compiler.js.Stitcher" classpathref="js.compiler.classpath" fork="true" failonerror="yes">
<arg value="${runtime-js.src}/ceylon.language.js" />
<arg value="${runtime-js.src}/language-module.txt" />
<arg value="${build.dist.repo}/${ceylon.language.js}" />
</java>
</target>
<!-- Rule to generate the documentation from the Ceylon sources -->
<target name="ceylon.language.doc">
<ceylon-doc
executable="${ceylon.compiler.loc}"
src="${module.language.src}"
encoding="UTF-8"
out="${build.dist.repo}">
<module name="ceylon.language"/>
</ceylon-doc>
</target>
<!-- Rule to compile and test -->
<target name="build" depends="ceylon.language.java,ceylon.language.js">
<!-- Temporary hack to prevent problems in the IDE when the compilation fails -->
<mkdir dir="${ide.dist}"/>
<copy todir="${ide.dist}">
<fileset dir="${build.dist.repo}/${ceylon.language.dir}">
<include name="${ceylon.language.name}.car"/>
</fileset>
</copy>
</target>
<target name="compile.tests.setup">
<delete dir="${build.test.repo}"/>
<mkdir dir="${build.test.repo}"/>
<copy todir="${build.test.repo}">
<fileset dir="${ceylon.dist.dir}/repo">
<exclude name="ceylon/language/**"/>
</fileset>
</copy>
<copy todir="${build.test.repo}">
<fileset dir="${build.dist.repo}">
<include name="ceylon/language/**"/>
</fileset>
</copy>
<copy todir="${build.test.repo}">
<fileset dir="${ceylon.dist.dir}/repo">
<include name="ceylon/language/${module.ceylon.language.version}/module.xml"/>
</fileset>
</copy>
<delete dir="${build.test}"/>
<mkdir dir="${build.test}"/>
</target>
<target name="compile.tests.java" depends="ceylon.language.java,compile.tests.setup">
<ceylon-compile
executable="${ceylon.compiler.loc}"
src="${test.src}:${test.java.src}"
sysrep="${build.test.repo}"
encoding="UTF-8"
out="${build.test}">
<files>
<include name="**/*.ceylon"/>
</files>
<rep url="aether"/>
</ceylon-compile>
<javac
srcdir="${test-jvm.src}"
destdir="${build.test}"
debug="true"
encoding="UTF-8"
classpathref="test.compile.classpath"
includeantruntime="false">
<include name="**/*.java"/>
</javac>
</target>
<target name="test.java" depends="compile.tests.java"
description="compile and run the JVM tests">
<ceylon-run
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
run="runAndAssert"
module="default"
resultproperty="test.ceylon.result.1">
<rep url="${build.test}"/>
</ceylon-run>
<ceylon-run
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
module="javaa/1"
resultproperty="test.ceylon.result.2">
<rep url="${build.test}"/>
<rep url="aether"/>
</ceylon-run>
<ceylon-run
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
module="metamodel/0.1"
resultproperty="test.ceylon.result.3">
<rep url="${build.test}"/>
</ceylon-run>
<ceylon-run
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
module="annotations/0.1"
resultproperty="test.ceylon.result.4">
<rep url="${build.test}"/>
</ceylon-run>
<condition property="test.fail.ceylon">
<and>
<not><equals arg1="${test.ceylon.result.1}" arg2="0"/></not>
<not><equals arg1="${test.ceylon.result.2}" arg2="0"/></not>
<not><equals arg1="${test.ceylon.result.3}" arg2="0"/></not>
<not><equals arg1="${test.ceylon.result.4}" arg2="0"/></not>
</and>
</condition>
<mkdir dir="${test.reports}"/>
<junit printsummary="yes" haltonfailure="no"
errorproperty="test.fail.junit"
failureproperty="test.fail.junit">
<classpath refid="test.run.classpath"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${build.test}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<!--<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${test.reports}"/>
</junitreport>-->
<fail if="${test.fail.ceylon}" message="There were failures in the Ceylon tests"/>
<fail if="${test.fail.junit}" message="There were Junit test failures"/>
</target>
<target name="compile.tests.js" depends="ceylon.language.js,compile.tests.setup">
<ceylon-compile-js
executable="${ceylon.compiler.loc}"
encoding="UTF-8"
src="${test.src}"
sysrep="${build.test.repo}"
out="${build.test}">
<files>
<include name="**/*.ceylon"/>
</files>
</ceylon-compile-js>
</target>
<target name="test.js" depends="compile.tests.js"
description="compile and run the Node.js tests (requires node)">
<ceylon-run-js
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
module="default">
<rep url="build/test" />
</ceylon-run-js>
<ceylon-run-js
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
module="metamodel/0.1">
<rep url="${build.test}"/>
</ceylon-run-js>
<ceylon-run-js
executable="${ceylon.compiler.loc}"
sysrep="${build.test.repo}"
module="annotations/0.1">
<rep url="${build.test}"/>
</ceylon-run-js>
</target>
<target name="test" depends="test.java,test.js"
description="compile and run the tests for JVM and Node.js (requires node)">
</target>
</project>