source: tags/0.15.0/abcl/build.xml

Last change on this file was 11751, checked in by ehuelsmann, 15 years ago

Don't catch STDERR output into the property, so that it becomes usable
for printing debug information.

  • Property svn:eol-style set to LF
File size: 19.1 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       failonerror="true">
166  <src path="${src.dir}"/>
167  <patternset refid="abcl.source.java"/>
168      </javac>
169      <echo message="${build}" 
170      file="${build.classes.dir}/org/armedbear/lisp/build"/>
171    </target>
172
173    <target name="abcl.copy.lisp">
174      <copy todir="${build.classes.dir}" preservelastmodified="yes">
175  <fileset dir="${src.dir}">
176    <patternset refid="abcl.source.lisp"/>
177  </fileset>
178      </copy>
179    </target>
180
181    <!-- Adjust the patternset for ABCL source to use the much faster
182         Ant 'uptodate' task to check if we need to compile the system
183         fasls.  Highly inter-dependent with the behavior specified in
184         'compile-system.lisp'.-->
185    <patternset id="abcl.source.lisp.fasls">
186      <patternset refid="abcl.source.lisp"/>
187      <exclude name="org/armedbear/lisp/tests/*.lisp"/>
188      <exclude name="org/armedbear/lisp/boot.lisp"/>
189      <exclude name="org/armedbear/lisp/emacs.lisp"/>
190      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
191      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
192    </patternset>
193
194    <target name="abcl.fasls.uptodate">
195      <uptodate property="abcl.fasls.uptodate.p" value="true">
196  <srcfiles dir="${build.classes.dir}">
197    <patternset refid="abcl.source.lisp.fasls"/>
198  </srcfiles>
199  <mapper type="glob" from="*.lisp" to="*.abcl"/>
200      </uptodate>
201    </target>
202   
203    <target name="abcl.compile.lisp" 
204      depends="abcl.copy.lisp,abcl.compile.java,abcl.fasls.uptodate"
205      unless="abcl.fasls.uptodate.p">
206      <java classpath="${build.classes.dir}"
207      fork="true"
208      failonerror="true"
209      classname="org.armedbear.lisp.Main">
210  <arg value="--noinit"/>
211  <arg value="--eval"/>
212  <arg value="(compile-system :zip nil :quit t)"/>
213      </java>
214    </target>
215
216    <property name="abcl.build.path"
217        value="${build.classes.dir}/org/armedbear/lisp/build"/>
218    <target name="abcl.stamp" depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
219      <mkdir dir="${abcl.build.path}/.."/>
220      <echo message="${build}" file="${abcl.build.path}"/>   
221    </target>
222
223    <property name="abcl.version.path"
224        value="${build.classes.dir}/org/armedbear/lisp/version"/>
225    <target name="abcl.stamp.version" depends="abcl.compile">
226      <!-- Determine which ABCL version we have just built by parsing
227           the output of LISP-IMPLEMENTATION-VERSION. -->
228      <java fork="true"
229      classpath="${build.classes.dir}"
230      outputproperty="abcl.version"
231      classname="org.armedbear.lisp.Main"
232        logerror="yes"> <!-- Don't catch stderr output -->
233  <arg value="--noinit"/>
234  <arg value="--noinform"/>
235  <arg value="--eval"/>
236  <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
237      </java>
238
239      <echo>Built ABCL version: ${abcl.version}</echo>
240      <mkdir dir="${abcl.version.path}/.."/>
241      <echo message="${abcl.version}" file="${abcl.version.path}"/> 
242    </target>
243
244    <target name="abcl.stamp.hostname" if="unix">
245      <exec executable="hostname" outputproperty="abcl.hostname"/>
246      <echo>abcl.hostname: ${abcl.hostname}</echo>
247    </target>
248
249    <target name="abcl.jar.uptodate" depends="abcl.compile">
250      <uptodate property="abcl.jar.uptodate.p" targetfile="${abcl.jar.path}">
251  <srcfiles dir="${build.classes.dir}">
252    <patternset refid="abcl.objects"/>
253  </srcfiles>
254      </uptodate>
255    </target>
256
257    <target name="abcl.jar" depends="abcl.stamp,abcl.jar.uptodate"
258      unless="abcl.jar.uptodate.p">
259      <mkdir dir="${dist.dir}"/>
260      <loadfile property="abcl.version"
261      srcFile="${abcl.version.path}"/>
262      <jar destfile="${abcl.jar.path}"
263     compress="true"
264     basedir="${build.classes.dir}">
265  <patternset refid="abcl.objects"/>
266  <manifest>
267    <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
268    <section name="org/armedbear/lisp">
269      <attribute name="Implementation-Title" 
270           value="ABCL"/>
271      <attribute name="Implementation-Version" 
272           value="${abcl.version}"/>
273      <attribute name="Implementation-Build" 
274           value="${build}"/>
275      <attribute name="Implementation-Source" 
276           value="${version.src}"/>
277    </section>
278  </manifest>
279        <metainf dir="${src.dir}/META-INF">
280        </metainf>
281      </jar>
282    </target>
283   
284    <target name="abcl.wrapper" 
285      depends="abcl.jar,abcl.wrapper.unix,abcl.wrapper.windows">
286      <description>
287  Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
288      </description>
289      <!-- Set from commandline or in 'build.properties' -->
290      <property name="additional.jars" value=""/>
291      <path id="abcl.runtime.classpath">
292  <pathelement location="${abcl.jar.path}"/>
293  <pathelement path="${additional.jars}"/>
294      </path>
295      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
296      <property name="java.options" value=""/>
297
298      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
299  <filterset>
300    <filter token="JAVA" 
301      value="${java.path}"/>
302    <filter token="ABCL_JAVA_OPTIONS" 
303      value= "${java.options}"/>
304    <filter token="ABCL_LIBPATH" 
305      value="${basedir}/src/org/armedbear/lisp/libabcl.so"/>
306    <filter token="ABCL_CLASSPATH" 
307      value="${toString:abcl.runtime.classpath}"/>
308  </filterset>
309      </copy>
310      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
311
312      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
313      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
314    </target>
315
316    <target name="abcl.wrapper.unix" if="unix">
317      <property name="abcl.wrapper.file" value="abcl"/>
318      <property name="abcl.wrapper.in.file" value="abcl.in"/>
319    </target>
320
321    <target name="abcl.wrapper.windows" if="windows">
322      <property name="abcl.wrapper.file" value="abcl.bat"/>
323      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
324    </target>
325
326    <target name="abcl.debug.jpda" depends="abcl.jar">
327      <description>Invoke ABCL with JPDA listener on port 6789</description>
328      <java fork="true"
329      classpathref="abcl.classpath.dist"
330      classname="org.armedbear.lisp.Main">
331  <jvmarg 
332      value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
333      </java>
334    </target>
335
336    <target name="abcl.run" depends="abcl.jar">
337      <java fork="true"
338      classpathref="abcl.classpath.dist"
339      classname="org.armedbear.lisp.Main">
340      </java>
341    </target>
342
343    <target name="abcl.clean">
344      <delete dir="${build.dir}"/>
345      <delete file="${abcl.jar.path}"/>
346      <delete file="abcl"/>
347      <delete file="abcl.bat"/>
348    </target>
349
350    <target name="abcl.dist" depends="abcl.jar">
351      <copy file="${abcl.jar.path}"
352      toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
353    </target>
354
355    <target name="abcl.distclean" depends="abcl.clean">
356      <delete dir="${dist.dir}"/>
357      <delete file="abcl"/>
358      <delete file="abcl.bat"/>
359    </target>
360
361    <target name="TAGS">
362      <apply executable="etags" parallel="true" verbose="true">
363  <fileset dir="${src.dir}">
364    <patternset refid="abcl.source.java"/>
365    <patternset refid="abcl.source.lisp"/>
366  </fileset>
367      </apply>
368    </target>
369
370    <patternset id="abcl.dist.misc"
371    description="Additional includes in the source distributions relative to basedir">
372      <include name="build.xml"/>
373      <include name="build.properties.in"/>
374      <include name="COPYING"/>
375      <include name="README"/>
376      <include name="CHANGES"/>
377      <include name="abcl.in"/>
378      <include name="abcl.bat.in"/>
379     
380      <!-- The remainder of these files are used by the Lisp hosted
381           build in 'build-abcl.lisp' but not used by Ant, so include
382           them in the source distribution. -->
383      <include name="make-jar.in"/>
384      <include name="make-jar.bat.in"/>
385
386      <include name="build-abcl.lisp"/>
387      <include name="customizations.lisp.in"/>
388
389      <include name="test-abcl.asd"/>
390      <include name="build-abcl.asd"/>
391    </patternset>
392
393    <patternset id="abcl.source.misc"
394    description="Additional includes in the source distribution relative to source root">
395      <include name="org/armedbear/lisp/LICENSE"/>
396      <include name="manifest-abcl"/>
397      <include name="META-INF/services/javax.script.ScriptEngineFactory"/>
398    </patternset>
399   
400    <target name="abcl.source.prepare" depends="abcl.stamp.version">
401      <property name="abcl.source.eol" value="asis"/>
402      <echo>Using abcl.source.eol='${abcl.source.eol}' to drive
403      source code line-ending transformations.</echo>
404      <property name="abcl.build.src.dir"
405    value="${build.dir}/abcl-src-${abcl.version}"/>
406      <mkdir dir="${abcl.build.src.dir}/src"/>
407      <fixcrlf srcdir="${src.dir}" 
408         eol="${abcl.source.eol}"
409         destdir="${abcl.build.src.dir}/src"
410         preservelastmodified="true">
411  <patternset refid="abcl.source.java"/>
412  <patternset refid="abcl.source.lisp"/>
413  <patternset refid="abcl.source.misc"/>
414      </fixcrlf>
415      <fixcrlf srcdir="${basedir}" 
416         eol="${abcl.source.eol}"
417         destdir="${abcl.build.src.dir}"
418         preservelastmodified="true">
419  <patternset refid="abcl.dist.misc"/>
420      </fixcrlf>
421    </target>
422
423    <target name="abcl.source.tar" depends="abcl.source.prepare">
424      <mkdir dir="${dist.dir}"/>
425      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
426     compression="gzip">
427  <tarfileset dir="${build.dir}">
428    <include name="abcl-src-${abcl.version}/**"/>
429  </tarfileset>
430      </tar>
431    </target>
432
433    <target name="abcl.source.zip" depends="abcl.source.prepare">
434      <mkdir dir="${dist.dir}"/>
435      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
436     compress="true">
437  <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
438      </zip>
439    </target>
440
441    <property name="abcl.test.classes.dir"
442        value="${build.dir}/classes-test"/>
443
444    <property name="abcl.test.src.dir"
445        value="${basedir}/test/src"/>
446
447    <patternset id="abcl.test.source.java">
448      <!-- For now, we list tests explicitly, because we have to
449           enumerate them later to the JUnit test runner. -->
450      <include name="org/armedbear/lisp/FastStringBufferTest.java"/>
451    </patternset>
452
453    <property name="junit-4.5.path"
454        value="${abcl.ext.dir}/junit-4.5.jar"/>
455
456    <path id="abcl.test.compile.classpath">
457      <pathelement location="${junit-4.5.path}"/>
458      <pathelement location="${build.classes.dir}"/>
459    </path>
460
461    <target name="abcl.test.pre-compile" depends="abcl.ext"/>
462
463    <target name="abcl.ext.p">
464      <!--XXX generalize over enumeration of all contributions to abcl.ext -->
465      <available file="${junit-4.5.path}" property="abcl.ext.p"/>
466    </target>
467    <target name="abcl.ext" depends="abcl.ext.p" unless="abcl.ext.p">
468
469      <mkdir dir="${abcl.ext.dir}"/>
470      <get src="http://downloads.sourceforge.net/junit/junit-4.5.jar?modtime=1218209625"
471     usetimestamp="true"
472     dest="${junit-4.5.path}"/>
473    </target>
474 
475    <target name="abcl.test.compile" 
476      depends="abcl.test.pre-compile,abcl.compile">
477      <mkdir dir="${abcl.test.classes.dir}"/>
478      <javac destdir="${abcl.test.classes.dir}"
479       classpathref="abcl.test.compile.classpath"
480       debug="true"
481       target="1.5">
482  <src path="${abcl.test.src.dir}"/>
483  <patternset refid="abcl.test.source.java"/>
484      </javac>
485    </target>
486
487    <path id="abcl.test.run.classpath">
488      <path refid="abcl.test.compile.classpath"/>
489      <pathelement location="${abcl.test.classes.dir}"/>
490    </path>
491
492    <target name="abcl.test" 
493      depends="abcl.test.java,abcl.test.lisp"/>
494 
495    <target name="abcl.test.java" depends="abcl.test.compile">
496      <java fork="true"
497      classpathref="abcl.test.run.classpath"
498      classname="org.junit.runner.JUnitCore">
499  <arg value="org.armedbear.lisp.FastStringBufferTest"/>
500      </java>
501    </target>
502
503    <target name="abcl.test.lisp" 
504      depends="test.ansi.compiled,test.abcl"/>
505
506
507    <target name="test.ansi.interpreted" depends="abcl.jar">
508      <echo>Recording test output in ${abcl.test.log.file}.</echo>
509      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
510      <java fork="true" dir="${basedir}"
511      classpathref="abcl.classpath.dist"
512      classname="org.armedbear.lisp.Main">
513  <arg value="--noinit"/> 
514  <arg value="--load"/>
515  <arg line="${basedir}/test/lisp/ansi/ansi-tests-interpreted.lisp"/>
516      </java>
517      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
518      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
519    </target>
520
521    <target name="test.ansi.compiled" depends="abcl.jar">
522      <echo>Recording test output in ${abcl.test.log.file}.</echo>
523      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
524      <java fork="true" dir="${basedir}"
525      classpathref="abcl.classpath.dist"
526      classname="org.armedbear.lisp.Main">
527  <arg value="--noinit"/> 
528  <arg value="--load"/>
529  <arg line="${basedir}/test/lisp/ansi/ansi-tests-compiled.lisp "/> 
530      </java>
531      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
532      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
533    </target>
534
535    <target name="test.abcl" depends="abcl.jar">
536      <echo>Recording test output in ${abcl.test.log.file}.</echo>
537      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
538      <java fork="true" dir="${basedir}"
539      classpathref="abcl.classpath.dist"
540      classname="org.armedbear.lisp.Main">
541  <arg value="--noinit"/> 
542  <arg value="--load"/>
543  <arg line="${basedir}/test/lisp/abcl/abcl-test.lisp"/>
544      </java>
545      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
546      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
547    </target>
548
549    <import file="netbeans-build.xml" optional="true"/> 
550<!--    <import file="j-build.xml" optional="true"/>  -->
551    <import file="not.org-build.xml" optional="true"/> 
552</project>
553
Note: See TracBrowser for help on using the repository browser.