-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml~
480 lines (432 loc) · 19.8 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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
<project name="Ceylon SDK" basedir="." default="test">
<property file="build.properties" />
<property name="ceylon.verbosity" value="false"/>
<property name="ceylon.executable" value="${basedir}/../ceylon-dist/dist/bin/ceylon"/>
<property name="out.repo" location="${basedir}/modules"/>
<property name="deps.repo" location="${basedir}/test-deps"/>
<property name="test.repo" location="${basedir}/modules"/>
<property name="osgi" location="${basedir}/osgi" />
<property name="osgi.p2" location="${osgi}/p2" />
<property name="osgi.dist" location="${osgi}/dist" />
<property name="osgi.build" location="${osgi}/build" />
<property name="osgi.dist.plugins" location="${osgi.dist}/plugins" />
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/../ceylon-dist/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<taskdef resource="taskdef.properties">
<classpath>
<pathelement path="${basedir}/../ceylon-dist/osgi/lib/org.osgi.impl.bundle.repoindex.ant-2.1.2.jar" />
</classpath>
</taskdef>
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="${basedir}/../ceylon-dist/lib/biz.aQute.bnd-2.3.0.jar"/>
<!-- Local repository -->
<property name="ceylon.repo.dir" location="${user.home}/.ceylon/repo" />
<path id="ant-tasks">
<pathelement location="${basedir}/${dist.repo.dir}/com/redhat/ceylon/common/${module.com.redhat.ceylon.compiler.version}/com.redhat.ceylon.common-${module.com.redhat.ceylon.compiler.version}.jar"/>
<pathelement location="${ceylon.ant.lib}"/>
</path>
<typedef resource="com/redhat/ceylon/ant/antlib.xml" classpathref="ant-tasks"/>
<reposet id="reposet.compile.test">
<repo url="${out.repo}"/>
<repo url="${deps.repo}"/><!-- Needed for h2.jar dep of test.ceylon.dbc -->
</reposet>
<reposet id="reposet.run.test">
<reposet refid="reposet.compile.test"/>
<repo url="${test.repo}"/>
</reposet>
<moduleset id="modules.sdk.jvm">
<module name="ceylon.collection"/>
<module name="ceylon.dbc"/>
<module name="ceylon.file"/>
<module name="ceylon.html"/>
<module name="ceylon.interop.java"/>
<module name="ceylon.io"/>
<module name="ceylon.json"/>
<module name="ceylon.logging"/>
<module name="ceylon.math"/>
<module name="ceylon.net"/>
<module name="ceylon.process"/>
<module name="ceylon.promise"/>
<module name="ceylon.test"/>
<module name="ceylon.time"/>
<module name="ceylon.unicode"/>
<module name="ceylon.locale"/>
<module name="com.redhat.ceylon.war"/>
<module name="com.redhat.ceylon.test"/>
<module name="com.redhat.ceylon.testjvm"/>
</moduleset>
<moduleset id="modules.sdk.js">
<module name="ceylon.collection"/>
<module name="ceylon.html"/>
<module name="ceylon.json"/>
<module name="ceylon.test"/>
<module name="ceylon.time"/>
<module name="ceylon.logging"/>
<module name="ceylon.locale"/>
<module name="com.redhat.ceylon.test"/>
<module name="com.redhat.ceylon.testjs"/>
</moduleset>
<moduleset id="modules.sdk.promise.js">
<module name="ceylon.promise"/>
</moduleset>
<moduleset id="modules.test.jvm">
<module name="test.ceylon.test.suite"/>
<module name="test.ceylon.math"/>
<module name="test.ceylon.collection"/>
<module name="test.ceylon.file"/>
<module name="test.ceylon.io"/>
<module name="test.ceylon.json"/>
<module name="test.ceylon.net"/>
<module name="test.ceylon.process"/>
<module name="test.ceylon.promise"/>
<module name="test.ceylon.time"/>
<module name="test.ceylon.dbc"/>
<module name="test.ceylon.interop.java"/>
<module name="test.ceylon.unicode"/>
<module name="test.ceylon.html"/>
<module name="test.ceylon.locale"/>
</moduleset>
<moduleset id="modules.test.js">
<module name="test.ceylon.test.suite"/>
<module name="test.ceylon.collection"/>
<module name="test.ceylon.html"/>
<module name="test.ceylon.json"/>
<module name="test.ceylon.promise"/>
<module name="test.ceylon.time"/>
<module name="test.ceylon.locale"/>
</moduleset>
<target name="clean"
description="Deletes the test-modules and modules directories">
<delete dir="${out.repo}"/>
<delete dir="${test.repo}"/>
<delete dir="${osgi.dist}"/>
<delete dir="${osgi.build}"/>
</target>
<target name="compile-jvm">
<ceylon-compile executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
pack200="true"
out="${out.repo}">
<moduleset refid="modules.sdk.jvm"/>
</ceylon-compile>
</target>
<target name="compile-js">
<delete dir="build/source-promise-js"/>
<mkdir dir="build/source-promise-js"/>
<copy todir="build/source-promise-js/ceylon/promise">
<fileset dir="source/ceylon/promise" includes="*.ceylon" excludes="module.ceylon"/>
<fileset dir="source-promise-js/ceylon/promise"/>
</copy>
<ceylon-compile-js executable="${ceylon.executable}"
src="build/source-promise-js"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}">
<moduleset refid="modules.sdk.promise.js"/>
</ceylon-compile-js>
<ceylon-compile-js executable="${ceylon.executable}"
verbose="${ceylon.verbosity}"
encoding="UTF-8"
out="${out.repo}">
<moduleset refid="modules.sdk.js"/>
</ceylon-compile-js>
</target>
<target name="compile" depends="compile-jvm,compile-js"
description="Compiles the SDK modules to the 'modules' repository" />
<target name="compile-test-jvm" depends="compile-jvm">
<ceylon-compile executable="${ceylon.executable}"
src="test-source"
out="${test.repo}"
verbose="${ceylon.verbosity}"
encoding="UTF-8">
<reposet refid="reposet.compile.test"/>
<module name="test.ceylon.test.stubs"/>
<moduleset refid="modules.test.jvm"/>
</ceylon-compile>
</target>
<target name="compile-test-js" depends="compile-js">
<ceylon-compile-js executable="${ceylon.executable}"
src="test-source"
out="${test.repo}"
verbose="${ceylon.verbosity}"
encoding="UTF-8">
<reposet refid="reposet.compile.test"/>
<module name="test.ceylon.test.stubs"/>
<moduleset refid="modules.test.js"/>
</ceylon-compile-js>
</target>
<target name="compile-test" depends="compile,compile-test-jvm,compile-test-js"
description="Compiles the test modules to the 'test-modules' repository" />
<target name="test-jvm" depends="compile-test-jvm"
description="Runs the compiled test modules from the 'test-modules' repository">
<ceylon-test report="true">
<reposet refid="reposet.run.test"/>
<moduleset refid="modules.test.jvm"/>
</ceylon-test>
</target>
<target name="test-js" depends="compile-test-js">
<ceylon-test-js report="true">
<reposet refid="reposet.run.test"/>
<moduleset refid="modules.test.js"/>
</ceylon-test-js>
</target>
<target name="test" depends="compile-test,test-jvm,test-js"
description="Runs the compiled test modules from the 'test-modules' repository" />
<target name="doc"
description="Documents the SDK modules to the 'modules' repository">
<ceylon-doc executable="${ceylon.executable}"
includesourcecode="true"
nomtimecheck="true"
encoding="UTF-8">
<moduleset refid="modules.sdk.jvm"/>
<linkset>
<link pattern="ceylon" url="http://modules.ceylon-lang.org/test/"/>
</linkset>
</ceylon-doc>
</target>
<target name="publish" depends="compile"
description="Copies the SDK modules to the user's repository">
<copy todir="${ceylon.repo.dir}" overwrite="true">
<fileset dir="${out.repo}">
<include name="ceylon/test/**"/>
<include name="com/redhat/ceylon/test/**"/>
<include name="com/redhat/ceylon/testjs/**"/>
<include name="com/redhat/ceylon/testjvm/**"/>
<include name="ceylon/math/**"/>
<include name="ceylon/collection/**"/>
<include name="ceylon/file/**"/>
<include name="ceylon/io/**"/>
<include name="ceylon/json/**"/>
<include name="ceylon/logging/**"/>
<include name="ceylon/net/**"/>
<include name="ceylon/process/**"/>
<include name="ceylon/promise/**"/>
<include name="ceylon/time/**"/>
<include name="ceylon/dbc/**"/>
<include name="ceylon/unicode/**"/>
<include name="ceylon/locale/**"/>
<include name="ceylon/interop/java/**"/>
<include name="ceylon/html/**"/>
<include name="com/redhat/ceylon/war/**"/>
</fileset>
</copy>
</target>
<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.sdk.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.sdk.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.sdk.jvm"/>
</ceylon-doc>
</target>
<target name="addRequiredOSGIHeaders">
<tempfile property="bundleDefinitionFile"/>
<echo file="${bundleDefinitionFile}">Bundle-SymbolicName: ${CeylonName}${line.separator}</echo>
<echo file="${bundleDefinitionFile}" append="true">Bundle-Version: ${CeylonVersion}${line.separator}</echo>
<echo file="${bundleDefinitionFile}" append="true">Export-Package: *${line.separator}</echo>
<echo file="${bundleDefinitionFile}" append="true">Import-Package: org.apache.log4j.*;resolution:=optional, javax.enterprise.*;resolution:=optional, javax.interceptor.*;resolution:=optional, javax.resource.spi.*;resolution:=optional, org.apache.webdav.*;resolution:=optional, javax.inject.*;resolution:=optional, org.hornetq.core.journal.*;resolution:=optional, sun.misc.*;resolution:=optional, org.apache.commons.httpclient;resolution:=optional, *${line.separator}</echo>
<bndwrap exceptions="true" force="true" jars="${currentFile}" output="${currentFile}.bnd.jar" definitions="${bundleDefinitionFile}">
</bndwrap>
<delete file="${bundleDefinitionFile}"/>
<echo message="Adding OSGI headers to ${currentFile}"/>
<copy file="${currentFile}" tofile="${currentFile}.original"/>
<jar destfile="${currentFile}.result" filesetmanifest="merge">
<zipfileset src="${currentFile}.original" includes="**" excludes="META-INF/MANIFEST.MF"/>
<zipfileset src="${currentFile}.bnd.jar" includes="META-INF/MANIFEST.MF"/>
</jar>
<copy file="${currentFile}.result" tofile="${currentFile}" overwrite="true" force="true"/>
<delete file="${currentFile}.original" failonerror="false" deleteonexit="true"/>
<delete file="${currentFile}.bnd.jar" failonerror="false" deleteonexit="true"/>
<delete file="${currentFile}.result" failonerror="false" deleteonexit="true"/>
</target>
<target name="copyModuleArchiveForOSGI">
<loadproperties>
<zipentry zipfile="${currentFile}" name="META-INF/MANIFEST.MF"/>
<filterchain>
<linecontainsregexp>
<regexp pattern="^(Bundle-SymbolicName|Bundle-Version)"/>
</linecontainsregexp>
<replaceregex pattern="\s+$" replace=""/>
<replaceregex pattern="^\s+" replace=""/>
</filterchain>
</loadproperties>
<basename property="module.jar.name" file="${currentFile}"/>
<propertyregex property="CeylonName"
input="${module.jar.name}"
regexp="(.+)-([^\-]+)\.(j|c)ar"
replace="\1">
</propertyregex>
<propertyregex property="CeylonVersion"
input="${module.jar.name}"
regexp="(.+)-([^\-]+)\.(j|c)ar"
replace="\2">
</propertyregex>
<if>
<or>
<not>
<isset property="Bundle-SymbolicName"/>
</not>
<not>
<equals arg1="${Bundle-SymbolicName}" arg2="${CeylonName}"/>
</not>
</or>
<then>
<antcall target="addRequiredOSGIHeaders" inheritall="true"/>
<property name="CheckedBundleSymbolicName" value="${CeylonName}"/>
<property name="CheckedBundleVersion" value="${CeylonVersion}"/>
</then>
<else>
<property name="CheckedBundleSymbolicName" value="${Bundle-SymbolicName}"/>
<property name="CheckedBundleVersion" value="${Bundle-Version}"/>
</else>
</if>
<copy file="${currentFile}"
tofile="${osgi.dist.plugins}/${CheckedBundleSymbolicName}_${CheckedBundleVersion}.jar"
overwrite="true"/>
</target>
<target name="retrieveDependencies">
<ceylon-copy executable="${ceylon.executable}"
offline="true"
verbose="${ceylon.verbosity}"
nodefaultrepositories="true"
withdependencies="true"
out="${osgi.dist}/tempRepo">
<rep url="./modules"/>
<sourcemodules/>
</ceylon-copy>
</target>
<target name="osgi-quick" depends="retrieveDependencies">
<mkdir dir="${osgi.dist.plugins}" />
<foreach target="copyModuleArchiveForOSGI" param="currentFile">
<path>
<fileset dir="${osgi.dist}/tempRepo" includes="**/*.?ar"/>
</path>
</foreach>
<delete dir="${osgi.dist}/tempRepo" failonerror="false" deleteonexit="true"/>
<makeurl property="rootUrl" file="${osgi.dist}"/>
<repoindex name="Ceylon Distribution Bundles"
out="${osgi.dist}/repository.xml"
compressed="false"
rooturl="${rootUrl}">
<fileset dir="${osgi.dist.plugins}" includes="*.jar"/>
</repoindex>
</target>
<!-- Rule to setup a plugins directory with required bundles -->
<target name="osgi-p2-quick" depends="osgi-quick">
<makeurl property="destinationRepository" file="${osgi.dist}"/>
<makeurl property="categoryDefinition" file="${osgi.p2}/category.xml"/>
<mkdir dir="${osgi.build}"/>
<touch file="${osgi.build}/bundles.info"/>
<makeurl property="bundlesInfoUrl" file="${osgi.build}/bundles.info"/>
<loadfile srcfile="${basedir}/../ceylon-dist/osgi/p2/bundlesToStart" property="bundlesToStart">
<filterchain>
<striplinebreaks/>
</filterchain>
</loadfile>
<ceylon-p2 executable="${ceylon.executable}"
out="${osgi.dist}"
repositoryName="Ceylon SDK Bundles"
categoryPrefix="ceylon.sdk"
categories="${osgi.p2}/category.xml">
<moduleset refid="modules.sdk.jvm"/>
<rep url="modules"/>
</ceylon-p2>
<!--
<exec dir="${basedir}" executable="eclipse" failonerror="true">
<arg value="-noSplash"/>
<arg value="-clean"/>
<arg value="-console"/>
<arg value="-consolelog"/>
<arg value="- -launcher.suppressErrors"/>
<arg value="-application"/>
<arg value="org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher"/>
<arg value="-metadataRepositoryName"/>
<arg value="Ceylon SDK Bundles"/>
<arg value="-metadataRepository"/>
<arg value="${destinationRepository}"/>
<arg value="-artifactRepositoryName"/>
<arg value="Ceylon SDK Bundles"/>
<arg value="-artifactRepository"/>
<arg value="${destinationRepository}"/>
<arg value="-source"/>
<arg file="${osgi.dist}"/>
<arg value="-publishArtifacts"/>
<arg value="-append"/>
<arg value="-vmargs"/>
<arg value="-Dorg.eclipse.equinox.simpleconfigurator.configUrl=${bundlesInfoUrl}"/>
<arg value="-Dosgi.bundles=${bundlesToStart}"/>
</exec>
<exec dir="${basedir}" executable="eclipse">
<arg value="-noSplash"/>
<arg value="-clean"/>
<arg value="-console"/>
<arg value="-consolelog"/>
<arg value="- -launcher.suppressErrors"/>
<arg value="-application"/>
<arg value="org.eclipse.equinox.p2.publisher.CategoryPublisher"/>
<arg value="-metadataRepository"/>
<arg value="${destinationRepository}"/>
<arg value="-categoryDefinition"/>
<arg value="${categoryDefinition}"/>
<arg value="-categoryQualifier"/>
<arg value="ceylon.sdk"/>
<arg value="-vmargs"/>
<arg value="-Dorg.eclipse.equinox.simpleconfigurator.configUrl=${bundlesInfoUrl}"/>
<arg value="-Dosgi.bundles=${bundlesToStart}"/>
</exec>
-->
</target>
<target name="osgi" depends="compile-jvm,osgi-quick"/>
<target name="osgi-p2" depends="compile-jvm,osgi-p2-quick"/>
<target name="ide" depends="osgi-p2"/>
<target name="ide-quick" depends="osgi-p2-quick">
<foreach target="updateIdeProxyProject" param="archivePath">
<path>
<fileset dir="${out.repo}" includes="**/*.car"/>
</path>
</foreach>
</target>
<target name="updateIdeProxyProject">
<basename file="${archivePath}" property="archiveFileName"/>
<property name="proxy-project" value="../ceylon-ide-eclipse/required-bundle-proxies/${archiveFileName}"/>
<if>
<available file="${proxy-project}"/>
<then>
<delete failonerror="false" dir="${proxy-project}/META-INF"/>
<copy toDir="${proxy-project}" overwrite="true">
<zipfileset src="${archivePath}" includes="META-INF/**"/>
<fileset file="${archivePath}"/>
</copy>
<manifest file="${proxy-project}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Classpath" value="${archiveFileName}"/>
</manifest>
</then>
</if>
</target>
</project>