forked from richdougherty/scala-continuations
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
347 lines (292 loc) · 11.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
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id -->
<!-- TODO: check handling of jsr166y.jar -->
<project name="continuations" default="pack">
<!-- Edit the file plugin.properties to set
- scala.home
- plugin.name
- plugin.commandname
- plugin.description
- plugin.mainclass
- version numbers
-->
<property environment="env"/>
<property file="${basedir}/plugin.properties"/>
<property name="version" value="${version.major}.${version.minor}"/>
<path id="scala.classpath">
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
</path>
<taskdef resource="scala/tools/ant/antlib.xml" classpathref="scala.classpath"/>
<taskdef resource="scala/tools/partest/antlib.xml">
<classpath>
<path refid="scala.classpath"/>
<pathelement location="${scala.home}/lib/scala-partest.jar"/>
</classpath>
</taskdef>
<!-- =================================================================
End-user targets
================================================================== -->
<target name="build" depends="build.done"/>
<target name="test" depends="test.done"/>
<target name="doc" depends="doc.done"/>
<target name="pack" depends="pack.done"/>
<target name="dist" depends="dist.done"/>
<target name="clean" depends="clean.all"/>
<!-- =================================================================
Build targets
================================================================== -->
<target name="build.plugin">
<mkdir dir="build/build.plugin"/>
<scalac srcdir="src/plugin"
destdir="build/build.plugin"
includes="**/*.scala"
addparams="-optimise"
classpathref="scala.classpath">
</scalac>
</target>
<!--
home="${scala.home}"
<target name="build.test" depends="pack.plugin">
<mkdir dir="build/build.test"/>
<scalac srcdir="test"
destdir="build/build.test"
includes="**/*.scala"
addparams="-Xplugin:build/pack/${plugin.name}-plugin.jar">
<classpath>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="lib/scalatest.jar"/>
<pathelement location="build/build.plugin"/>
</classpath>
</scalac>
</target>
-->
<target name="build.library" depends="pack.plugin">
<mkdir dir="build/build.library"/>
<scalac srcdir="src/library"
destdir="build/build.library"
includes="**/*.scala"
unchecked="yes"
deprecation="yes"
addparams="-Xplugin:build/pack/${plugin.name}-plugin.jar -optimise">
<classpath>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="lib/jsr166y.jar"/>
<pathelement location="build/build.plugin"/>
</classpath>
</scalac>
</target>
<target name="build.examples" depends="pack.plugin,build.library">
<mkdir dir="build/build.examples"/>
<scalac srcdir="doc"
destdir="build/build.examples"
includes="examples/**/*.scala"
addparams="-Xplugin:build/pack/${plugin.name}-plugin.jar -optimise">
<classpath>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
<pathelement location="lib/jsr166y.jar"/>
<pathelement location="build/build.plugin"/>
<pathelement location="build/build.library"/>
</classpath>
</scalac>
</target>
<target name="build.all" depends="build.plugin, build.library, build.examples"/>
<target name="build.done" depends="build.all"/>
<!-- =================================================================
Test targets
================================================================== -->
<target name="test.partest" depends="pack.plugin, build.all">
<partest showlog="yes" erroronfailed="yes"
timeout="60000" javacmd="${java.home}/bin/java"
scalacopts="-Xplugin:build/pack/${plugin.name}-plugin.jar">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar" />
<pathelement location="${scala.home}/lib/scala-library.jar" />
<pathelement location="lib/jsr166y.jar"/>
<pathelement location="build/build.plugin"/>
<pathelement location="build/build.library"/>
<pathelement location="build/build.examples"/>
<fileset dir="test/files/lib" includes="*.jar"/>
</classpath>
<postests dir="test/files/pos" includes="*.scala"/>
<negtests dir="test/files/neg" includes="*.scala"/>
<runtests dir="test/files">
<include name="run/**/*.scala"/>
</runtests>
</partest>
</target>
<!-- TODO: add a test target that will run the whole scala partest
suite, compiled with the plugin enabled. We wouldn't want errors
on that ... -->
<target name="test.all" depends="test.partest"/>
<target name="test.done" depends="test.partest"/>
<!--
<target name="test.all" depends="build.done">
<java classname="org.scalatest.tools.Runner" fork="true">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar" />
<pathelement location="${scala.home}/lib/scala-library.jar" />
<pathelement location="lib/scalatest.jar" />
<pathelement location="build/build.main" />
<pathelement location="build/build.test" />
</classpath>
<arg value="-p" />
<arg value="build/build.test" />
<arg value="-o" />
</java>
</target>
<target name="guitest.all" depends="build.done">
<java classname="org.scalatest.tools.Runner" fork="true">
<classpath>
<pathelement location="${scala.home}/lib/scala-compiler.jar" />
<pathelement location="${scala.home}/lib/scala-library.jar" />
<pathelement location="lib/scalatest.jar" />
<pathelement location="build/build.main" />
<pathelement location="build/build.test" />
</classpath>
<arg value="-p" />
<arg value="build/build.test" />
<arg value="-g" />
</java>
</target>
-->
<!-- =================================================================
Doc targets
================================================================== -->
<target name="doc.library">
<mkdir dir="doc/api"/>
<scaladoc srcdir="src/library"
destdir="doc/api"
includes="**/*.scala">
<classpath>
<pathelement location="${scala.home}/lib/scala-library.jar"/>
<pathelement location="${scala.home}/lib/scala-compiler.jar"/>
</classpath>
</scaladoc>
</target>
<target name="doc.done" depends="doc.library"/>
<!-- =================================================================
Pack targets
================================================================== -->
<target name="pack.plugin" depends="build.plugin">
<mkdir dir="build/pack"/>
<jar destfile="build/pack/${plugin.name}-plugin.jar">
<fileset dir="build/build.plugin"/>
<fileset file="plugin.properties"/>
<fileset file="misc/scalac-plugin.xml"/>
</jar>
</target>
<target name="pack.library" depends="build.library">
<mkdir dir="build/pack"/>
<jar destfile="build/pack/${plugin.name}-library.jar">
<fileset file="lib/jsr166y.jar"/>
<fileset dir="build/build.library"/>
<fileset file="plugin.properties"/>
</jar>
</target>
<target name="pack.src">
<jar destfile="build/pack/${plugin.name}-src.jar"
basedir="src"
includes="**/*.scala"/>
</target>
<target name="pack.all" depends="pack.plugin,pack.library,pack.src"/>
<target name="pack.done" depends="pack.all"/>
<!-- =================================================================
Dist targets
================================================================== -->
<!-- TODO: standalone tool is not applicable for our case, we only
integrate into the mainline compiler -->
<target name="dist.bin" depends="build.done,test.done,pack.done,doc.done">
<mkdir dir="build/toolscript"/>
<scalascript
file="build/toolscript/${plugin.commandname}"
class="${plugin.mainclass}"/>
<chmod dir="build/toolscript" perm="a+rx" excludes="*.bat"/>
</target>
<target name="dist.archive" depends="dist.bin">
<mkdir dir="build/dist"/>
<tar destfile="build/dist/${plugin.name}-${version}.tgz"
compression="gzip">
<tarfileset prefix="lib" dir="build/pack"
includes="${plugin.name}-library.jar"/>
<tarfileset prefix="src" dir="build/pack"
includes="${plugin.name}-src.jar"/>
<tarfileset prefix="doc/${plugin.name}" dir="doc"
includes="README"/>
<tarfileset prefix="doc/${plugin.name}" dir="doc"
includes="examples/**"/>
<tarfileset prefix="doc/${plugin.name}" dir="doc"
includes="api/**"/>
<tarfileset prefix="bin" dir="build/toolscript"
includes="${plugin.commandname}" mode="755"/>
<tarfileset prefix="bin" dir="build/toolscript"
includes="${plugin.commandname}.bat"/>
<tarfileset prefix="misc/scala-devel/plugins" dir="build/pack"
includes="${plugin.name}-plugin.jar"/>
</tar>
</target>
<target name="dist.sbaz" depends="dist.archive">
<sbaz file="build/dist/${plugin.name}-${version}.sbp"
adfile="build/dist/${plugin.name}-${version}.advert"
name="${plugin.name}"
version="${version}"
depends="scala-devel"
desc="${plugin.description}"
link="${plugin.sbazbaseurl}/${plugin.name}-${version}.sbp">
<libset dir="build/pack" includes="${plugin.name}-library.jar"/>
<srcset dir="build/pack" includes="${plugin.name}-src.jar"/>
<docset dir="doc" includes="README"/>
<docset dir="doc" includes="examples/**"/>
<docset dir="doc" includes="api/**"/>
<binset dir="build/toolscript"/>
<looseset destination="misc/scala-devel/plugins">
<fileset file="build/pack/${plugin.name}-plugin.jar"/>
</looseset>
</sbaz>
</target>
<target name="dist.done" depends="dist.sbaz"/>
<!-- =================================================================
Local installation
================================================================== -->
<target name="install" depends="dist.done">
<exec executable="sbaz">
<arg line="-v install -f build/dist/${plugin.name}-${version}.sbp"/>
</exec>
</target>
<target name="uninstall">
<exec executable="sbaz">
<arg line="remove ${plugin.name}"/>
</exec>
</target>
<!-- =================================================================
Clean targets
================================================================== -->
<target name="clean.build">
<delete dir="build/build.plugin" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
<delete dir="build/build.library" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
<delete dir="build/build.test" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
<delete dir="build/build.examples" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
</target>
<target name="clean.pack" depends="clean.build">
<delete dir="build/pack" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
</target>
<target name="clean.dist" depends="clean.pack">
<delete dir="build/dist" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
<delete dir="build/toolscript" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
</target>
<target name="clean.doc">
<delete dir="doc/api" includeemptydirs="yes"
quiet="yes" failonerror="no"/>
</target>
<target name="clean.all" depends="clean.dist,clean.doc"/>
</project>