Changeset 11570


Ignore:
Timestamp:
01/19/09 14:12:06 (13 years ago)
Author:
Mark Evenson
Message:

Refactored Ant-based build to decrease compilation time.

<antcall> targets are *always* invoked, so refactoring these out them
enables 'abcl.stamp' to not doubly invoke compile.lisp.

Remove odd references to J.

'abcl.init' replaces 'abcl.pre-compile' for aesthetic reasons.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/build.xml

    r11546 r11570  
    22<project xmlns="antlib:org.apache.tools.ant"
    33   name="abcl-master" default="help" basedir=".">
    4     <description>Armed Bear Common Lisp</description>
     4    <description>Compiling, testing, and packaging Armed Bear Common Lisp</description>
    55
    66    <target name="abcl" depends="abcl.wrapper"/>
     
    2020    <property name="abcl.ext.dir"
    2121        value="${basedir}/ext"/>
    22 
    2322
    2423    <target name="help">
     
    3938    </target>
    4039
    41     <property name="abcl.version.path"
    42         value="${build.classes.dir}/org/armedbear/lisp/version"/>
    43     <property name="abcl.build.path"
    44         value="${build.classes.dir}/org/armedbear/lisp/build"/>
    45 
    46     <target name="abcl.stamp" depends="abcl.compile">
     40    <patternset id="abcl.source.java">
     41      <include name="org/armedbear/lisp/*.java"/>
     42      <include name="org/armedbear/lisp/util/*.java"/>
     43    </patternset>
     44
     45    <patternset id="abcl.source.lisp">
     46      <include name="org/armedbear/lisp/*.lisp"/>
     47      <include name="org/armedbear/lisp/tests/*.lisp"/>
     48      <exclude name="org/armedbear/lisp/j.lisp"/>
     49    </patternset>
     50
     51    <patternset id="abcl.scripting.source.java">
     52      <include name="org/armedbear/lisp/scripting/*.java"/>
     53      <include name="org/armedbear/lisp/scripting/util/*.java"/>
     54    </patternset>
     55
     56    <patternset id="abcl.scripting.source.lisp">
     57      <include name="org/armedbear/lisp/scripting/lisp/*.lisp"/>
     58    </patternset>
     59
     60    <!-- Lisp files required at runtime -->
     61    <patternset id="abcl.source.lisp.dist">
     62      <include name="org/armedbear/lisp/boot.lisp"/>
     63    </patternset>
     64
     65    <patternset id="abcl.objects">
     66      <include name="org/armedbear/lisp/*.class"/>
     67      <include name="org/armedbear/lisp/util/*.class"/>
     68      <include name="org/armedbear/lisp/*.cls"/>
     69      <include name="org/armedbear/lisp/*.abcl"/>
     70      <patternset refid="abcl.source.lisp.dist"/>
     71    </patternset>
     72   
     73    <path id="abcl.classpath.dist">
     74      <pathelement location="${abcl.jar.path}"/>
     75    </path>
     76   
     77    <path id="abcl.classpath.build">
     78      <pathelement location="${build.classes.dir}"/>
     79    </path>
     80
     81    <target name="abcl.compile" depends="abcl.compile.lisp">
     82      <echo>Compiled ABCL with Java version: ${java.version}</echo>
     83    </target>
     84
     85    <target name="abcl.init">
    4786      <tstamp>
    48          <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
     87  <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
    4988      </tstamp>
    50       <mkdir dir="${abcl.build.path}/.."/>
    51       <echo message="${build}" file="${abcl.build.path}"/>   
     89
     90      <!--- antversion fails in ant 1.7.1 <antversion property="ant.version"
     91                                                atleast="1.7"/> -->
     92      <property name="java.path"
     93    value="${java.home}/bin/java"/>
     94
     95      <!-- Deprecated. Two main types of build environents: 'unix' or 'windows'. -->
    5296      <condition property="unix">
    5397  <or>
     
    56100  </or>
    57101      </condition>
    58 
    59       <condition property="windows"> <os family="windows"/></condition>
    60 
     102      <condition property="windows">
     103  <os family="windows"/>
     104      </condition>
     105
     106      <!-- Deprecated. -->
    61107      <available file="${src.dir}org/armedbear/lisp/Interpreter.java"
    62108     property="abcl.lisp.p"/>
    63109
    64       <antcall target="abcl.stamp.version"/>
    65       <antcall target="abcl.stamp.hostname"/>
    66     </target>
    67 
    68     <target name="abcl.stamp.version" depends="abcl.compile">
    69       <java fork="true"
    70       classpath="${build.classes.dir}"
    71       outputproperty="abcl.version"
    72       classname="org.armedbear.lisp.Main">
    73   <arg value="--noinit"/>
    74   <arg value="--noinform"/>
    75   <arg value="--eval"/>
    76   <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
    77       </java>
    78 
    79       <echo>Building ABCL version: ${abcl.version}</echo>
    80       <mkdir dir="${abcl.version.path}/.."/>
    81       <echo message="${abcl.version}" file="${abcl.version.path}"/>
    82 
    83       <!-- Set from commandline via -D or in 'build.properties' -->
    84       <property name="build.version" value="abcl.svn"/>
    85       <echo>Implementation-Source: ${version.src}</echo>
    86     </target>
    87 
    88     <target name="abcl.stamp.hostname">
    89       <exec executable="hostname" outputproperty="abcl.hostname"/>
    90       <echo>abcl.hostname: ${abcl.hostname}</echo>
    91     </target>
    92 
    93     <patternset id="abcl.source.java">
    94       <include name="org/armedbear/lisp/*.java"/>
    95       <include name="org/armedbear/lisp/util/*.java"/>
    96     </patternset>
    97 
    98     <patternset id="abcl.source.lisp">
    99       <include name="org/armedbear/lisp/*.lisp"/>
    100       <include name="org/armedbear/lisp/tests/*.lisp"/>
    101     </patternset>
    102 
    103     <patternset id="abcl.scripting.source.java">
    104       <include name="org/armedbear/lisp/scripting/*.java"/>
    105       <include name="org/armedbear/lisp/scripting/util/*.java"/>
    106     </patternset>
    107 
    108     <patternset id="abcl.scripting.source.lisp">
    109       <include name="org/armedbear/lisp/scripting/lisp/*.lisp"/>
    110     </patternset>
    111 
    112     <!-- Lisp files required at runtime -->
    113     <patternset id="abcl.source.lisp.dist">
    114       <include name="org/armedbear/lisp/boot.lisp"/>
    115     </patternset>
    116 
    117     <patternset id="abcl.objects">
    118       <include name="org/armedbear/lisp/*.class"/>
    119       <include name="org/armedbear/lisp/util/*.class"/>
    120       <include name="org/armedbear/lisp/*.cls"/>
    121       <include name="org/armedbear/lisp/*.abcl"/>
    122       <patternset refid="abcl.source.lisp.dist"/>
    123     </patternset>
    124    
    125     <path id="abcl.classpath.dist">
    126       <pathelement location="${abcl.jar.path}"/>
    127     </path>
    128    
    129     <path id="abcl.classpath.build">
    130       <pathelement location="${build.classes.dir}"/>
    131     </path>
    132 
    133     <target name="abcl.compile" depends="abcl.pre-compile,abcl.compile.lisp">
    134       <echo>Compiled ABCL with java version: ${java.version}</echo>
    135     </target>
    136 
    137     <target name="abcl.pre-compile">
    138       <!--- antversion fails in ant 1.7.1 <antversion property="ant.version"
    139                                                 atleast="1.7"/> -->
    140       <mkdir dir="${build.dir}"/>
    141       <mkdir dir="${build.classes.dir}"/>
    142 
    143       <property name="java.path"
    144     value="${java.home}/bin/java"/>
    145 
    146       <exec executable="hostname" os="unix"
    147       outputproperty="abcl.compile.hostname"/>
    148       <exec executable="uname" os="unix"
    149       outputproperty="abcl.compile.uname">
    150   <arg value="-a"/>
    151       </exec>
    152 
    153       <exec executable="hostname" os="Linux" outputproperty="hostname"/>
    154 
    155       <condition property="abcl.java.version">
     110      <echo>java.version: ${java.version}</echo>
     111      <condition property="abcl.java.version.p">
    156112  <or>
    157113    <matches string="${java.version}" pattern="1\.5"/>
     
    159115  </or> 
    160116      </condition>
    161       <echo>java.version: ${java.version}</echo>
     117
     118      <!-- Set from commandline via -D or in 'build.properties' -->
     119      <property name="build.version" value="abcl.svn"/>
     120      <echo>Implementation-Source: ${version.src}</echo>
     121
    162122    </target>
    163123   
    164124    <target name="abcl.java.warning"
    165       depends="abcl.pre-compile"
    166       unless="abcl.java.version">
    167       <echo>WARNING: Java version ${java.version} not recommended.</echo>
     125      depends="abcl.init"
     126      unless="abcl.java.version.p">
     127      <echo>WARNING: Use of Java version ${java.version} not recommended.</echo>
    168128    </target>
    169129 
    170130    <target name="abcl.compile.java"
    171       depends="abcl.pre-compile,abcl.java.warning">
    172       <tstamp>
    173   <format property="build" pattern="EEE MMM dd yyyy HH:mm:ss zzz"/>
    174       </tstamp>
    175 
     131      depends="abcl.init,abcl.java.warning">
     132      <mkdir dir="${build.dir}"/>
     133      <mkdir dir="${build.classes.dir}"/>
    176134      <javac destdir="${build.classes.dir}"
    177135       debug="true"
     
    194152    <!-- Adjust the patternset for ABCL source to use the much faster
    195153         Ant 'uptodate' task to check if we need to compile the system
    196          fasls. -->
     154         fasls.  Highly inter-dependent with the behavior specified in
     155         'compile-system.lisp'.-->
    197156    <patternset id="abcl.source.lisp.fasls">
    198157      <patternset refid="abcl.source.lisp"/>
     
    225184    </target>
    226185
    227     <target name="abcl.jar" depends="abcl.compile,abcl.stamp">
     186    <property name="abcl.build.path"
     187        value="${build.classes.dir}/org/armedbear/lisp/build"/>
     188    <target name="abcl.stamp" depends="abcl.compile,abcl.stamp.version,abcl.stamp.hostname">
     189      <mkdir dir="${abcl.build.path}/.."/>
     190      <echo message="${build}" file="${abcl.build.path}"/>   
     191    </target>
     192
     193    <property name="abcl.version.path"
     194        value="${build.classes.dir}/org/armedbear/lisp/version"/>
     195    <target name="abcl.stamp.version" depends="abcl.compile">
     196      <!-- Determine which ABCL version we have just built by parsing
     197           the output of LISP-IMPLEMENTATION-VERSION. -->
     198      <java fork="true"
     199      classpath="${build.classes.dir}"
     200      outputproperty="abcl.version"
     201      classname="org.armedbear.lisp.Main">
     202  <arg value="--noinit"/>
     203  <arg value="--noinform"/>
     204  <arg value="--eval"/>
     205  <arg value="(progn (format t (lisp-implementation-version)) (finish-output) (quit))"/>
     206      </java>
     207
     208      <echo>Built ABCL version: ${abcl.version}</echo>
     209      <mkdir dir="${abcl.version.path}/.."/>
     210      <echo message="${abcl.version}" file="${abcl.version.path}"/>
     211    </target>
     212
     213    <target name="abcl.stamp.hostname" if="unix">
     214      <exec executable="hostname" outputproperty="abcl.hostname"/>
     215      <echo>abcl.hostname: ${abcl.hostname}</echo>
     216    </target>
     217
     218    <target name="abcl.jar" depends="abcl.stamp">
    228219      <mkdir dir="${dist.dir}"/>
    229220      <loadfile property="abcl.version"
     
    242233      <attribute name="Implementation-Build"
    243234           value="${build}"/>
    244       <attribute name="Build-Version"
    245            value="${version}"/>
     235      <attribute name="Implementation-Source"
     236           value="${version.src}"/>
    246237    </section>
    247238  </manifest>
     
    249240    </target>
    250241   
    251     <target name="abcl.debug.jpda" depends="abcl.jar">
    252       <description>Invoke ABCL with JPDA listener on port 6789</description>
    253       <java fork="true"
    254       classpathref="abcl.classpath.dist"
    255       classname="org.armedbear.lisp.Main">
    256   <jvmarg
    257       value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
    258       </java>
    259     </target>
    260 
    261     <target name="abcl.run" depends="abcl.jar">
    262       <java fork="true"
    263       classpathref="abcl.classpath.dist"
    264       classname="org.armedbear.lisp.Main">
    265       </java>
    266     </target>
    267 
    268242    <target name="abcl.wrapper"
    269243      depends="abcl.jar,abcl.wrapper.unix,abcl.wrapper.windows">
     
    293267      </copy>
    294268      <chmod file="${abcl.wrapper.file}" perm="a+x"/>
     269
     270      <echo>Created executable ABCL wrapper in '${abcl.wrapper.file}'</echo>
    295271      <echo>N.B. This wrapper requires '${abcl.jar.path}' not be moved.</echo>
    296272    </target>
     
    306282    </target>
    307283
     284    <target name="abcl.debug.jpda" depends="abcl.jar">
     285      <description>Invoke ABCL with JPDA listener on port 6789</description>
     286      <java fork="true"
     287      classpathref="abcl.classpath.dist"
     288      classname="org.armedbear.lisp.Main">
     289  <jvmarg
     290      value="-agentlib:jdwp=transport=dt_socket,address=6789,server=y"/>
     291      </java>
     292    </target>
     293
     294    <target name="abcl.run" depends="abcl.jar">
     295      <java fork="true"
     296      classpathref="abcl.classpath.dist"
     297      classname="org.armedbear.lisp.Main">
     298      </java>
     299    </target>
     300
    308301    <target name="abcl.clean">
    309302      <delete dir="${build.dir}"/>
     303      <delete file="${abcl.jar.path}"/>
    310304      <delete file="abcl"/>
     305      <delete file="abcl.bat"/>
    311306    </target>
    312307
     
    319314      <delete dir="${dist.dir}"/>
    320315      <delete file="abcl"/>
    321       <delete file="j"/>
     316      <delete file="abcl.bat"/>
    322317    </target>
    323318
     
    340335      <include name="abcl.bat.in"/>
    341336     
    342       <!-- The remainder of these files are used by BUILD-ABCL to
    343            build ABCL from Lisp but not used by Ant, include them in
    344            the source distribution. -->
     337      <!-- The remainder of these files are used by the Lisp hosted
     338           build in 'build-abcl.lisp' but not used by Ant, so include
     339           them in the source distribution. -->
    345340      <include name="make-jar.in"/>
    346341      <include name="make-jar.bat.in"/>
     
    361356    <target name="abcl.source.prepare" depends="abcl.stamp.version">
    362357      <property name="abcl.source.eol" value="asis"/>
    363       <echo>Using '${abcl.source.eol}' to drive line-ending transformations.</echo>
     358      <echo>Using abcl.source.eol='${abcl.source.eol}' to drive
     359      source code line-ending transformations.</echo>
    364360      <property name="abcl.build.src.dir"
    365361    value="${build.dir}/abcl-src-${abcl.version}"/>
Note: See TracChangeset for help on using the changeset viewer.