source: trunk/abcl/build.xml @ 11605

Last change on this file since 11605 was 11605, checked in by Mark Evenson, 13 years ago

ABCL included Lisp tests now working from ASDF and Ant.

The following targets now work from Ant:

'test.ansi.compiled'
'test.ansi.intepreted'
'test.abcl.lisp'

invoking the GCL ANSI tests compiled, GCL ANSI tests interpreted, and the internal ABCL tests.

Packaged the internal ANSI Lisp test use of REGRESSION-TEST as
ABCL-REGRESSION-TEST (nickname abcl-rt) to avoid conflicting with
other test suites that use this.

  • Property svn:eol-style set to LF
File size: 18.9 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="antlib:org.apache.tools.ant"
3   name="abcl-master" default="help" basedir=".">
4    <description>Compiling, testing, and packaging Armed Bear Common Lisp</description>
5
6    <target name="abcl" depends="abcl.wrapper"/>
7
8    <property file="build.properties"/>
9
10    <property name="build.dir" 
11        value="${basedir}/build"/>
12    <property name="build.classes.dir" 
13        value="${build.dir}/classes"/>
14    <property name="src.dir" 
15        value="${basedir}/src"/>
16    <property name="dist.dir" 
17        value="${basedir}/dist"/>
18    <property name="abcl.jar.path"
19        value="${dist.dir}/abcl.jar"/>
20    <property name="abcl.ext.dir"
21        value="${basedir}/ext"/>
22 
23    <target name="help">
24      <echo>Main Ant targets:
25 abcl.compile 
26   -- compile ABCL to ${build.classes.dir}.
27 abcl.jar     
28   -- create packaged ${abcl.jar.path}.
29 abcl.wrapper 
30   -- create executable wrapper for ABCL.
31 abcl.source.zip abcl.source.tar
32   -- create source distributions in ${dist.dir}.
33 acbl.test.java
34   -- Run junit tests under ${abcl.test.src.dir}.
35 abcl.clean
36   -- remove ABCL intermediate files</echo>
37      <echo>Corresponding targets for J have been removed.</echo>
38    </target>
39
40    <!-- Checks if JSR-223 support is available - thanks to Mark Evenson -->
41    <available property="abcl.jsr-223.p"
42         classname="javax.script.ScriptEngine"/>
43
44    <patternset id="abcl.source.java">
45      <include name="org/armedbear/lisp/*.java"/>
46      <include name="org/armedbear/lisp/util/*.java"/>
47      <include name="org/armedbear/lisp/scripting/*.java" if="abcl.jsr-223.p"/>
48      <include name="org/armedbear/lisp/scripting/util/*.java" if="abcl.jsr-223.p"/>
49      <include name="org/armedbear/Main.java"/>
50    </patternset>
51
52    <patternset id="abcl.source.lisp">
53      <include name="org/armedbear/lisp/*.lisp"/>
54      <include name="org/armedbear/lisp/tests/*.lisp"/>
55      <exclude name="org/armedbear/lisp/j.lisp"/>
56      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
57    </patternset>
58
59    <patternset id="abcl.scripting.source.java">
60      <include name="org/armedbear/lisp/scripting/*.java"/>
61      <include name="org/armedbear/lisp/scripting/util/*.java"/>
62    </patternset>
63
64    <patternset id="abcl.scripting.source.lisp">
65      <include name="org/armedbear/lisp/scripting/lisp/*.lisp"/>
66    </patternset>
67
68    <!-- Lisp files required at runtime -->
69    <patternset id="abcl.source.lisp.dist">
70      <include name="org/armedbear/lisp/boot.lisp"/>
71    <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
72    </patternset>
73
74    <patternset id="abcl.objects">
75      <include name="org/armedbear/lisp/*.class"/>
76      <include name="org/armedbear/lisp/util/*.class"/>
77      <include name="org/armedbear/lisp/*.cls"/> 
78      <include name="org/armedbear/lisp/*.abcl"/>
79      <include name="org/armedbear/lisp/scripting/*.class" if="abcl.jsr-223.p"/>
80      <include name="org/armedbear/lisp/scripting/util/*.class" if="abcl.jsr-223.p"/>
81      <patternset refid="abcl.source.lisp.dist"/>
82    </patternset>
83   
84    <path id="abcl.classpath.dist">
85      <pathelement location="${abcl.jar.path}"/>
86    </path>
87   
88    <path id="abcl.classpath.build">
89      <pathelement location="${build.classes.dir}"/>
90    </path>
91
92    <target name="abcl.compile" depends="abcl.compile.lisp">
93      <echo>Compiled ABCL with Java version: ${java.version}</echo>
94    </target>
95
96    <target name="abcl.init">
97      <tstamp>
98  <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
99      </tstamp>
100
101      <tstamp>
102  <format property="build.stamp" pattern="yyyymmdd-HHmm"/>
103      </tstamp>
104
105      <property name="abcl.test.log.file"
106    value="abcl-test-${build.stamp}.log"/>
107
108      <!--- antversion fails in ant 1.7.1 <antversion property="ant.version"
109                                                atleast="1.7"/> -->
110      <property name="java.path"
111    value="${java.home}/bin/java"/>
112
113      <!-- Deprecated. Two main types of build environents: 'unix' or 'windows'. -->
114      <condition property="unix"> 
115  <or>
116    <os family="unix"/>
117    <os family="mac"/>
118  </or>
119      </condition>
120      <condition property="windows"> 
121  <os family="windows"/>
122      </condition>
123
124      <!-- Deprecated. -->
125      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
126     property="abcl.lisp.p"/>
127
128      <echo>java.version: ${java.version}</echo>
129      <condition property="abcl.java.version.p">
130  <or>
131    <matches string="${java.version}" pattern="1\.5"/>
132    <matches string="${java.version}" pattern="1\.6\.0_1[0-9]"/>
133  </or> 
134      </condition>
135
136      <!-- Set from commandline via -D or in 'build.properties' -->
137      <property name="build.version" value="abcl.svn"/>
138      <echo>Implementation-Source: ${version.src}</echo>
139
140    </target>
141   
142    <target name="abcl.java.warning" 
143      depends="abcl.init"
144      unless="abcl.java.version.p">
145      <echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
146    </target>
147 
148    <target name="abcl.jsr-223.notice"
149      depends="abcl.init"
150      unless="abcl.jsr-223.p">
151      <echo>
152  Notice: JSR-223 support won't be built since it is not
153          supported, neither natively by your JVM nor by
154    libraries in the CLASSPATH.
155      </echo>
156    </target>
157
158    <target name="abcl.compile.java" 
159      depends="abcl.init,abcl.java.warning,abcl.jsr-223.notice">
160      <mkdir dir="${build.dir}"/>
161      <mkdir dir="${build.classes.dir}"/>
162      <javac destdir="${build.classes.dir}"
163       debug="true"
164       target="1.5">
165  <src path="${src.dir}"/>
166  <patternset refid="abcl.source.java"/>
167      </javac>
168      <echo message="${build}" 
169      file="${build.classes.dir}/org/armedbear/lisp/build"/>
170    </target>
171
172    <target name="abcl.copy.lisp">
173      <copy todir="${build.classes.dir}" preservelastmodified="yes">
174  <fileset dir="${src.dir}">
175    <patternset refid="abcl.source.lisp"/>
176  </fileset>
177      </copy>
178    </target>
179
180    <!-- Adjust the patternset for ABCL source to use the much faster
181         Ant 'uptodate' task to check if we need to compile the system
182         fasls.  Highly inter-dependent with the behavior specified in
183         'compile-system.lisp'.-->
184    <patternset id="abcl.source.lisp.fasls">
185      <patternset refid="abcl.source.lisp"/>
186      <exclude name="org/armedbear/lisp/tests/*.lisp"/>
187      <exclude name="org/armedbear/lisp/boot.lisp"/>
188      <exclude name="org/armedbear/lisp/emacs.lisp"/>
189      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
190      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
191    </patternset>
192
193    <target name="abcl.fasls.uptodate">
194      <uptodate property="abcl.fasls.uptodate.p" value="true">
195  <srcfiles dir="${build.classes.dir}">
196    <patternset refid="abcl.source.lisp.fasls"/>
197  </srcfiles>
198  <mapper type="glob" from="*.lisp" to="*.abcl"/>
199      </uptodate>
200    </target>
201   
202    <target name="abcl.compile.lisp" 
203      depends="abcl.copy.lisp,abcl.compile.java,abcl.fasls.uptodate"
204      unless="abcl.fasls.uptodate.p">
205      <java classpath="${build.classes.dir}"
206      fork="true"
207      classname="org.armedbear.lisp.Main">
208  <arg value="--noinit"/>
209  <arg value="--eval"/>
210  <arg value="(compile-system :zip nil :quit t)"/>
211      </java>
212    </target>
213
214    <property name="abcl.build.path"
215        value="${build.classes.dir}/org/armedbear/lisp/build"/>
216    <target name="abcl.stamp" depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
217      <mkdir dir="${abcl.build.path}/.."/>
218      <echo message="${build}" file="${abcl.build.path}"/>   
219    </target>
220
221    <property name="abcl.version.path"
222        value="${build.classes.dir}/org/armedbear/lisp/version"/>
223    <target name="abcl.stamp.version" depends="abcl.compile">
224      <!-- Determine which ABCL version we have just built by parsing
225           the output of LISP-IMPLEMENTATION-VERSION. -->
226      <java fork="true"
227      classpath="${build.classes.dir}"
228      outputproperty="abcl.version"
229      classname="org.armedbear.lisp.Main">
230  <arg value="--noinit"/>
231  <arg value="--noinform"/>
232  <arg value="--eval"/>
233  <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
234      </java>
235
236      <echo>Built ABCL version: ${abcl.version}</echo>
237      <mkdir dir="${abcl.version.path}/.."/>
238      <echo message="${abcl.version}" file="${abcl.version.path}"/> 
239    </target>
240
241    <target name="abcl.stamp.hostname" if="unix">
242      <exec executable="hostname" outputproperty="abcl.hostname"/>
243      <echo>abcl.hostname: ${abcl.hostname}</echo>
244    </target>
245
246    <target name="abcl.jar.uptodate" depends="abcl.compile">
247      <uptodate property="abcl.jar.uptodate.p" targetfile="${abcl.jar.path}">
248  <srcfiles dir="${build.classes.dir}">
249    <patternset refid="abcl.objects"/>
250  </srcfiles>
251      </uptodate>
252    </target>
253
254    <target name="abcl.jar" depends="abcl.stamp,abcl.jar.uptodate"
255      unless="abcl.jar.uptodate.p">
256      <mkdir dir="${dist.dir}"/>
257      <loadfile property="abcl.version"
258      srcFile="${abcl.version.path}"/>
259      <jar destfile="${abcl.jar.path}"
260     compress="true"
261     basedir="${build.classes.dir}">
262  <patternset refid="abcl.objects"/>
263  <manifest>
264    <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
265    <section name="org/armedbear/lisp">
266      <attribute name="Implementation-Title" 
267           value="ABCL"/>
268      <attribute name="Implementation-Version" 
269           value="${abcl.version}"/>
270      <attribute name="Implementation-Build" 
271           value="${build}"/>
272      <attribute name="Implementation-Source" 
273           value="${version.src}"/>
274    </section>
275  </manifest>
276        <metainf dir="${src.dir}/META-INF">
277        </metainf>
278      </jar>
279    </target>
280   
281    <target name="abcl.wrapper" 
282      depends="abcl.jar,abcl.wrapper.unix,abcl.wrapper.windows">
283      <description>
284  Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
285      </description>
286      <!-- Set from commandline or in 'build.properties' -->
287      <property name="additional.jars" value=""/>
288      <path id="abcl.runtime.classpath">
289  <pathelement location="${abcl.jar.path}"/>
290  <pathelement path="${additional.jars}"/>
291      </path>
292      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
293      <property name="java.options" value=""/>
294
295      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
296  <filterset>
297    <filter token="JAVA" 
298      value="${java.path}"/>
299    <filter token="ABCL_JAVA_OPTIONS" 
300      value= "${java.options}"/>
301    <filter token="ABCL_LIBPATH" 
302      value="${basedir}/src/org/armedbear/lisp/libabcl.so"/>
303    <filter token="ABCL_CLASSPATH" 
304      value="${toString:abcl.runtime.classpath}"/>
305  </filterset>
306      </copy>
307      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
308
309      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
310      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
311    </target>
312
313    <target name="abcl.wrapper.unix" if="unix">
314      <property name="abcl.wrapper.file" value="abcl"/>
315      <property name="abcl.wrapper.in.file" value="abcl.in"/>
316    </target>
317
318    <target name="abcl.wrapper.windows" if="windows">
319      <property name="abcl.wrapper.file" value="abcl.bat"/>
320      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
321    </target>
322
323    <target name="abcl.debug.jpda" depends="abcl.jar">
324      <description>Invoke ABCL with JPDA listener on port 6789</description>
325      <java fork="true"
326      classpathref="abcl.classpath.dist"
327      classname="org.armedbear.lisp.Main">
328  <jvmarg 
329      value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
330      </java>
331    </target>
332
333    <target name="abcl.run" depends="abcl.jar">
334      <java fork="true"
335      classpathref="abcl.classpath.dist"
336      classname="org.armedbear.lisp.Main">
337      </java>
338    </target>
339
340    <target name="abcl.clean">
341      <delete dir="${build.dir}"/>
342      <delete file="${abcl.jar.path}"/>
343      <delete file="abcl"/>
344      <delete file="abcl.bat"/>
345    </target>
346
347    <target name="abcl.dist" depends="abcl.jar">
348      <copy file="${abcl.jar.path}"
349      toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
350    </target>
351
352    <target name="abcl.distclean" depends="abcl.clean">
353      <delete dir="${dist.dir}"/>
354      <delete file="abcl"/>
355      <delete file="abcl.bat"/>
356    </target>
357
358    <target name="TAGS">
359      <apply executable="etags" parallel="true" verbose="true">
360  <fileset dir="${src.dir}">
361    <patternset refid="abcl.source.java"/>
362    <patternset refid="abcl.source.lisp"/>
363  </fileset>
364      </apply>
365    </target>
366
367    <patternset id="abcl.dist.misc"
368    description="Additional includes in the source distributions relative to basedir">
369      <include name="build.xml"/>
370      <include name="build.properties.in"/>
371      <include name="COPYING"/>
372      <include name="README"/>
373      <include name="abcl.in"/>
374      <include name="abcl.bat.in"/>
375     
376      <!-- The remainder of these files are used by the Lisp hosted
377           build in 'build-abcl.lisp' but not used by Ant, so include
378           them in the source distribution. -->
379      <include name="make-jar.in"/>
380      <include name="make-jar.bat.in"/>
381
382      <include name="build-abcl.lisp"/>
383      <include name="customizations.lisp.in"/>
384
385      <include name="test-abcl.asd"/>
386      <include name="build-abcl.asd"/>
387    </patternset>
388
389    <patternset id="abcl.source.misc"
390    description="Additional includes in the source distribution relative to source root">
391      <include name="org/armedbear/lisp/LICENSE"/>
392      <include name="manifest-abcl"/>
393    </patternset>
394   
395    <target name="abcl.source.prepare" depends="abcl.stamp.version">
396      <property name="abcl.source.eol" value="asis"/>
397      <echo>Using abcl.source.eol='${abcl.source.eol}' to drive
398      source code line-ending transformations.</echo>
399      <property name="abcl.build.src.dir"
400    value="${build.dir}/abcl-src-${abcl.version}"/>
401      <mkdir dir="${abcl.build.src.dir}/src"/>
402      <fixcrlf srcdir="${src.dir}" 
403         eol="${abcl.source.eol}"
404         destdir="${abcl.build.src.dir}/src"
405         preservelastmodified="true">
406  <patternset refid="abcl.source.java"/>
407  <patternset refid="abcl.source.lisp"/>
408  <patternset refid="abcl.source.misc"/>
409      </fixcrlf>
410      <fixcrlf srcdir="${basedir}" 
411         eol="${abcl.source.eol}"
412         destdir="${abcl.build.src.dir}"
413         preservelastmodified="true">
414  <patternset refid="abcl.dist.misc"/>
415      </fixcrlf>
416    </target>
417
418    <target name="abcl.source.tar" depends="abcl.source.prepare">
419      <mkdir dir="${dist.dir}"/>
420      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
421     compression="gzip">
422  <tarfileset dir="${build.dir}">
423    <include name="abcl-src-${abcl.version}/**"/>
424  </tarfileset>
425      </tar>
426    </target>
427
428    <target name="abcl.source.zip" depends="abcl.source.prepare">
429      <mkdir dir="${dist.dir}"/>
430      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
431     compress="true">
432  <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
433      </zip>
434    </target>
435
436    <property name="abcl.test.classes.dir"
437        value="${build.dir}/classes-test"/>
438
439    <property name="abcl.test.src.dir"
440        value="${basedir}/test/src"/>
441
442    <patternset id="abcl.test.source.java">
443      <!-- For now, we list tests explicitly, because we have to
444           enumerate them later to the JUnit test runner. -->
445      <include name="org/armedbear/lisp/FastStringBufferTest.java"/>
446    </patternset>
447
448    <property name="junit-4.5.path"
449        value="${abcl.ext.dir}/junit-4.5.jar"/>
450
451    <path id="abcl.test.compile.classpath">
452      <pathelement location="${junit-4.5.path}"/>
453      <pathelement location="${build.classes.dir}"/>
454    </path>
455
456    <target name="abcl.test.pre-compile" depends="abcl.ext"/>
457
458    <target name="abcl.ext.p">
459      <!--XXX generalize over enumeration of all contributions to abcl.ext -->
460      <available file="${junit-4.5.path}" property="abcl.ext.p"/>
461    </target>
462    <target name="abcl.ext" depends="abcl.ext.p" unless="abcl.ext.p">
463
464      <mkdir dir="${abcl.ext.dir}"/>
465      <get src="http://downloads.sourceforge.net/junit/junit-4.5.jar?modtime=1218209625"
466     usetimestamp="true"
467     dest="${junit-4.5.path}"/>
468    </target>
469 
470    <target name="abcl.test.compile" 
471      depends="abcl.test.pre-compile,abcl.compile">
472      <mkdir dir="${abcl.test.classes.dir}"/>
473      <javac destdir="${abcl.test.classes.dir}"
474       classpathref="abcl.test.compile.classpath"
475       debug="true"
476       target="1.5">
477  <src path="${abcl.test.src.dir}"/>
478  <patternset refid="abcl.test.source.java"/>
479      </javac>
480    </target>
481
482    <path id="abcl.test.run.classpath">
483      <path refid="abcl.test.compile.classpath"/>
484      <pathelement location="${abcl.test.classes.dir}"/>
485    </path>
486
487    <target name="abcl.test" 
488      depends="abcl.test.java,abcl.test.lisp"/>
489 
490    <target name="abcl.test.java" depends="abcl.test.compile">
491      <java fork="true"
492      classpathref="abcl.test.run.classpath"
493      classname="org.junit.runner.JUnitCore">
494  <arg value="org.armedbear.lisp.FastStringBufferTest"/>
495      </java>
496    </target>
497
498    <target name="abcl.test.lisp" 
499      depends="test.ansi.compiled,test.abcl"/>
500
501
502    <target name="test.ansi.interpreted" depends="abcl.jar">
503      <echo>Recording test output in ${abcl.test.log.file}.</echo>
504      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
505      <java fork="true" dir="${basedir}"
506      classpathref="abcl.classpath.dist"
507      classname="org.armedbear.lisp.Main">
508  <arg value="--noinit"/> 
509  <arg value="--load"/>
510  <arg line="${basedir}/test/lisp/ansi/ansi-tests-interpreted.lisp"/>
511      </java>
512      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
513      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
514    </target>
515
516    <target name="test.ansi.compiled" depends="abcl.jar">
517      <echo>Recording test output in ${abcl.test.log.file}.</echo>
518      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
519      <java fork="true" dir="${basedir}"
520      classpathref="abcl.classpath.dist"
521      classname="org.armedbear.lisp.Main">
522  <arg value="--noinit"/> 
523  <arg value="--load"/>
524  <arg line="${basedir}/test/lisp/ansi/ansi-tests-compiled.lisp "/> 
525      </java>
526      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
527      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
528    </target>
529
530    <target name="test.abcl" depends="abcl.jar">
531      <echo>Recording test output in ${abcl.test.log.file}.</echo>
532      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
533      <java fork="true" dir="${basedir}"
534      classpathref="abcl.classpath.dist"
535      classname="org.armedbear.lisp.Main">
536  <arg value="--noinit"/> 
537  <arg value="--load"/>
538  <arg line="${basedir}/test/lisp/abcl/abcl-test.lisp"/>
539      </java>
540      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
541      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
542    </target>
543
544    <import file="netbeans-build.xml" optional="true"/> 
545<!--    <import file="j-build.xml" optional="true"/>  -->
546    <import file="not.org-build.xml" optional="true"/> 
547</project>
548
Note: See TracBrowser for help on using the repository browser.