<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- --> <!-- ========================================================================= --> <!-- Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC), --> <!-- 2003-2005 Contributors --> <!-- All rights reserved. --> <!-- This program and the accompanying materials are made available --> <!-- under the terms of the Common Public License v1.0 --> <!-- which accompanies this distribution and is available at --> <!-- http://www.eclipse.org/legal/cpl-v10.html --> <!-- --> <!-- Contributors: (See CVS checkin's) --> <!-- Xerox/PARC initial implementation --> <!-- Adrian Colyer / George Harley eclipse plugin targets --> <!-- ========================================================================= --> <project name="build" default="all" basedir="."> <target name="all" depends="aspectj"> <antcall target="eclipse.plugins"/> </target> <target name="clean" depends="clean-directories"/> <target name="compile" depends="build-module" description="compile module ${module.name} (without tests, by default)"/> <target name="compile-tests" depends="init" description="compile module ${module.name} tests"> <assemble-module-test module="${module.name}"/> </target> <target name="test" depends="compile-tests"> <antcall target="do-test-junit"/> </target> <!-- ===================================================================== --> <!-- Init --> <!-- ===================================================================== --> <property name="modules.dir" location="${basedir}/.."/> <property name="module.name" value="${ant.project.name}"/> <import file="${modules.dir}/build/build-properties.xml"/> <target name="init" depends="init-properties,init-directories"> <property name="build.config" value=""/> <property name="trim.testing.default" value="true"/> <property name="aj.installer.jar" location="${aj.dist.dir}/aspectj-${build.version.long}.jar"/> <available property="ant.lib.aspectjtools" file="${ant.home}/lib/aspectjtools.jar" value="Expect classpath errors from ${ant.home}/lib/aspectjtools.jar"/> <available property="ant.lib.aspectjrt" file="${ant.home}/lib/aspectjrt.jar" value="Expect classpath errors from ${ant.home}/lib/aspectjrt.jar"/> <available property="testing.drivers.all.available" file="${aj.jar.dir}/testing-drivers-all.jar" value="${aj.jar.dir}/testing-drivers-all.jar"/> </target> <target name="version-uptodate" depends="init,init-taskdefs" unless="version-uptodate.done"> <!-- XXX change task to pre-check & avoid scan if dates uptodate --> <versionuptodate version="${build.version}" versionSourceFile="${aspectj.modules.dir}/bridge/src/org/aspectj/bridge/Version.java" versionTagFile="${aj.temp.dir}/versionUptodate"/> <available file="${aj.temp.dir}/versionUptodate" property="version.uptodate"/> <property name="version-uptodate.done" value="done"/> </target> <target name="init-version" depends="init,init-filters,version-uptodate" > <antcall target="init-filters"/> <copy file="${aspectj.modules.dir}/build/lib/BridgeVersion.java.txt" tofile="${aspectj.modules.dir}/bridge/src/org/aspectj/bridge/Version.java" overwrite="yes" filtering="yes"/> <property name="init.version.done" value="done"/> <!-- consider checking this in? --> </target> <!-- ===================================================================== --> <!-- Misc setup and warnings --> <!-- ===================================================================== --> <target name="warn.ant.lib.aspectjrt" if="ant.lib.aspectjrt"> <echo message="----- WARNING: ${ant.lib.aspectjrt}" /> </target> <target name="warn.ant.lib.aspectjtools" if="ant.lib.aspectjtools"> <echo message="----- WARNING: ${ant.lib.aspectjtools}" /> </target> <target name="fail-unless-boot-libraries-uptodate" depends="init" description="fail unless all boot libraries are up-to-date"> <antcall target="verify-boot-lib"> <param name="boot.lib" value="test/aspectjrt.jar"/> <param name="vbl.module.name" value="runtime"/> </antcall> <antcall target="verify-boot-lib"> <param name="boot.lib" value="build/build.jar"/> <param name="vbl.module.name" value="build"/> </antcall> <antcall target="verify-boot-lib"> <param name="boot.lib" value="test/testing-client.jar"/> <param name="vbl.module.name" value="testing-client"/> </antcall> <echo message="fyi, bridge/util changes rarely mean client is invalid"/> <antcall target="verify-boot-lib"> <param name="boot.lib" value="test/testing-client.jar"/> <param name="vbl.module.name" value="util"/> </antcall> <antcall target="verify-boot-lib"> <param name="boot.lib" value="test/testing-client.jar"/> <param name="vbl.module.name" value="bridge"/> </antcall> <echo message="all boot libraries verified"/> </target> <target name="update-tree" depends="init" description="update tree"> <fail unless="CVSROOT" message="required: {ant} -DCVSROOT=... ..."/> <cvs cvsRoot="${CVSROOT}" dest="${aspectj.modules.dir}" quiet="on" failonerror="on" command="update -dP" /> </target> <!-- ===================================================================== --> <!-- antcall targets --> <!-- ===================================================================== --> <target name="build-product" depends="init,init-taskdefs,init-version" description="build $${product.name}"> <ajbuild jarDir="${aj.jar.dir}" baseDir="${aspectj.modules.dir}" distDir="${aj.dist.dir}" productDir="${aspectj.modules.dir}/build/products/${product.name}" trimTesting="true" buildConfig="${build.config}" version="${build.version.long}" verbose="${build.verbose}" failonerror="true"/> </target> <target name="build-module" depends="init,init-taskdefs,init-version"> <ajbuild module="${module.name}" baseDir="${aspectj.modules.dir}" distDir="${aj.dist.dir}" jarDir="${aj.jar.dir}" trimTesting="${trim.testing}" buildConfig="${build.config}" version="${build.version.long}" verbose="${build.verbose}" assembleall="${assemble}" failonerror="true"/> </target> <macrodef name="build-module-all"> <attribute name="module"/> <attribute name="trimTesting" default="${trim.testing.default}"/> <sequential> <antcall target="build-module"> <param name="module.name" value="@{module}"/> <param name="trim.testing" value="@{trimTesting}"/> <param name="assemble" value="true"/> </antcall> </sequential> </macrodef> <macrodef name="build-module"> <attribute name="module"/> <attribute name="trimTesting" default="${trim.testing.default}"/> <attribute name="assemble" default="false"/> <sequential> <antcall target="build-module"> <param name="module.name" value="@{module}"/> <param name="trim.testing" value="@{trimTesting}"/> <param name="assemble" value="@{assemble}"/> </antcall> </sequential> </macrodef> <macrodef name="assemble-module-test"> <attribute name="module"/> <sequential> <build-module module="@{module}" assemble="true" trimTesting="false"/> </sequential> </macrodef> <target name="create-installer" depends="init,init-taskdefs,init-filters" description="create ${installer.file} from ${staging.dir} using ${htmlSrc.dir} and ${simpleClassName}"> <!-- init-filters: filter on copy used by ajinstaller taskdef --> <delete quiet="on" file="${installer.file}"/> <ajinstaller zipfile="${installer.file}" installerclassjar="${aspectj.build.jar}" basedir="${staging.dir}" mainclass="$$installer$$.org.aspectj.${simpleClassName}" htmlSrc="${htmlSrc.dir}" resourcesSrc="${aspectj.modules.build.dir}/installer-resources"/> </target> <target name="verify-boot-lib" depends="init" description="fail if ${boot.lib} is out of date wrt ${vbl.module.name}"> <uptodate property="lib-warning-${vbl.module.name}" targetfile="${aspectj.modules.dir}/lib/${boot.lib}"> <srcfiles dir="${aspectj.modules.dir}/${vbl.module.name}/src" includes="**/*.java"/> </uptodate> <fail unless="lib-warning-${vbl.module.name}" message="${boot.lib} out of date wrt module ${vbl.module.name}"/> </target> <!-- ===================================================================== --> <!-- test targets --> <!-- ===================================================================== --> <target name="test-run-all-junit-tests" depends="init" description="run unit tests via run-all-junit-tests module"> <antcall target="test"> <param name="module.name" value="run-all-junit-tests"/> </antcall> </target> <target name="test-compiler-tests" depends="init" description="run compiler tests via tests module"> <antcall target="test"> <param name="module.name" value="tests"/> </antcall> </target> <target name="test-each-module" depends="init" description="run JUnit tests for each module"> <subant target="test"> <filelist dir="${aspectj.modules.dir}" files="${aspectj.tools.modules},${aspectj.test.modules}"/> </subant> </target> <target name="junitreport" depends="init,init-taskdefs" if="junitreport.available"> <clean-dir dir="${aj.junit.dir}/html"/> <junitreport todir="${aj.junit.dir}/html"> <fileset dir="${aj.junit.dir}"> <include name="**/TEST-*.xml"/> </fileset> <report format="frames" todir="${aj.junit.dir}/html"/> </junitreport> <pathconvert property="jur.url" targetos="unix"> <path location="${aj.junit.dir}/html/index.html"/> </pathconvert> <echo message="see file:${jur.url}"/> </target> <target name="do-test-junit" depends="init-taskdefs" description="run junit tests for a module using module root or leaves"> <property name="dtj.dir" location="${aj.junit.dir}/${module.name}"/> <mkdir dir="${dtj.dir}"/> <condition property="dtj.includes" value="${junit.includes}" else="${junit.rootSuites}"> <istrue value="${junit.leaves}"/> </condition> <condition property="dtj.excludes" value="${junit.excludes}" else=""> <istrue value="${junit.leaves}"/> </condition> <junit dir="${aspectj.modules.build.dir}" failureproperty="test-junit-${module.name}.failed" fork="on" forkmode="perTest" maxmemory="400m" includeAntRuntime="off" printsummary="yes" haltonfailure="${haltOnTestFailure}" > <classpath> <pathelement location="${aj.jar.dir}/${module.name}-test-all.jar"/> <!-- see skipped libraries in Builder.properties --> <pathelement location="${jdk.tools.jar}"/> <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar"/> <!-- XML api's used by loadtime, also needed when running under 1.3 per Ant FAQ --> <fileset dir="${aspectj.modules.lib.dir}/ant/lib" includes="ant.jar,ant-junit.jar,xml-apis.jar,xercesImpl.jar"/> </classpath> <jvmarg value="-Daspectjrtpath=${lib.test.aspectjrt.jar}" /> <formatter type="xml"/> <batchtest todir="${dtj.dir}"> <fileset dir="${modules.dir}/${module.name}/testsrc" includes="${dtj.includes}" excludes="${dtj.excludes}"/> </batchtest> </junit> <report-if-failed text="JUnit tests for ${module.name} failed" property="test-junit-${module.name}.failed"/> </target> <!-- ===================================================================== --> <!-- custom targets --> <!-- ===================================================================== --> <target name="build-harness-jar" depends="init" description="build harness jar from scratch"> <antcall target="clean-jars"/> <assemble-module-test module="testing-drivers"/> </target> <target name="build-testing-jars" depends="init" description="build testing jars from scratch"> <antcall target="build-harness-jar"/> </target> <target name="build-testing-client" depends="init-taskdefs,init"> <build-module module="testing-client" assemble="true"/> <assemble-module-test module="testing-client"/> <echo> To use testing client jar in tests, mv ../aj-build/jars/testing-client-all.jar ../lib/tests/testing-client.jar </echo> </target> <target name="aspectj" depends="init,aspectjtools-dist,docs-dist" description="create installer from local distributions"> <property name="installer.staging.dir" location="${aj.temp.dir}/installer-staging"/> <clean-dir dir="${installer.staging.dir}"/> <copy todir="${installer.staging.dir}"> <fileset dir="${aj.dist.dir}/tools"/> <fileset dir="${aj.dist.dir}/docs"/> </copy> <antcall target="create-installer"> <param name="installer.file" location="${aj.installer.jar}"/> <param name="staging.dir" location="${installer.staging.dir}"/> <param name="htmlSrc.dir" location="${aspectj.modules.build.dir}/products/aspectj/install"/> <param name="simpleClassName" value="ToolsInstaller"/> </antcall> <delete dir="${installer.staging.dir}"/> </target> <target name="docs-dist" depends="init"> <ant dir="${aspectj.modules.dir}/docs" antfile="build.xml" target="local-dist" inheritAll="false"/> </target> <target name="aspectjrt" depends="init" description="build aspectjrt.jar (differently than release)"> <build-module-all module="aspectj5rt"/> <copy file="${aj.jar.dir}/aspectj5rt-all.jar" tofile="${aj.jar.dir}/aspectjrt.jar"/> </target> <target name="compile-runtime-11" depends="init-properties" description="compile runtime under 1.1 - fails, but by how much?"> <condition property="cr1.in13"> <equals arg1="1.3" arg2="${ant.java.version}"/> </condition> <antcall target="compile-runtime-11-flag-unless13"/> <antcall target="compile-runtime-11-do-if13"/> </target> <target name="compile-runtime-11-flag-unless13" depends="init-properties" unless="cr1.in13"> <echo message="Skipping compile-runtime-11 unless 1.3"/> </target> <target name="compile-runtime-11-do-if13" depends="init-properties" if="cr1.in13"> <mkdir dir="${aj.build.dir}/classes-1.1"/> <property name="java11.classes.zip" location="${java11.home}/lib/classes.zip"/> <available property="classes.zip.available" file="${java11.classes.zip}"/> <fail unless="classes.zip.available" message="no 1.1 bootclasspath"/> <javac compiler="javac1.1" bootclasspath="${java11.classes.zip}" source="1.3" includejavaruntime="no" includeantruntime="no" destdir="${aj.build.dir}/classes-1.1" srcdir="${aspectj.modules.dir}/runtime/src" target="1.1" verbose="false" failonerror="true" /> <delete dir="${aj.build.dir}/classes-1.1"/> </target> <!-- ===================================================================== --> <!-- boilerplate antcalls --> <!-- ===================================================================== --> <!-- for any-[module|product], define [module|product].name --> <target name="any-module" depends="init"> <fail unless="module.name" message="use -Dmodule.name=... to define"/> <build-module module="${module.name}"/> </target> <target name="any-module-all" depends="init"> <fail unless="module.name" message="use -Dmodule.name=... to define"/> <build-module-all module="${module.name}"/> </target> <target name="any-product" depends="init"> <fail unless="product.name" message="use -Dproduct.name=... to define"/> <antcall target="build-product"> <param name="product.name" value="${product.name}"/> </antcall> </target> <target name="ajbrowser-all" > <build-module-all module="ajbrowser"/> </target> <target name="ajdoc-all"> <build-module-all module="ajdoc"/> </target> <target name="build"> <build-module-all module="build"/> </target> <target name="aspectjtools-dist" depends="init" description="build local distribution"> <antcall target="build-product"> <param name="product.name" value="tools"/> </antcall> </target> <!-- ===================================================================== --> <!-- eclipse plugins --> <!-- ===================================================================== --> <target name="eclipse.plugins" depends="init" description="create the Eclipse distribution plugins"> <ant dir="${aspectj.modules.dir}/eclipse.plugin" inheritAll="false"/> </target> </project>