|
|
@@ -1,9 +1,120 @@ |
|
|
|
|
|
|
|
<project default="default"> |
|
|
|
<target name="default"> |
|
|
|
<taskdef properties="src/org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/> |
|
|
|
<iajc> |
|
|
|
<fileset dir="testdata" includes="Default.j*"/> |
|
|
|
</iajc> |
|
|
|
</target> |
|
|
|
<project name="aspectj-examples" default="both" basedir="."> |
|
|
|
|
|
|
|
<target name="info" > |
|
|
|
<echo> |
|
|
|
This script tests the Ajc11CompilerAdapter by compiling |
|
|
|
with Javac alone and then with Javac set up to use ajc. |
|
|
|
This must be run with aspectjtools.jar on the Ant classpath, |
|
|
|
so put it in the ant lib directory. |
|
|
|
|
|
|
|
It mainly tests that both work when the destination directory |
|
|
|
is not specified, and that the ajc compile picks up the extra |
|
|
|
arguments. Much more could be tested. |
|
|
|
</echo> |
|
|
|
</target> |
|
|
|
|
|
|
|
<!-- ============================================================= --> |
|
|
|
<!-- setup and cleanup targets --> |
|
|
|
<!-- ============================================================= --> |
|
|
|
|
|
|
|
<target name="clean" depends="init" |
|
|
|
description="clean and create classes/jar dir, .ajesym files"> |
|
|
|
<delete quiet="on"> |
|
|
|
<fileset dir="${sourceroot.dir}" |
|
|
|
includes="**/*.ajesym,**/*.class"/> |
|
|
|
</delete> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="init" depends="init.variables,init.taskdefs"/> |
|
|
|
|
|
|
|
<target name="init.variables" |
|
|
|
description="init variables"> |
|
|
|
|
|
|
|
<!-- build.compiler value to pick up our CompilerAdapter for javac --> |
|
|
|
<property name="ajc.adapter" |
|
|
|
value="org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter"/> |
|
|
|
|
|
|
|
<!-- required directories - run from examples or predefine --> |
|
|
|
<property name="temp.dir" |
|
|
|
location="${basedir}/temp"/> |
|
|
|
<property name="sourceroot.dir" |
|
|
|
location="${basedir}/sourceroot"/> |
|
|
|
<property name="aspect.dir" |
|
|
|
location="${basedir}/aspectsrc"/> |
|
|
|
<property name="aspectj.lib.dir" |
|
|
|
location="${ASPECTJ_HOME}/lib"/> |
|
|
|
|
|
|
|
<!-- required libraries - install or predefine --> |
|
|
|
<property name="aspectjrt.jar" |
|
|
|
location="${aspectj.lib.dir}/aspectjrt.jar"/> |
|
|
|
<property name="aspectjtools.jar" |
|
|
|
location="${aspectj.lib.dir}/aspectjtools.jar"/> |
|
|
|
|
|
|
|
<!-- checking required libraries --> |
|
|
|
<available file="${aspectjtools.jar}" |
|
|
|
property="aspectjtools.jar.available"/> |
|
|
|
<available file="${aspectjrt.jar}" |
|
|
|
property="aspectjrt.jar.available"/> |
|
|
|
|
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="init.taskdefs" depends="init.variables, |
|
|
|
aspectjtools.jar.available, |
|
|
|
aspectjrt.jar.available" |
|
|
|
unless="taskdefs.init"> |
|
|
|
<!-- sets name of new task to iajc, old task to ajc --> |
|
|
|
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"/> |
|
|
|
<property name="taskdefs.init" value="true"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="aspectjrt.jar.available" depends="init.variables" |
|
|
|
unless="aspectjrt.jar.available" > |
|
|
|
<fail message="expecting aspectjrt.jar at ${aspectjrt.jar}"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="aspectjtools.jar.available" depends="init.variables" |
|
|
|
unless="aspectjtools.jar.available" > |
|
|
|
<fail message="expecting aspectjtools.jar at ${aspectjtools.jar}"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<!-- ..................................................... --> |
|
|
|
<target name="both"> |
|
|
|
<antcall target="compile-and-run"/> |
|
|
|
<antcall target="compile-and-run-ajc"/> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="compile-and-run-ajc" depends="init"> |
|
|
|
<antcall target="compile-and-run"> |
|
|
|
<param name="build.compiler" value="${ajc.adapter}"/> |
|
|
|
</antcall> |
|
|
|
</target> |
|
|
|
|
|
|
|
<target name="compile-and-run" depends="init"> |
|
|
|
<antcall target="clean" /> |
|
|
|
<javac verbose="true"> |
|
|
|
<src path="${sourceroot.dir}"/> |
|
|
|
<include name="**/*.java"/> |
|
|
|
|
|
|
|
<compilerarg |
|
|
|
compiler="${ajc.adapter}" |
|
|
|
value="-argfile"/> |
|
|
|
<compilerarg |
|
|
|
compiler="${ajc.adapter}" |
|
|
|
file="${aspect.dir}/aspects.lst"/> |
|
|
|
<compilerarg compiler="${ajc.adapter}" |
|
|
|
value="-classpath"/> |
|
|
|
<compilerarg compiler="${ajc.adapter}" |
|
|
|
value="${aspectjrt.jar}"/> |
|
|
|
</javac> |
|
|
|
<java classname="Default"> |
|
|
|
<classpath> |
|
|
|
<pathelement path="${aspectjrt.jar}"/> |
|
|
|
<pathelement path="${sourceroot.dir}"/> |
|
|
|
<pathelement path="${aspect.dir}"/> |
|
|
|
</classpath> |
|
|
|
</java> |
|
|
|
<antcall target="clean" /> |
|
|
|
</target> |
|
|
|
|
|
|
|
</project> |