-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.xml
419 lines (383 loc) · 21.9 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
<project name="Ceylon compiler" default="all" basedir=".">
<property file="../ceylon-common/user-build.properties" />
<property file="../ceylon-common/common-build.properties" />
<property file="build.properties" />
<property name="name" value="Ceylon compiler" />
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo" />
<property name="ceylon.bin.dir" location="${user.home}/.ceylon/bin" />
<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}" />
<property name="ceylon.model.dir" value="com/redhat/ceylon/model/${module.com.redhat.ceylon.model.version}" />
<property name="ceylon.model.jar" value="${ceylon.model.dir}/com.redhat.ceylon.model-${module.com.redhat.ceylon.model.version}.jar" />
<property name="ceylon.model.lib" location="${ceylon.repo.dir}/${ceylon.model.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.language.dir" value="ceylon/language/${module.ceylon.language.version}" />
<property name="ceylon.language.car" value="${ceylon.language.dir}/ceylon.language-${module.ceylon.language.version}.car" />
<property name="ceylon.language.lib" location="${ceylon.repo.dir}/${ceylon.language.car}" />
<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.maven-support.dir" value="com/redhat/ceylon/maven-support/${module.com.redhat.ceylon.maven-support.version}" />
<property name="ceylon.maven-support.jar" value="${ceylon.maven-support.dir}/com.redhat.ceylon.maven-support-${module.com.redhat.ceylon.maven-support.version}.jar" />
<property name="ceylon.maven-support.lib" location="${ceylon.repo.dir}/${ceylon.maven-support.jar}" />
<property name="ceylon.bootstrap.dir" value="ceylon/bootstrap/${module.ceylon.bootstrap.version}" />
<property name="ceylon.bootstrap.jar" value="${ceylon.bootstrap.dir}/ceylon.bootstrap-${module.ceylon.bootstrap.version}.jar" />
<property name="ceylon.bootstrap.lib" location="${ceylon.repo.dir}/${ceylon.bootstrap.jar}" />
<!-- The Java source files for the compiler -->
<property name="javac.src" location="langtools/src/share/classes" />
<property name="ceylonc.src" location="src" />
<property name="common.src" location="../ceylon-common/src" />
<property name="test.src" location="test/src" />
<property name="test.ceylond.src" location="test/ceylondoc" />
<!-- Directories everything gets built into -->
<property name="build" location="build" />
<property name="build.classes" location="${build}/classes" />
<property name="build.ceylon.cars" location="${build}/ceylon-cars" />
<property name="build.poms" location="${build}/poms" />
<property name="build.bin" location="${build}/bin" />
<property name="build.lib" location="${build}/lib" />
<property name="build.api" location="${build}/api" />
<property name="build.dist" location="${build}/dist" />
<property name="build.dist.repo" location="${build.dist}/repo" />
<property name="test.reports" location="${build}/test-reports" />
<!-- Jarfiles everything ends up in -->
<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.compiler.repo" value="${ceylon.repo.dir}/${ceylon.compiler.dir}" />
<property name="ceylon.compiler.dist" value="${build.dist.repo}/${ceylon.compiler.dir}" />
<property name="ceylon-tests.dir" location="${build.ceylon.cars}/com/redhat/ceylon/compiler/java/test/ceylon/${module.com.redhat.ceylon.compiler.version}" />
<property name="ceylon-tests.car" location="${ceylon-tests.dir}/com.redhat.ceylon.compiler.java.test.ceylon-${module.com.redhat.ceylon.compiler.version}.car" />
<!-- The directory that parser tests live in, and
the directory test results get written into -->
<property name="parser.test.src" location="corpus/tests" />
<property name="parser.test.dst" location="${build}/test/parser" />
<tstamp>
<format property="qualifier" timezone="GMT" pattern="'v'yyyyMMdd-HHmm"/>
</tstamp>
<path id="compiler.classpath">
<pathelement path="${ceylon.common.lib}" />
<pathelement path="${ceylon.model.lib}" />
<pathelement path="${ceylon.module-resolver.lib}" />
<pathelement path="${ceylon.typechecker.lib}" />
<pathelement path="${ceylon.language.lib}" />
<pathelement path="${antlr.lib}" />
<pathelement path="${txtmark.lib}" />
</path>
<path id="test.compile.classpath">
<path refid="compiler.classpath" />
<pathelement path="${build.classes}" />
<pathelement path="${junit.lib}" />
<pathelement path="${hamcrest.lib}" />
<pathelement path="${markdownpapers.lib}" />
<pathelement path="${jboss-modules.lib}" />
</path>
<path id="test.run.classpath">
<path refid="test.compile.classpath" />
<pathelement path="${ceylon.compiler.lib}" />
<pathelement path="${ceylon.language.lib}" />
<pathelement path="${ceylon-tests.car}" />
<pathelement path="${ceylon.maven-support.lib}" />
<pathelement path="${shrinkwrap-maven-uberjar.lib}" />
<pathelement path="${jboss-logmanager.lib}" />
<pathelement path="${jandex.lib}" />
<pathelement path="${slf4j-simple.lib}" />
<pathelement path="${slf4j-api.lib}" />
<pathelement path="${sardine.lib}" />
<pathelement path="${httpcore.lib}" />
<pathelement path="${httpclient.lib}" />
<pathelement path="${commons-codec.lib}" />
<pathelement path="${commons-logging.lib}" />
<pathelement path="${json.lib}" />
</path>
<!-- ################################################################## -->
<!-- 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">
<delete dir="${build}" />
<delete dir="samples/helloworld/modules" />
<delete dir="samples/no-module/modules" />
</target>
<!-- Repository targets -->
<target name="init.repo" description="Initialize the default local Ceylon module repository">
<mkdir dir="${ceylon.bin.dir}" />
<mkdir dir="${ceylon.compiler.repo}" />
</target>
<target name="clean.repo" description="Clean default local Ceylon module repository">
<delete dir="${ceylon.compiler.repo}" />
</target>
<target name="dist" depends="build" description="Create Ceylon compiler distribution">
<copy file="${txtmark.lib}" tofile="${build.dist.repo}/${txtmark.repo}"/>
</target>
<target name="publish" depends="dist,clean.repo,init.repo,publish-internal" description="Publish Ceylon compiler 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>
<copy todir="${ceylon.bin.dir}" overwrite="true">
<fileset dir="${build.bin}" />
</copy>
</target>
<!-- Rule to compile and test -->
<target name="all" depends="test" />
<!-- Rule to build compiler classes from their Java sources -->
<target name="compiler.classes">
<mkdir dir="${build.classes}" />
<javac srcdir="${javac.src}:${ceylonc.src}" destdir="${build.classes}" debug="true" encoding="UTF-8" classpathref="compiler.classpath" target="${compile.java.target}" source="${compile.java.source}" bootclasspath="${compile.java.bootclasspath}" includeantruntime="true">
<compilerarg value="-XDignore.symbol.file" />
<exclude name="**/Java7Checker.java" />
<exclude name="com/redhat/ceylon/tools/Tool.java" />
<exclude name="com/redhat/ceylon/tools/Plugin.java" />
<exclude name="com/redhat/ceylon/ant/**" />
<exclude name="com/redhat/ceylon/launcher/**" />
<include name="com/redhat/**" />
<include name="com/sun/tools/javac/**" />
<include name="com/sun/source/**" />
<include name="javax/**" />
</javac>
<!--
We need a second compilation step to compile entry points compatible with Java 5
to be able to produce nice error messages for older Java versions. Same for ant
tasks, so that they can run on Java 5 and the error messages are left to the
programs they spawn.
-->
<delete dir="${build.classes}">
<include name="**/Java7Checker.class" />
<include name="com/redhat/ceylon/ant/**" />
<include name="com/redhat/ceylon/launcher/**" />
</delete>
<javac srcdir="${javac.src}:${ceylonc.src}:${common.src}" destdir="${build.classes}" debug="true" encoding="UTF-8" classpathref="compiler.classpath" target="1.5" source="1.5" includeantruntime="true">
<include name="**/Java7Checker.java" />
<include name="com/redhat/ceylon/tools/Tool.java" />
<include name="com/redhat/ceylon/tools/Plugin.java" />
<include name="com/redhat/ceylon/ant/**" />
<include name="com/redhat/ceylon/launcher/**" />
<include name="com/redhat/ceylon/common/*" />
<include name="com/redhat/ceylon/common/config/*" />
<include name="com/redhat/ceylon/common/tools/ModuleWildcardsHelper.java" />
</javac>
<copy todir="${build.classes}">
<fileset dir="${ceylonc.src}">
<exclude name="com/redhat/**/*.utf8properties" />
<include name="com/redhat/**/resources/**" />
<include name="com/redhat/**/*.properties" />
<include name="com/redhat/ceylon/ant/antlib.xml" />
<include name="META-INF/**" />
</fileset>
<fileset dir="${common.src}">
<include name="com/redhat/ceylon/common/config/**/*.properties" />
</fileset>
</copy>
<native2ascii dest="${build.classes}" src="${ceylonc.src}" encoding="UTF-8" ext=".properties">
<include name="com/redhat/**/*.utf8properties" />
</native2ascii>
</target>
<!-- Rule to build compiler test classes from their Java sources -->
<target name="test.classes" depends="compiler.classes">
<mkdir dir="${build.classes}" />
<javac destdir="${build.classes}" debug="true" encoding="UTF-8" classpathref="test.compile.classpath" target="${compile.java.target}" source="${compile.java.source}" bootclasspath="${compile.java.bootclasspath}" includeantruntime="false">
<src path="${test.ceylond.src}"/>
<src path="${test.src}"/>
<include name="com/redhat/ceylon/compiler/java/test/**" />
<exclude name="com/redhat/ceylon/compiler/java/test/interop/mixed/**" />
<exclude name="com/redhat/ceylon/compiler/java/test/interop/Bug*" />
<exclude name="com/redhat/ceylon/compiler/java/test/cmr/modules/bug1062/**" />
<exclude name="com/redhat/ceylon/compiler/java/test/recovery/modules/bug1411/**" />
<exclude name="com/redhat/ceylon/compiler/java/test/issues/*/**" />
<include name="com/redhat/ceylon/tools/**" />
<exclude name="com/redhat/ceylon/tools/test/bug1183/**" />
<include name="com/redhat/ceylon/itest/**" />
<include name="com/redhat/ceylon/ant/**" />
<include name="com/redhat/ceylon/ceylondoc/test/**" />
</javac>
<copy todir="${build.classes}">
<fileset dir="${test.src}">
<include name="META-INF/**" />
<include name="**/*.txt" />
<include name="**/*.md" />
<include name="**/*.properties" />
</fileset>
</copy>
</target>
<!-- Rule to build compiler jar -->
<target name="compiler.jar" depends="compiler.classes">
<mkdir dir="${build.dist.repo}/${ceylon.compiler.dir}" />
<mkdir dir="${build.bin}" />
<jar destfile="${build.dist.repo}/${ceylon.compiler.jar}">
<fileset dir="${build.classes}">
<exclude name="ceylon/**" />
<exclude name="javax/**" />
<exclude name="com/redhat/ceylon/compiler/java/test/**" />
<exclude name="com/redhat/ceylon/ant/**" />
<exclude name="com/redhat/ceylon/common/**" />
<exclude name="com/redhat/ceylon/launcher/**" />
</fileset>
<fileset dir="${javac.src}">
<include name="com/sun/tools/javac/resources/*.properties" />
</fileset>
<manifest>
<attribute name="Bundle-SymbolicName" value="com.redhat.ceylon.compiler.java"/>
<attribute name="Bundle-Version" value="${module.com.redhat.ceylon.compiler.version}.${qualifier}"/>
</manifest>
</jar>
<antcall target="sha1sum">
<param name="file" value="${build.dist.repo}/${ceylon.compiler.jar}" />
</antcall>
</target>
<!-- Rule to build ant jar -->
<target name="ant.jar" depends="compiler.classes">
<mkdir dir="${build.lib}" />
<jar destfile="${build.lib}/ceylon-ant.jar">
<fileset dir="${build.classes}">
<include name="com/redhat/ceylon/ant/**" />
<include name="com/redhat/ceylon/common/**" />
<include name="com/redhat/ceylon/launcher/**" />
</fileset>
</jar>
</target>
<!-- Rule to build bootstrap jar -->
<target name="bootstrap.jar" depends="compiler.classes">
<mkdir dir="${build.lib}" />
<jar destfile="${build.lib}/ceylon-bootstrap.jar" filesetmanifest="merge">
<fileset dir="${build.classes}">
<include name="com/redhat/ceylon/launcher/Bootstrap.class" />
<include name="com/redhat/ceylon/launcher/CeylonClassLoader.class" />
<include name="com/redhat/ceylon/launcher/LauncherUtil.class" />
<include name="META-INF/MANIFEST.MF" />
</fileset>
</jar>
</target>
<!-- Rule to build bootstrap module -->
<target name="bootstrap.module" depends="compiler.classes">
<mkdir dir="${build.dist.repo}/${ceylon.bootstrap.dir}" />
<jar destfile="${build.dist.repo}/${ceylon.bootstrap.jar}">
<fileset dir="${build.classes}">
<include name="com/redhat/ceylon/launcher/**" />
<exclude name="com/redhat/ceylon/launcher/Start.class" />
</fileset>
<manifest>
<attribute name="Bundle-SymbolicName" value="ceylon.bootstrap"/>
<attribute name="Bundle-Version" value="${module.ceylon.bootstrap.version}.${qualifier}"/>
</manifest>
</jar>
<antcall target="sha1sum">
<param name="file" value="${build.dist.repo}/${ceylon.bootstrap.jar}" />
</antcall>
</target>
<!-- Rule to build compiler jar -->
<target name="build" depends="compiler.jar,ant.jar,bootstrap.jar,bootstrap.module">
<mkdir dir="${build.dist}" />
<mkdir dir="${build.bin}" />
<mkdir dir="${build.ceylon.cars}" />
<copy todir="${build.bin}">
<fileset dir="${basedir}/bin">
</fileset>
<filterset>
<filter token="ceylon-version" value="${ceylon.base.version}"/>
</filterset>
</copy>
<chmod perm="0755">
<fileset dir="${build.bin}">
<include name="ceylon" />
</fileset>
</chmod>
</target>
<target name="-test.cond">
<condition property="dont.test.ast">
<contains string="${dont.test}" substring="ast" />
</condition>
<condition property="dont.test.runtime">
<contains string="${dont.test}" substring="runtime" />
</condition>
<condition property="dont.test.ceylond">
<contains string="${dont.test}" substring="ceylond" />
</condition>
</target>
<!-- Runs the JUnit tests -->
<target name="-test.prepare" depends="publish,test.classes,-test.cond">
<mkdir dir="${test.reports}" />
</target>
<target name="test" depends="test.all" description="Runs the tests and generates a test report.">
<junitreport todir="${test.reports}">
<fileset dir="${test.reports}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${test.reports}" />
</junitreport>
</target>
<!-- Runs the JUnit tests -->
<target name="test.all" depends="-test.prepare">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath" />
<formatter type="xml" />
<batchtest fork="yes" todir="${test.reports}">
<fileset dir="${test.src}">
<include name="com/redhat/ceylon/compiler/java/test/ConcurrentTests.java" />
</fileset>
</batchtest>
<!--
<test fork="yes" todir="${test.reports}"
name="com.redhat.ceylon.compiler.java.test.model.ModelLoaderTests"
methods="loadJavaKeywords">
</test>
-->
<assertions>
<enable/>
</assertions>
</junit>
</target>
<target name="ide-quick-internal" depends="test.classes">
<property name="compilerArchivePath" value="${ceylon.compiler.lib}"/>
<basename file="${compilerArchivePath}" property="compilerArchiveFileName"/>
<property name="compiler-proxy-project" value="../ceylon-ide-eclipse/required-bundle-proxies/${compilerArchiveFileName}"/>
<mkdir dir="${compiler-proxy-project}"/>
<delete failonerror="false" dir="${compiler-proxy-project}/META-INF"/>
<copy toDir="${compiler-proxy-project}" overwrite="true">
<zipfileset src="${compilerArchivePath}" includes="META-INF/**"/>
<fileset file="${compilerArchivePath}"/>
</copy>
<manifest file="${compiler-proxy-project}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Classpath" value="${compilerArchiveFileName}"/>
</manifest>
<property name="bootstrapArchivePath" value="${ceylon.bootstrap.lib}"/>
<basename file="${bootstrapArchivePath}" property="bootstrapArchiveFileName"/>
<property name="bootstrap-proxy-project" value="../ceylon-ide-eclipse/required-bundle-proxies/${bootstrapArchiveFileName}"/>
<mkdir dir="${bootstrap-proxy-project}"/>
<delete failonerror="false" dir="${bootstrap-proxy-project}/META-INF"/>
<copy toDir="${bootstrap-proxy-project}" overwrite="true">
<zipfileset src="${bootstrapArchivePath}" includes="META-INF/**"/>
<fileset file="${bootstrapArchivePath}"/>
</copy>
<manifest file="${bootstrap-proxy-project}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Classpath" value="${bootstrapArchiveFileName}"/>
</manifest>
<jar destfile="../ceylon-ide-eclipse/tests/com.redhat.ceylon.eclipse.ui.test/lib/compiler-tests-${module.com.redhat.ceylon.compiler.version}.jar">
<fileset dir="${build.classes}">
<include name="com/redhat/ceylon/compiler/java/test/**" />
</fileset>
</jar>
<delete dir="../ceylon-ide-eclipse/tests/com.redhat.ceylon.eclipse.ui.test/resources/model-loader-tests/declarations/src/declarations" excludes="module.ceylon,package.ceylon,run.ceylon" />
<copy todir="../ceylon-ide-eclipse/tests/com.redhat.ceylon.eclipse.ui.test/resources/model-loader-tests/declarations/src/declarations">
<fileset dir="${test.src}/com/redhat/ceylon/compiler/java/test/model" includes="*.ceylon" excludes="*test.ceylon,bogus*.ceylon,module.ceylon,package.ceylon" />
</copy>
<copy todir="../ceylon-ide-eclipse/tests/com.redhat.ceylon.eclipse.ui.test/resources/model-loader-tests/declarations/src/declarations">
<fileset dir="${test.src}/com/redhat/ceylon/compiler/java/test/model" includes="*.java" excludes="?ogus*.java,*Tests.java,*Test.java" />
<filterset beginToken=" " endToken=";"><filter token="com.redhat.ceylon.compiler.java.test.model" value=" declarations;" /></filterset>
</copy>
</target>
</project>