source: trunk/abcl/build.xml @ 13428

Last change on this file since 13428 was 13428, checked in by Mark Evenson, 12 years ago

Enable compilation with Java 7.

  • Property svn:eol-style set to LF
File size: 33.4 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="antlib:org.apache.tools.ant"
3         name="abcl-master" default="abcl.wrapper" basedir=".">
4    <description>Compiling, testing, and packaging Armed Bear Common Lisp</description>
5
6    <target name="abcl" depends="abcl.wrapper"/>
7       
8    <target name="help">
9      <echo>
10Main Ant targets:
11
12 abcl.wrapper
13   -- [default] create executable wrapper for ABCL.
14 abcl.compile 
15   -- compile ABCL to ${build.classes.dir}.
16 abcl.jar     
17   -- create packaged ${abcl.jar.path}.
18 abcl.source.zip abcl.source.tar
19   -- create source distributions in ${dist.dir}.
20 abcl.clean
21   -- remove ABCL intermediate files
22      </echo>
23
24      <echo>
25For help on the automatic tests available, use the Ant target 'help.test'.
26      </echo>
27    </target>
28
29    <!-- Behavior of the build system can be customized via setting
30         properties in the 'abcl.properties' file. -->
31    <property file="abcl.properties"/>
32
33    <property name="build.dir" 
34              value="${basedir}/build"/>
35    <property name="build.classes.dir" 
36              value="${build.dir}/classes"/>
37    <property name="src.dir" 
38              value="${basedir}/src"/>
39    <property name="dist.dir" 
40              value="${basedir}/dist"/>
41    <property name="abcl.jar.path"
42              value="${dist.dir}/abcl.jar"/>
43    <property name="abcl.ext.dir"
44              value="${basedir}/ext"/>
45
46    <fail message="Please build using Ant 1.7.1 or higher.">
47        <condition>
48            <not>
49                <antversion atleast="1.7.1"/>
50            </not>
51        </condition>
52    </fail>
53
54    <!-- Checks if JSR-223 support is available - thanks to Mark Evenson -->
55    <available property="abcl.jsr-223.p"
56               classname="javax.script.ScriptEngine"/>
57
58    <patternset id="abcl.source.java">
59      <include name="org/armedbear/lisp/*.java"/>
60      <include name="org/armedbear/lisp/util/*.java"/>
61      <include name="org/armedbear/lisp/protocol/*.java"/>
62      <include name="org/armedbear/lisp/java/**/*.java"/>
63      <include name="org/armedbear/lisp/scripting/*.java" if="abcl.jsr-223.p"/>
64      <include name="org/armedbear/lisp/scripting/util/*.java" if="abcl.jsr-223.p"/>
65      <include name="org/armedbear/Main.java"/>
66    </patternset>
67
68    <patternset id="abcl.source.lisp">
69      <include name="org/armedbear/lisp/*.lisp"/>
70      <include name="org/armedbear/lisp/java/**/*.lisp"/>
71      <include name="org/armedbear/lisp/tests/*.lisp"/>
72      <exclude name="org/armedbear/lisp/j.lisp"/>
73      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
74    </patternset>
75
76    <!-- Lisp files required at runtime -->
77    <patternset id="abcl.source.lisp.dist">
78      <include name="org/armedbear/lisp/boot.lisp"/>
79      <include name="org/armedbear/lisp/scripting/lisp/*.lisp" if="abcl.jsr-223.p"/>
80      <include name="**/*.lisp" if="abcl.compile.lisp.skip"/>
81    </patternset>
82
83    <patternset id="abcl.objects">
84      <!-- "system.lisp" is dynamically created by COMPILE-SYSTEM -->
85      <include name="org/armedbear/lisp/system.lisp"/> 
86      <include name="org/armedbear/lisp/**/*.class"/>
87      <include name="org/armedbear/lisp/**/*.cls"/> 
88      <include name="org/armedbear/lisp/**/*.abcl"/>
89      <include name="org/armedbear/lisp/version"/>
90      <include name="org/armedbear/lisp/scripting/*.class" if="abcl.jsr-223.p"/>
91      <include name="org/armedbear/lisp/scripting/util/*.class" if="abcl.jsr-223.p"/>
92      <patternset refid="abcl.source.lisp.dist"/>
93    </patternset>
94   
95    <path id="abcl.classpath.dist">
96      <pathelement location="${abcl.jar.path}"/>
97    </path>
98   
99    <path id="abcl.classpath.build">
100      <pathelement location="${build.classes.dir}"/>
101    </path>
102
103    <target name="abcl.compile" depends="abcl.clean.maybe,abcl.compile.lisp">
104      <echo>Compiled ABCL with Java version: ${java.version}</echo>
105    </target>
106
107    <target name="abcl.clean.maybe" unless="abcl.build.incremental">
108      <echo>Cleaning all intermediate compilation artifacts.</echo>
109      <echo>Setting 'abcl.build.incremental' enables incremental compilation.</echo>
110      <antcall target="abcl.clean"/>
111    </target>
112     
113
114    <target name="abcl.init">
115      <tstamp>
116        <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
117      </tstamp>
118
119      <tstamp>
120        <format property="build.stamp" pattern="yyyymmdd-HHmm"/>
121      </tstamp>
122
123      <property name="abcl.test.log.file"
124                value="abcl-test-${build.stamp}.log"/>
125
126      <property name="java.path"
127                value="${java.home}/bin/java"/>
128
129      <!-- Deprecated. Two main types of build environents: 'unix' or 'windows'. -->
130      <condition property="unix"> 
131        <or>
132          <os family="unix"/>
133          <os family="mac"/>
134        </or>
135      </condition>
136      <condition property="windows"> 
137        <os family="windows"/>
138      </condition>
139
140      <!-- Deprecated. -->
141      <available file="${src.dir}org/armedbear/lisp/Interpreter.java" 
142                 property="abcl.lisp.p"/>
143
144      <echo>java.version: ${java.version}</echo>
145      <condition property="abcl.java.version.p">
146        <or>
147          <matches string="${java.version}" pattern="1\.5"/>
148          <matches string="${java.version}" pattern="1\.6\.0_[12][0-9]"/>
149        </or> 
150      </condition>
151
152    </target>
153   
154    <target name="abcl.java.warning" 
155            depends="abcl.init"
156            unless="abcl.java.version.p">
157      <echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
158    </target>
159       
160    <target name="abcl.jsr-223.notice"
161            depends="abcl.init"
162            unless="abcl.jsr-223.p">
163      <echo>
164        Notice: JSR-223 support won't be built since it is not
165                supported, neither natively by your JVM nor by
166                libraries in the CLASSPATH.
167      </echo>
168    </target>
169
170    <target name="abcl.compile.java" 
171            depends="abcl.init,abcl.java.warning,abcl.jsr-223.notice">
172      <mkdir dir="${build.dir}"/>
173      <mkdir dir="${build.classes.dir}"/>
174      <javac destdir="${build.classes.dir}"
175             debug="true"
176             target="1.5"
177             source="1.5"
178             includeantruntime="false"
179             failonerror="true">
180        <src path="${src.dir}"/>
181        <patternset refid="abcl.source.java"/>
182      </javac>
183      <echo message="${build}" 
184            file="${build.classes.dir}/org/armedbear/lisp/build"/>
185    </target>
186
187    <target name="abcl.copy.lisp">
188      <copy todir="${build.classes.dir}" preservelastmodified="yes">
189        <fileset dir="${src.dir}">
190          <patternset refid="abcl.source.lisp.dist"/>
191        </fileset>
192      </copy>
193    </target>
194
195    <!-- Adjust the patternset for ABCL source to use the much faster
196         Ant 'uptodate' task to check if we need to compile the system
197         fasls.  Highly inter-dependent with the behavior specified in
198         'compile-system.lisp', i.e. files not listed in
199         there should NOT occur here. -->
200    <patternset id="abcl.source.lisp.fasls">
201      <patternset refid="abcl.source.lisp"/>
202      <exclude name="org/armedbear/lisp/scripting/**/*.lisp"/>
203      <exclude name="org/armedbear/lisp/boot.lisp"/>
204      <exclude name="org/armedbear/lisp/emacs.lisp"/>
205      <exclude name="org/armedbear/lisp/runtime-class.lisp"/>
206      <exclude name="org/armedbear/lisp/run-benchmarks.lisp"/>
207    </patternset>
208
209    <target name="abcl.fasls.uptodate">
210      <uptodate property="abcl.fasls.uptodate.p" value="true">
211        <srcfiles dir="${src.dir}">
212          <patternset refid="abcl.source.lisp.fasls"/>
213        </srcfiles>
214        <mapper type="glob" from="*.lisp" to="${build.classes.dir}/*.abcl"/>
215      </uptodate>
216    </target>
217
218    <path id="abcl.home.dir.path">
219        <path location="${src.dir}/org/armedbear/lisp/"/>
220    </path>         
221    <pathconvert property="abcl.home.dir" refid="abcl.home.dir.path"/>
222
223    <path id="abcl.lisp.output.path"
224          location="${build.classes.dir}/org/armedbear/lisp/"/>
225    <pathconvert dirsep="/" property="abcl.lisp.output" refid="abcl.lisp.output.path"/>
226
227    <property name="system.lisp.file" 
228              value="${build.classes.dir}/org/armedbear/lisp/system.lisp"/>
229   
230    <target name="abcl.compile.lisp" 
231            depends="abcl.copy.lisp,abcl.compile.java,abcl.system.update.maybe,abcl.fasls.uptodate"
232            unless="abcl.fasls.uptodate.p">
233      <echo>
234Compiling Lisp system
235from ${abcl.home.dir}
236 to  ${abcl.lisp.output}</echo>
237 
238     <!-- Not good if ${abcl.home.dir} == ${abcl.lisp.output} -->
239     <delete>
240       <fileset dir="${abcl.home.dir}" includes="**/*.abcl **/*.cls **/*._"/>
241     </delete>
242     <java classpath="${build.classes.dir}" 
243            fork="true"
244            failonerror="true"
245            inputstring="(handler-case (compile-system :zip nil :quit t :output-path &quot;${abcl.lisp.output}/&quot;) (t (x) (progn (format t &quot;~A: ~A~%&quot; (type-of x) x) (exit :status -1))))"
246            classname="org.armedbear.lisp.Main">
247        <jvmarg value="-Dabcl.home=${abcl.home.dir}${file.separator}"/>
248        <arg value="--noinit"/>
249        <arg value="--nosystem"/>
250        <arg value="--eval"/>
251        <arg value="(setf *load-verbose* t)"/>
252      </java>
253      <concat destfile="${system.lisp.file}" append="true">
254        <fileset file="${abcl.startup.file}"/>
255      </concat>
256    </target>
257
258    <property name="abcl.build.path"
259              value="${build.classes.dir}/org/armedbear/lisp/build"/>
260    <target name="abcl.stamp" 
261            depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
262      <mkdir dir="${abcl.build.path}/.."/>
263      <loadfile property="abcl.version"
264                srcFile="${abcl.version.path}"/>
265      <echo message="${build}" file="${abcl.build.path}"/>   
266    </target>
267
268
269    <!-- Environment variables may be accessed as ${env.NAME} -->
270    <property environment="env"/>
271
272    <!-- Can we derive an SVN version from the current build tree? -->
273    <condition property="abcl.version.svn.p">
274      <and>
275        <available
276            file="${basedir}/.svn"
277            type="dir"/>
278        <or>
279            <available
280                file="svnversion.exe"
281                filepath="${env.Path}"/>
282            <available
283                file="svnversion.exe"
284                filepath="${env.PATH}"/>
285             <available
286                file="svnversion"
287                filepath="${env.Path}"/>
288            <available
289                file="svnversion"
290                filepath="${env.PATH}"/>
291        </or>
292      </and>
293    </condition>
294
295    <target name="abcl.version.src" depends="abcl.version.src.3"/>
296
297    <target name="abcl.version.src.0" if="windows">
298      <exec
299          executable="svnversion.exe"
300          outputproperty="abcl.version.svn"
301          failifexecutionfails="false"
302          searchpath="true" />
303    </target>
304
305    <target name="abcl.version.src.1" depends="abcl.version.src.0">
306      <exec 
307          executable="svnversion"
308          outputproperty="abcl.version.svn"
309          failifexecutionfails="false"
310          searchpath="true" />
311    </target>
312
313    <target name="abcl.version.src.2" 
314            depends="abcl.version.src.1"
315            if="abcl.version.svn.p">
316      <echo>abcl.version.svn: ${abcl.version.svn}</echo>
317      <property name="abcl.version.src"
318                value="svn-${abcl.version.svn}"/>
319    </target>
320
321    <target name="abcl.version.src.3"
322            depends="abcl.version.src.2"
323            unless="abcl.version.svn.p">
324      <property name="abcl.version.src"
325                value=""/>
326    </target>
327
328    <property name="abcl.home.dir"
329              value="${src.dir}/org/armedbear/lisp/"/>
330    <property name="abcl.version.path"
331              value="${build.classes.dir}/org/armedbear/lisp/version"/>
332
333    <target name="abcl.clean.version">
334      <delete file="${abcl.version.path}"/>
335    </target>
336
337    <target name="abcl.stamp.version.uptodate">
338      <uptodate property="abcl.stamp.version.uptodate.p" 
339                targetfile="${abcl.version.path}"
340                srcfile="${build.classes.dir}/org/armedbear/lisp/Version.class"/>
341    </target>
342
343    <target name="abcl.stamp.version" 
344            depends="abcl.version.src,abcl.stamp.version.1,abcl.stamp.version.2"
345            unless="abcl.stamp.version.uptodate.p">
346      <mkdir dir="${abcl.version.path}/.."/>
347      <echo>ABCL implementation version: ${abcl.implementation.version}</echo>
348      <echo file="${abcl.version.path}">${abcl.implementation.version}</echo>
349    </target>
350   
351    <target name="abcl.stamp.version.generate" 
352            depends="abcl.compile.java"
353            unless="abcl.stamp.version.uptodate.p">
354      <java fork="true"
355            classpath="${build.classes.dir}"
356            outputproperty="abcl.version"
357            classname="org.armedbear.lisp.Version"
358            logerror="yes"/> <!-- Don't catch stderr output -->
359    </target>
360
361    <target name="abcl.stamp.version.0" 
362            depends="abcl.stamp.version.uptodate,abcl.stamp.version.generate">
363    </target>
364
365    <target name="abcl.stamp.version.1"
366            depends="abcl.stamp.version.0"
367            unless="abcl.version.svn.p">
368      <property name="abcl.implementation.version"
369                value="${abcl.version}"/>
370    </target>
371
372    <target name="abcl.stamp.version.2" 
373            depends="abcl.stamp.version.0"
374            if="abcl.version.svn.p">
375      <property name="abcl.implementation.version"
376                value="${abcl.version}-${abcl.version.src}"/>
377    </target>
378
379    <target name="abcl.stamp.hostname" if="unix">
380      <exec executable="hostname" outputproperty="abcl.hostname"/>
381      <echo>abcl.hostname: ${abcl.hostname}</echo>
382    </target>
383
384    <target name="abcl.system.uptodate">
385      <condition property="abcl.system.needs-update.p">
386        <and>
387          <available file="${system.lisp.file}"/>
388          <available file="${abcl.startup.file}"/>
389          <uptodate
390                srcfile="${system.lisp.file}"
391                targetfile="${abcl.startup.file}"/>
392        </and>
393      </condition>
394    </target>
395   
396    <target name="abcl.system.update.maybe" depends="abcl.system.uptodate" 
397            if="abcl.system.needs-update.p">
398      <touch file="${src.dir}/org/armedbear/lisp/compile-system.lisp"/>
399    </target>
400
401    <target name="abcl.jar.uptodate" depends="abcl.compile,abcl.stamp">
402      <uptodate property="abcl.jar.uptodate.p" targetfile="${abcl.jar.path}">
403        <srcfiles dir="${build.classes.dir}">
404          <patternset refid="abcl.objects"/>
405        </srcfiles>
406      </uptodate>
407    </target>
408
409    <target name="abcl.jar" depends="abcl.jar.uptodate"
410            unless="abcl.jar.uptodate.p">
411      <mkdir dir="${dist.dir}"/>
412      <jar destfile="${abcl.jar.path}"
413           compress="true"
414           update="true"
415           basedir="${build.classes.dir}">
416        <patternset refid="abcl.objects"/>
417        <manifest>
418          <attribute name="Main-Class" value="org.armedbear.lisp.Main"/>
419          <section name="org/armedbear/lisp">
420            <attribute name="Implementation-Title" 
421                       value="ABCL"/>
422            <attribute name="Implementation-Version" 
423                       value="${abcl.implementation.version}"/>
424            <attribute name="Implementation-Build" 
425                       value="${build}"/>
426          </section>
427        </manifest>
428        <metainf dir="${src.dir}/META-INF"> 
429          <exclude name="services/javax.script.ScriptEngineFactory"
430                   unless="abcl.jsr-223.p"/>
431        </metainf>
432      </jar>
433    </target>
434   
435    <target name="abcl.wrapper" 
436            depends="abcl.jar,abcl.contrib,abcl.wrapper.unix,abcl.wrapper.windows">
437      <description>
438        Creates in-place exectuable shell wrapper in '${abcl.wrapper.file}'
439      </description>
440      <!-- Set from commandline or in 'build.properties' -->
441      <property name="additional.jars" value=""/>
442      <path id="abcl.runtime.classpath">
443        <pathelement location="${abcl.jar.path}"/>
444        <pathelement path="${additional.jars}"/>
445      </path>
446      <!-- set via '-Djava.options=JAVA_OPTIONS' or in 'build.properties -->
447      <property name="java.options" value=""/>
448
449      <copy file="${abcl.wrapper.in.file}" toFile="${abcl.wrapper.file}" overwrite="yes">
450        <filterset>
451          <filter token="JAVA" 
452                  value="${java.path}"/>
453          <filter token="ABCL_JAVA_OPTIONS" 
454                  value="${java.options}"/>
455          <filter token="ABCL_CLASSPATH"
456                  value="${toString:abcl.runtime.classpath}"/>
457        </filterset>
458      </copy>
459      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
460
461      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
462      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
463    </target>
464
465    <target name="abcl.wrapper.unix" if="unix">
466      <property name="abcl.wrapper.file" value="abcl"/>
467      <property name="abcl.wrapper.in.file" value="abcl.in"/>
468    </target>
469
470    <target name="abcl.wrapper.windows" if="windows">
471      <property name="abcl.wrapper.file" value="abcl.bat"/>
472      <property name="abcl.wrapper.in.file" value="abcl.bat.in"/>
473    </target>
474
475    <patternset id="abcl.contrib.source">
476          <include name="**/*.asd"/>
477          <include name="**/*.lisp"/>
478          <include name="**/README.markdown"/>
479    </patternset>
480
481    <property name="abcl-contrib.jar"
482              value="${dist.dir}/abcl-contrib.jar"/>
483    <condition property="abcl.contrib.uptodate.p">
484      <uptodate targetfile="${abcl-contrib.jar}">
485        <srcfiles dir="contrib">
486          <patternset refid="abcl.contrib.source"/>
487        </srcfiles>
488      </uptodate>
489    </condition>
490
491    <target name="abcl.contrib" unless="abcl.contrib.uptodate.p">
492      <jar destfile="${abcl-contrib.jar}"
493           compress="true"
494           basedir="contrib">
495        <patternset refid="abcl.contrib.source"/>
496      </jar>
497      <echo>
498Packaged contribs in ${abcl-contrib.jar}. To use contribs, ensure that
499this file is in the same directory as 'abcl.jar', and then
500
501  CL-USER> (require 'abcl-contrib)
502
503will place all the contribs in the ASDF registry.
504
505To load a contrib, something like
506
507  CL-USER> (require 'jss)
508
509will compile (if necessary) and load JSS.
510</echo>
511    </target>
512
513    <target name="abcl.debug.jpda" depends="abcl.jar">
514      <description>Invoke ABCL with JPDA listener on port 6789</description>
515      <java fork="true"
516            classpathref="abcl.classpath.dist"
517            classname="org.armedbear.lisp.Main">
518        <jvmarg 
519            value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
520      </java>
521      <echo>JPDA listening on localhost:6789</echo>
522    </target>
523
524    <target name="abcl.build.debug.jpda" depends="abcl.compile.java">
525      <description>Invoke ABCL with JPDA listener on port 6789</description>
526      <java fork="true"
527            classpathref="abcl.classpath.build"
528            classname="org.armedbear.lisp.Main">
529        <jvmarg
530            value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
531        <jvmarg value="-Dabcl.home=${abcl.home.dir}${file.separator}"/>
532      </java>
533      <echo>JPDA listening on localhost:6789</echo>
534    </target>
535
536    <target name="abcl.run" depends="abcl.jar">
537      <java fork="true"
538            classpathref="abcl.classpath.dist"
539            classname="org.armedbear.lisp.Main">
540      </java>
541    </target>
542
543    <target name="abcl.clean">
544      <delete dir="${build.dir}"/>
545      <delete file="${abcl.jar.path}"/>
546      <delete file="abcl"/>
547      <delete file="abcl.bat"/>
548    </target>
549
550    <target name="abcl.dist" depends="abcl.jar">
551      <copy file="${abcl.jar.path}"
552            toFile="${dist.dir}/abcl-${abcl.version}.jar"/>
553    </target>
554
555    <target name="abcl.distclean" depends="abcl.clean">
556      <delete dir="${dist.dir}"/>
557      <delete file="abcl"/>
558      <delete file="abcl.bat"/>
559    </target>
560
561    <target name="TAGS">
562      <delete file="TAGS"/>
563      <apply executable="etags" parallel="true" verbose="true" maxparallel="300">
564        <arg value="--append"/>
565        <arg value="--regex=|[ \t]+//[ \t]+###[ \t]+\([^ \t]+\)|\1|"/>
566        <arg value='--regex=|[ \t]*@DocString([ \t]*name=\"\([^\"]*\)|\1|'/>
567        <fileset dir="${src.dir}">
568          <patternset refid="abcl.source.java"/>
569          <patternset refid="abcl.source.lisp"/>
570        </fileset>
571      </apply>
572    </target>
573
574    <patternset id="abcl.dist.misc"
575                description="Additional includes in the source distributions relative to basedir">
576      <include name="build.xml"/>
577      <include name="abcl.properties.in"/>
578      <include name="COPYING"/>
579      <include name="README"/>
580      <include name="CHANGES"/>
581      <include name="abcl.in"/>
582      <include name="abcl.bat.in"/>
583     
584      <include name="examples/**"/>
585
586      <include name="contrib/**"/>
587
588      <include name="build-from-lisp.sh"/>
589     
590      <!-- The remainder of these files are used by the Lisp hosted
591           build in 'build-abcl.lisp' but not used by Ant, so include
592           them in the source distribution. -->
593      <include name="make-jar.in"/>
594      <include name="make-jar.bat.in"/>
595
596
597
598      <include name="build-abcl.lisp"/>
599      <include name="customizations.lisp.in"/>
600
601    </patternset>
602
603    <patternset 
604        id="abcl.source.misc"
605        description="Additional includes in the source distribution relative to source root">
606      <include name="org/armedbear/lisp/LICENSE"/>
607      <include name="manifest-abcl"/>
608      <include name="META-INF/services/javax.script.ScriptEngineFactory"/>
609    </patternset>
610
611    <target name="abcl.source.prepare" depends="abcl.stamp.version">
612      <property name="abcl.build.src.dir"
613                value="${build.dir}/abcl-src-${abcl.version}"/>
614      <mkdir dir="${abcl.build.src.dir}/src"/>
615      <copy todir="${abcl.build.src.dir}/src"
616            preservelastmodified="true">
617        <fileset dir="${src.dir}"
618                 id="abcl.source.src">
619            <patternset refid="abcl.source.java"/>
620            <patternset refid="abcl.source.lisp"/>
621            <patternset refid="abcl.source.misc"/>
622        </fileset>
623      </copy>
624      <copy todir="${abcl.build.src.dir}"
625            preservelastmodified="true">
626        <fileset dir="${basedir}">
627            <patternset refid="abcl.dist.misc"/>
628        </fileset>
629      </copy>
630    </target>
631
632    <!--  Files in source distribution that always get LF EOL (aka
633         'unix') -->   
634    <patternset id="abcl.dist.lf">
635      <include name="abcl.in"/>
636    </patternset>
637
638    <!--  Files in source distribution that always get CRLF EOL (aka
639         'dos') -->   
640    <patternset id="abcl.dist.crlf">
641      <include name="abcl.bat.in"/>
642    </patternset>
643
644    <target name="abcl.source.unix" depends="abcl.source.prepare">
645      <fixcrlf srcdir="${abcl.build.src.dir}"
646               preservelastmodified="true"
647               eol="lf">
648      </fixcrlf>
649
650      <fixcrlf srcdir="${abcl.build.src.dir}"
651               preservelastmodified="true"
652               eol="crlf">
653          <patternset refid="abcl.dist.crlf"/>
654      </fixcrlf>
655
656      <fixcrlf srcdir="${abcl.build.src.dir}"
657               preservelastmodified="true"
658               eol="lf">
659          <patternset refid="abcl.dist.lf"/>
660      </fixcrlf>
661    </target>
662
663    <target name="abcl.source.tar" depends="abcl.source.unix">
664      <mkdir dir="${dist.dir}"/>
665      <tar destfile="${dist.dir}/abcl-src-${abcl.version}.tar.gz"
666           compression="gzip">
667        <tarfileset dir="${build.dir}">
668          <include name="abcl-src-${abcl.version}/**"/>
669        </tarfileset>
670      </tar>
671    </target>
672
673    <target name="abcl.source.windows" depends="abcl.source.prepare">
674      <fixcrlf srcdir="${abcl.build.src.dir}"
675               preservelastmodified="true"
676               eol="crlf">
677      </fixcrlf>
678
679      <fixcrlf srcdir="${abcl.build.src.dir}"
680               preservelastmodified="true"
681               eol="crlf">
682          <patternset refid="abcl.dist.crlf"/>
683      </fixcrlf>
684
685      <fixcrlf srcdir="${abcl.build.src.dir}"
686               preservelastmodified="true"
687               eol="lf">
688          <patternset refid="abcl.dist.lf"/>
689      </fixcrlf>
690    </target>
691
692    <target name="abcl.source.zip" depends="abcl.source.windows">
693      <mkdir dir="${dist.dir}"/>
694      <zip destfile="${dist.dir}/abcl-src-${abcl.version}.zip"
695           compress="true">
696        <zipfileset dir="${abcl.build.src.dir}" prefix="abcl-src-${abcl.version}"/>
697      </zip>
698    </target>
699
700    <target name="abcl.source.jar" depends="abcl.source.unix">
701      <mkdir dir="${dist.dir}"/>
702      <jar destfile="${dist.dir}/abcl-${abcl.version}-sources.jar">
703        <metainf dir="${abcl.build.src.dir}">
704          <include name="COPYING"/>
705        </metainf>
706        <fileset dir="${abcl.build.src.dir}/src">
707          <include name="**/*.java"/>
708          <include name="**/*.lisp"/>
709        </fileset>
710      </jar>
711    </target>
712
713    <property name="abcl.javadoc.dir" value="${build.dir}/javadoc"/>
714
715    <target name="abcl.javadoc">
716      <mkdir dir="${abcl.javadoc.dir}"/>
717      <javadoc destdir="${abcl.javadoc.dir}"
718               sourcepath="${src.dir}"/>
719    </target>
720   
721    <target name="abcl.javadoc.jar" depends="abcl.stamp.version,abcl.javadoc">
722      <mkdir dir="${dist.dir}"/>
723      <jar destfile="${dist.dir}/abcl-${abcl.version}-javadoc.jar">
724        <fileset dir="${abcl.javadoc.dir}"/>
725      </jar>
726    </target>
727
728    <target name="abcl.binary.prepare" depends="abcl.jar,abcl.contrib,abcl.stamp.version">
729      <property name="abcl.build.binary.dir"
730                value="${build.dir}/abcl-bin-${abcl.version}"/>
731      <mkdir dir="${abcl.build.binary.dir}"/>
732      <copy todir="${abcl.build.binary.dir}"
733            preservelastmodified="true">
734        <fileset dir="${basedir}/dist">
735          <patternset>
736            <include name="abcl.jar"/>
737            <include name="abcl-contrib.jar"/>
738          </patternset>
739        </fileset>
740        <fileset dir="${basedir}">
741          <patternset>
742            <include name="README"/>
743            <include name="CHANGES"/>
744          </patternset>
745        </fileset>
746      </copy>
747    </target>
748
749    <target name="abcl.binary.tar" depends="abcl.binary.prepare">
750      <tar destfile="${dist.dir}/abcl-bin-${abcl.version}.tar.gz"
751           compression="gzip">
752        <tarfileset dir="${build.dir}">
753          <include name="abcl-bin-${abcl.version}/**"/>
754          </tarfileset>
755      </tar>
756    </target>
757
758    <target name="abcl.binary.zip" depends="abcl.binary.prepare">
759      <zip destfile="${dist.dir}/abcl-bin-${abcl.version}.zip"
760           compress="true">
761        <zipfileset dir="${abcl.build.binary.dir}" prefix="abcl-bin-${abcl.version}"/>
762      </zip>
763    </target>
764
765    <target name="help.test">
766      <echo>
767The following Ant targets run various test suites:
768 
769  abcl.test
770    --  Run all available tests.
771  abcl.test.java
772    --  Run the ABCL junit Java tests under ${basedir}/test/src
773  abcl.test.lisp
774    --  Run the 'test.ansi.compiled', 'test.abcl', 'test.cl-bench' targets
775  test.ansi.compiled
776    --  Run the compiled version of the ANSI test suite
777  test.abcl
778    --  Run the Lisp RT tests collected in ${basedir}/test/lisp/abcl
779  test.cl-bench
780    --  Run the cl-bench test suite.
781
782The ANSI tests require that the [ansi-tests][1] be manually installed in
783${basedir}/../ansi-tests.
784
785[1]: svn://common-lisp.net/project/ansi-test/svn/trunk/ansi-tests
786
787The CL-BENCH tests require that [cl-bench][2] be manually installed in
788${basedir}/../cl-bench
789
790[2]: http://www.chez.com/emarsden/downloads/cl-bench.tar.gz
791      </echo>
792    </target>
793
794    <property name="abcl.test.classes.dir"
795              value="${build.dir}/classes-test"/>
796
797    <property name="abcl.test.src.dir"
798              value="${basedir}/test/src"/>
799
800    <patternset id="abcl.test.source.java">
801      <!-- For now, we list tests explicitly, because we have to
802           enumerate them later to the JUnit test runner. -->
803      <include name="org/armedbear/lisp/*.java"/>
804    </patternset>
805
806    <property name="junit.path"
807              value="${abcl.ext.dir}/junit-4.8.1.jar"/>
808
809
810    <path id="abcl.test.compile.classpath">
811      <pathelement location="${junit.path}"/>
812      <pathelement location="${build.classes.dir}"/>
813    </path>
814
815    <target name="abcl.test.pre-compile" depends="abcl.ext"/>
816
817    <target name="abcl.ext.p">
818      <!--XXX generalize over enumeration of all contributions to
819           abcl.ext if we get more of them.  -->
820      <available file="${junit.path}" property="abcl.ext.p"/>
821    </target>
822    <target name="abcl.ext" depends="abcl.ext.p" unless="abcl.ext.p">
823
824      <mkdir dir="${abcl.ext.dir}"/>
825      <get 
826          src="http://cloud.github.com/downloads/KentBeck/junit/junit-4.8.1.jar"
827          usetimestamp="true"
828          dest="${junit.path}"/>
829    </target>
830       
831    <target name="abcl.test.compile" 
832            depends="abcl.test.pre-compile">
833      <mkdir dir="${abcl.test.classes.dir}"/>
834      <javac destdir="${abcl.test.classes.dir}"
835             classpathref="abcl.test.compile.classpath"
836             debug="true"
837             target="1.5">
838        <src path="${abcl.test.src.dir}"/>
839        <patternset refid="abcl.test.source.java"/>
840      </javac>
841    </target>
842
843    <path id="abcl.test.run.classpath">
844      <path refid="abcl.test.compile.classpath"/>
845      <pathelement location="${abcl.test.classes.dir}"/>
846    </path>
847
848    <target name="abcl.test" 
849            depends="abcl.test.java,abcl.test.lisp"/>
850       
851    <target name="abcl.test.java" depends="abcl.test.compile">
852      <java fork="true"
853            classpathref="abcl.test.run.classpath"
854            classname="org.junit.runner.JUnitCore">
855        <arg value="org.armedbear.lisp.PathnameTest"/>
856        <arg value="org.armedbear.lisp.StreamTest"/>
857        <arg value="org.armedbear.lisp.UtilitiesTest"/>
858      </java>
859    </target>
860
861    <target name="abcl.test.lisp" 
862            depends="test.ansi.compiled,test.abcl,test.cl-bench"/>
863
864    <target name="test.ansi.interpreted" depends="abcl.jar">
865      <echo>Recording test output in ${abcl.test.log.file}.</echo>
866      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
867      <java fork="true" dir="${basedir}"
868            classpathref="abcl.classpath.dist"
869            classname="org.armedbear.lisp.Main">
870        <arg value="--noinit"/> 
871        <arg value="--eval"/><arg value="(require (quote asdf))"/>
872        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
873        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :ansi-interpreted)"/>
874        <arg value="--eval"/><arg value="(ext:exit)"/>
875      </java>
876      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
877      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
878    </target>
879
880    <target name="test.ansi.compiled" depends="abcl.jar">
881      <echo>Recording test output in ${abcl.test.log.file}.</echo>
882      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
883      <java fork="true" dir="${basedir}"
884            classpathref="abcl.classpath.dist"
885            classname="org.armedbear.lisp.Main">
886        <arg value="--noinit"/> 
887        <arg value="--eval"/><arg value="(require (quote asdf))"/>
888        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
889        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :ansi-compiled)"/>
890        <arg value="--eval"/><arg value="(ext:exit)"/>
891      </java>
892      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
893      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
894    </target>
895
896    <target name="test.abcl" depends="abcl.jar">
897      <echo>Recording test output in ${abcl.test.log.file}.</echo>
898      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
899      <java fork="true" dir="${basedir}"
900            classpathref="abcl.classpath.dist"
901            classname="org.armedbear.lisp.Main">
902        <arg value="--noinit"/> 
903        <arg value="--eval"/><arg value="(require (quote asdf))"/>
904        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
905        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :abcl-test-lisp)"/>
906        <arg value="--eval"/><arg value="(ext:exit)"/>
907      </java>
908      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
909      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
910    </target>
911
912    <target name="test.cl-bench" depends="abcl.jar">
913      <echo>Recording test output in ${abcl.test.log.file}.</echo>
914      <record name="${abcl.test.log.file}" emacsmode="true" action="start" append="yes"/>
915      <java fork="true" dir="${basedir}"
916            classpathref="abcl.classpath.dist"
917            classname="org.armedbear.lisp.Main">
918        <arg value="--noinit"/> 
919        <arg value="--eval"/><arg value="(require (quote asdf))"/>
920        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:load-op) :abcl)"/>
921        <arg value="--eval"/><arg value="(asdf:operate (quote asdf:test-op) :cl-bench)"/>
922        <arg value="--eval"/><arg value="(ext:exit)"/>
923      </java>
924      <record name="${abcl.test.log.file}" emacsmode="true" action="stop"/>
925      <echo>Finished recording test output in ${abcl.test.log.file}.</echo>
926    </target>
927   
928    <target name="abcl.release" 
929            depends="abcl.binary.tar,abcl.source.tar,abcl.binary.zip,abcl.source.zip">
930      <copy file="${abcl.jar.path}"
931            tofile="${dist.dir}/abcl-${abcl.version}.jar"/>
932      <copy file="${abcl-contrib.jar}"
933            tofile="${dist.dir}/abcl-contrib-${abcl.version}.jar"/>
934    </target>
935
936    <import file="netbeans-build.xml" optional="true"/> 
937<!--    <import file="j-build.xml" optional="true"/>  -->
938    <import file="not.org-build.xml" optional="true"/> 
939</project>
940
941
942
943
Note: See TracBrowser for help on using the repository browser.