source: tags/1.0.0/abcl/build.xml

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

Don't warn if compiling under Java 7 as it seems to work fine.

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