diff options
-rw-r--r-- | build/build-properties.xml | 62 | ||||
-rw-r--r-- | build/build.xml | 66 |
2 files changed, 101 insertions, 27 deletions
diff --git a/build/build-properties.xml b/build/build-properties.xml index 979408812..2c01763ea 100644 --- a/build/build-properties.xml +++ b/build/build-properties.xml @@ -15,7 +15,8 @@ <!-- include as common entity for module build scripts --> <!-- should only need to edit version properties --> - +<project name="build-properties" default="init-properties"> + <target name="init-properties" unless="aspectj.modules.build.dir"> @@ -29,6 +30,7 @@ - build.version.eclipse.plugins should be set to "9.9.9" for "DEVELOPMENT", and - the same as build.version.long (in major.minor.service form) for releases. --> + <property name="build.verbose" value="false"/> <property name="build.version" value="DEVELOPMENT"/> <property name="build.version.base" value="1.2"/> <property name="build.version.long" value="DEVELOPMENT"/> @@ -67,6 +69,8 @@ location="${aj.build.dir}/jars"/> <property name="aj.dist.dir" location="${aj.build.dir}/dist"/> + <property name="aj.junit.dir" + location="${aj.build.dir}/junit"/> <property name="aj.webDeploy.dir" location="${aj.build.dir}/webDeploy"/> <property name="aj.plugin.org.aspectj.ajde.dir" @@ -92,24 +96,33 @@ location="${aspectj.modules.build.dir}/products"/> <property name="aspectj.modules.tests.dir" location="${aspectj.modules.dir}/tests"/> - <property name="aspectj.build.jar" - location="${aspectj.modules.lib.dir}/build/build.jar"/> - <available file="${aspectj.build.jar}" - property="aspectj.build.jar.available" - value="${aspectj.build.jar}"/> + <jar-property name="junit.jar" + location="${aspectj.modules.lib.dir}/junit/junit.jar"/> </target> <target name="init-taskdefs" depends="init-properties" unless="init-taskdefs.done" > - <fail unless="aspectj.build.jar.available" - message="unable to find aspectj.build.jar: ${aspectj.build.jar}"/> + <jar-property name="aspectj.build.jar" + location="${aspectj.modules.lib.dir}/build/build.jar"/> + <jar-property name="lib.ant.jar" + location="${aspectj.modules.lib.dir}/ant/lib/ant.jar"/> <taskdef resource="org/aspectj/internal/tools/ant/taskdefs/taskdefs.properties" classpath="${aspectj.build.jar}"/> - <!-- run directly from classes in bin when debugging. - <taskdef resource="org/aspectj/internal/tools/ant/taskdefs/taskdefs.properties" - classpath="${aspectj.modules.dir}/build/bin"/> - --> + <property name="aj.taskdef.package" + value="org.aspectj.internal.tools.ant.taskdefs"/> + <path id="ant.lib.path"> + <fileset dir="${aspectj.modules.lib.dir}/ant/lib"> + <include name="**/*.jar"/> + </fileset> + </path> + <taskdef name="junit" + classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" + classpathref="ant.lib.path"/> + <taskdef name="junitreport" + classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator" + classpathref="ant.lib.path"/> + <property name="init-taskdefs.done" value="done"/> </target> @@ -186,3 +199,28 @@ java.home = ${java.home} </echo> </target> + + <macrodef name="jar-property"> + <attribute name="name"/> + <attribute name="location"/> + <sequential> + <property name="@{name}" + location="@{location}"/> + <available file="${@{name}}" + property="@{name}.available" + value="${@{name}}"/> + <fail unless="@{name}.available" + message="unable to find @{name}: ${@{name}}"/> + </sequential> + </macrodef> + + <!-- todo convert clients to clean-dir --> + <macrodef name="clean-dir"> + <attribute name="dir"/> + <sequential> + <mkdir dir="@{dir}"/> + <delete dir="@{dir}"/> + <mkdir dir="@{dir}"/> + </sequential> + </macrodef> +</project> diff --git a/build/build.xml b/build/build.xml index 7590233d9..fef4735f7 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,38 +2,47 @@ <!-- ========================================================================= --> <!-- Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC), --> -<!-- 2003 Contributors --> +<!-- 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: --> +<!-- Contributors: (See CVS checkin's) --> <!-- Xerox/PARC initial implementation --> <!-- Adrian Colyer / George Harley eclipse plugin targets --> <!-- ========================================================================= --> -<!DOCTYPE project [ -<!ENTITY build-properties SYSTEM "build-properties.xml"> -]> <project name="build" default="all" basedir="."> <target name="all" depends="aspectj"/> <!-- used to also depend on "eclipse.plugins"/--> <target name="rebuild" depends="clean,all"/> <target name="clean" depends="clean-directories"/> + <!-- these rely on mapping ant.project.name to module.name --> + <target name="compile" depends="build-module"/> + <target name="compile-tests" depends="init"> + <antcall target="any-module-all"> + <param name="trim.testing.default" value="false"/> + </antcall> + </target> + + <target name="test" depends="compile-tests"> + <antcall target="run-module-junit-tests"/> + </target> <!-- ===================================================================== --> <!-- Init --> <!-- ===================================================================== --> <!-- use this file to force prop values --> - <property file="${basedir}/local.properties"/> + <property name="modules.dir" location="${basedir}/.."/> + <property name="module.name" value="${ant.project.name}"/> - &build-properties; + <import file="${modules.dir}/build/build-properties.xml"/> <target name="init" depends="init-properties,init-directories"> - <property name="build.config" value="verbose"/> + <property name="build.config" value=""/> <property name="trim.testing.default" value="true"/> <property name="aj.installer.jar" location="${aj.dist.dir}/aspectj-${build.version.short}.jar"/> @@ -156,7 +165,7 @@ trimTesting="${trim.testing.default}" buildConfig="${build.config}" version="${build.version.long}" - verbose="true" + verbose="${build.verbose}" failonerror="true"/> </target> @@ -168,11 +177,10 @@ trimTesting="${trim.testing.default}" buildConfig="${build.config}" version="${build.version.long}" - verbose="true" + verbose="${build.verbose}" failonerror="true"/> </target> - <target name="build-module-all" depends="init,init-taskdefs,init-version"> <ajbuild module="${module.name}" baseDir="${aspectj.modules.dir}" @@ -181,12 +189,11 @@ trimTesting="${trim.testing.default}" buildConfig="${build.config}" version="${build.version.long}" - verbose="true" + verbose="${build.verbose}" assembleall="true" failonerror="true"/> </target> - <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 --> @@ -245,7 +252,36 @@ To use testing client jar in tests, mv ../aj-build/jars/testing-client-all.jar ../lib/tests/testing-client.jar </echo> </target> - + + <target name="run-module-junit-tests" depends="init-taskdefs" + description="run all junit tests for a module"> + <mkdir dir="${aj.junit.dir}/${module.name}"/> + <!-- fork to load classes, include AntRuntime to get taskdef classes junit.jar --> + <junit + fork="true" + dir="../${module.name}" + printsummary="yes" + haltonfailure="${haltOnTestFailure}"> + <classpath> + <pathelement location="${aj.build.dir}/jars/${module.name}-all.jar"/> + <!-- libraries clipped from -all jars (though junit in parent) --> + <pathelement location="${aspectjrt.path}"/> + <pathelement location="${junit.jar}"/> + </classpath> + + <!-- aspectjrt.path used by ajde tests --> + <sysproperty key="aspectjrt.path" value="${aspectjrt.path}"/> + + <formatter type="xml"/> + <batchtest + todir="${aj.junit.dir}/${module.name}"> + <fileset dir="${modules.dir}/${module.name}/testsrc"> + <include name="*ModuleTests.java" /> + </fileset> + </batchtest> + </junit> + </target> + <!-- remove as unused - see release/build.xml test-sources --> <target name="ajcTests" depends="init,build-testing-drivers"> <java fork="true" jar="${aj.jar.dir}/testing-drivers-all.jar" @@ -289,7 +325,7 @@ To use testing client jar in tests, <ant dir="${aspectj.modules.dir}/docs" antfile="build.xml" target="local-dist" - inheritAll="false"/> <!-- true? --> + inheritAll="false"/> </target> <target name="aspectjrt" depends="init" |