-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
386 lines (338 loc) · 14.5 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
<project name="Ceylon AST" basedir="." default="test">
<property file="build.properties" />
<property name="ceylon.verbosity" value="false"/>
<property name="ceylon.executable" value="${dist.bin.dir}/ceylon"/>
<property name="out.repo" location="modules"/>
<!-- Local repository -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo" />
<path id="ant-tasks">
<pathelement location="${dist.libs.dir}/ceylon-ant.jar"/>
</path>
<typedef resource="org/eclipse/ceylon/ant/antlib.xml" classpathref="ant-tasks"/>
<moduleset id="modules.source.ceylon">
<module name="ceylon.ast.core"/>
<module name="ceylon.ast.create"/>
<module name="ceylon.ast.samples"/>
</moduleset>
<moduleset id="modules.source.jvm">
<moduleset refid="modules.source.ceylon"/>
<module name="ceylon.ast.redhat"/>
</moduleset>
<moduleset id="modules.source.js">
<moduleset refid="modules.source.ceylon"/>
</moduleset>
<moduleset id="modules.source.all">
<moduleset refid="modules.source.jvm"/>
<moduleset refid="modules.source.js"/>
</moduleset>
<moduleset id="modules.test.ceylon">
<module name="test.ceylon.ast.core"/>
<module name="test.ceylon.ast.create"/>
</moduleset>
<moduleset id="modules.test.jvm">
<moduleset refid="modules.test.ceylon"/>
<module name="test.ceylon.ast.redhat"/>
<module name="test.ceylon.ast.samples"/>
</moduleset>
<moduleset id="modules.test.js">
<moduleset refid="modules.test.ceylon"/>
</moduleset>
<moduleset id="modules.all.ceylon">
<moduleset refid="modules.source.ceylon"/>
<moduleset refid="modules.test.ceylon"/>
</moduleset>
<moduleset id="modules.all.jvm">
<moduleset refid="modules.source.jvm"/>
<moduleset refid="modules.test.jvm"/>
</moduleset>
<moduleset id="modules.all.js">
<moduleset refid="modules.source.js"/>
<moduleset refid="modules.test.js"/>
</moduleset>
<moduleset id="modules.source-gen">
<module name="source_gen.ceylon.ast"/>
</moduleset>
<target name="clean"
description="Deletes the modules directory">
<delete dir="${out.repo}"/>
</target>
<target name="compile-source-jvm"
description="Compiles the Ceylon AST modules for the JVM backend">
<ceylon-compile executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}"
pack200="true">
<moduleset refid="modules.source.jvm"/>
</ceylon-compile>
</target>
<target name="compile-source-js"
description="Compiles the Ceylon AST modules for the JS backend">
<ceylon-compile-js executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}">
<moduleset refid="modules.source.js"/>
</ceylon-compile-js>
</target>
<target name="compile-test-jvm" depends="compile-source-jvm"
description="Compiles the Ceylon AST test modules for the JVM backend">
<ceylon-compile executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}"
pack200="true">
<moduleset refid="modules.test.jvm"/>
</ceylon-compile>
</target>
<target name="compile-test-js" depends="compile-source-js"
description="Compiles the Ceylon AST test modules for the JS backend">
<ceylon-compile-js executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}">
<moduleset refid="modules.test.js"/>
</ceylon-compile-js>
</target>
<target name="compile-jvm"
description="Compiles all the Ceylon AST modules for the JVM backend">
<ceylon-compile executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}"
pack200="true">
<moduleset refid="modules.all.jvm"/>
</ceylon-compile>
</target>
<target name="compile-js"
description="Compiles all the Ceylon AST modules for the JS backend">
<ceylon-compile-js executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}">
<moduleset refid="modules.all.js"/>
</ceylon-compile-js>
</target>
<target name="compile" depends="compile-jvm,compile-js"
description="Compiles all the Ceylon AST modules"/>
<target name="compile-source-gen"
description="Compiles the Ceylon AST source-gen module">
<ceylon-compile executable="${ceylon.executable}"
src="source-gen"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}"
pack200="true">
<moduleset refid="modules.source-gen"/>
</ceylon-compile>
</target>
<target name="csg" depends="compile-source-gen"
description="A shortcut for compile-source-gen"/>
<target name="test-jvm" depends="compile-jvm"
description="Tests all the Ceylon AST modules for the JVM backend">
<ceylon-test>
<moduleset refid="modules.test.jvm"/>
</ceylon-test>
</target>
<target name="test-jvm-tap" depends="compile-jvm"
description="Tests all the Ceylon AST modules for the JVM backend, writing a TAP report to test-jvm.tap">
<ceylon-test
tap="test-jvm.tap">
<moduleset refid="modules.test.jvm"/>
</ceylon-test>
</target>
<target name="test-js" depends="compile-js"
description="Tests all the Ceylon AST modules for the JS backend">
<ceylon-test-js>
<moduleset refid="modules.test.js"/>
</ceylon-test-js>
</target>
<target name="test-js-tap" depends="compile-js"
description="Tests all the Ceylon AST modules for the JS backend, writing a TAP report to test-js.tap">
<ceylon-test-js
tap="test-js.tap">
<moduleset refid="modules.test.js"/>
</ceylon-test-js>
</target>
<target name="test" depends="test-jvm,test-js"
description="Test all the Ceylon AST modules"/>
<target name="test-tap" depends="test-jvm-tap,test-js-tap"
description="Test all the Ceylon AST modules, writing TAP reports to test-jvm.tap and test-js.tap"/>
<target name="doc"
description="Documents the Ceylon AST modules">
<ceylon-doc executable="${ceylon.executable}"
includesourcecode="true"
nomtimecheck="true"
encoding="UTF-8">
<moduleset refid="modules.source.all"/>
<linkset>
<link pattern="ceylon" url="https://modules.ceylon-lang.org/repo/1/"/>
</linkset>
</ceylon-doc>
</target>
<target name="publish-jvm" depends="compile-source-jvm"
description="Copies the Ceylon AST modules for the JVM backend to the user's repository">
<copy todir="${ceylon.repo.dir}" overwrite="true">
<fileset dir="${out.repo}">
<include name="ceylon/ast/**"/>
</fileset>
</copy>
</target>
<target name="publish-js" depends="compile-source-js"
description="Copies the Ceylon AST modules for the JS backend to the user's repository">
<copy todir="${ceylon.repo.dir}" overwrite="true">
<fileset dir="${out.repo}">
<include name="ceylon/ast/**"/>
</fileset>
</copy>
</target>
<target name="publish" depends="publish-jvm,publish-js"
description="Copies the Ceylon AST modules to the user's repository"/>
<target name="publish-herd">
<fail message="Please specify a target Herd upload repo url with -Dherd.repo=..." unless="herd.repo"/>
<fail message="Please specify a target Herd user name with -Dherd.user=..." unless="herd.user"/>
<fail message="Please specify a target Herd password with -Dherd.pass=..." unless="herd.pass"/>
<ceylon-compile executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
out="${herd.repo}"
user="${herd.user}"
pass="${herd.pass}"
encoding="UTF-8">
<moduleset refid="modules.source.jvm"/>
</ceylon-compile>
<ceylon-compile-js executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
out="${herd.repo}"
user="${herd.user}"
pass="${herd.pass}"
encoding="UTF-8">
<moduleset refid="modules.source.js"/>
</ceylon-compile-js>
<ceylon-doc executable="${ceylon.executable}"
includesourcecode="true"
nomtimecheck="true"
out="${herd.repo}"
user="${herd.user}"
pass="${herd.pass}"
encoding="UTF-8">
<moduleset refid="modules.source.all"/>
<linkset>
<link pattern="ceylon" url="https://modules.ceylon-lang.org/repo/1/"/>
</linkset>
</ceylon-doc>
</target>
<property name="jacoco.dir" location="lib"/>
<property name="jacoco.tmp.file" location="${jacoco.dir}/jacoco.zip"/>
<property name="jacoco.agent.jar" location="${jacoco.dir}/jacocoagent.jar"/>
<property name="jacoco.ant.jar" location="${jacoco.dir}/jacocoant.jar"/>
<property name="jacoco.exec.file" location="jacoco.exec"/>
<property name="jacoco.classes.dir" location="classes"/>
<property name="jacoco.report.dir" location="coverage"/>
<target name="coverage-install"
description="Dowloads the latest JaCoCo build and extracts the libraries into the ${jacoco.dir} directory">
<mkdir dir="${jacoco.dir}"/>
<get src="https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=org.jacoco&a=jacoco&e=zip&v=LATEST"
dest="${jacoco.tmp.file}"/>
<unzip src="${jacoco.tmp.file}"
dest="${jacoco.dir}">
<patternset>
<include name="lib/*.jar"/>
</patternset>
<mapper type="flatten"/>
</unzip>
<delete file="${jacoco.tmp.file}"/>
</target>
<target name="coverage-uninstall"
description="Removes the JaCoCo libraries from the ${jacoco.dir} directory">
<!-- remove the JaCoCo files -->
<delete>
<fileset dir="${jacoco.dir}" includes="*jacoco*.jar"/>
</delete>
<!-- and if there was nothing else in the directory, remove it as well -->
<delete includeemptydirs="true">
<fileset dir="${jacoco.dir}">
<size value="0"/>
</fileset>
</delete>
</target>
<target name="coverage-test" depends="compile-jvm"
description="Runs the tests with JaCoCo attached">
<fail message="JaCoCo agent not found; try running ‘ant coverage-install’.">
<condition>
<not>
<available file="${jacoco.agent.jar}"/>
</not>
</condition>
</fail>
<!--
We have to run Java with a special JVM option to add the JaCoCo Java Agent.
The ceylon-test ant task doesn’t support that, but luckily the 'ceylon test' tool does:
Set the JAVA_OPTS environment variable.
-->
<exec executable="${ceylon.executable}">
<arg value="test"/>
<arg value="test.ceylon.ast.core"/>
<arg value="test.ceylon.ast.create"/>
<arg value="test.ceylon.ast.redhat"/>
<arg value="test.ceylon.ast.samples"/>
<env key="JAVA_OPTS" value="-javaagent:${jacoco.agent.jar}=destfile=${jacoco.exec.file},append=false"/>
</exec>
</target>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"
onerror="ignore"> <!-- we’ll check in coverage-report if the jar is present or not -->
<classpath path="${jacoco.ant.jar}"/>
</taskdef>
<target name="coverage-report"
description="Generates the JaCoCo coverage report">
<fail message="JaCoCo libraries not found; try running ‘ant coverage-install’.">
<condition>
<not>
<available file="${jacoco.ant.jar}"/>
</not>
</condition>
</fail>
<!-- the report generator needs the class files extracted -->
<unzip dest="${jacoco.classes.dir}">
<fileset dir="modules">
<include name="**/*.car"/>
</fileset>
<patternset>
<include name="**/*.class"/>
</patternset>
</unzip>
<jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
<executiondata>
<file file="${jacoco.exec.file}"/>
</executiondata>
<structure name="ceylon.ast">
<classfiles>
<fileset dir="${jacoco.classes.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="source">
<include name="**/*.ceylon"/>
</fileset>
</sourcefiles>
</structure>
<html destdir="${jacoco.report.dir}"/>
<csv destfile="${jacoco.report.dir}/report.csv"/>
<xml destfile="${jacoco.report.dir}/report.xml"/>
</jacoco:report>
</target>
<target name="coverage-show"
description="Opens the JaCoCo coverage report in Firefox">
<exec executable="firefox">
<arg file="${jacoco.report.dir}/index.html"/>
</exec>
</target>
<target name="coverage-clean-intermediate"
description="Deletes the raw coverage data">
<delete file="${jacoco.exec.file}"/>
</target>
<target name="coverage-clean" depends="coverage-clean-intermediate"
description="Deletes all coverage data">
<delete dir="${jacoco.report.dir}"/>
</target>
<target name="coverage" depends="coverage-test,coverage-report,coverage-clean-intermediate,coverage-show"
description="Runs the tests with JaCoCo attached and shows a report"/>
</project>