<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="example.dir"
<target name="init.taskdefs" depends="init.variables,
aspectjtools.jar.available,
- aspectjrt.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">
<classpath>
<pathelement path="${aspectjtools.jar}"/>
</classpath>
</taskdef>
+ <property name="taskdefs.init" value="true"/>
</target>
<!-- targets to fail unless required libraries available -->
</antcall>
</target>
+ <!-- ============================================================= -->
+ <!-- do tracing example using compiler adapter -->
+ <!-- ============================================================= -->
+ <target name="tracing-adapter" depends="init"
+ description="tracing example compiled via javac task">
+ <antcall target="clean" />
+ <!-- to fork, set adapter.fork=true
+ and put aspectjtools.jar on ant classpath -->
+ <javac destdir="${classes.dir}"
+ fork="${adapter.fork}">
+ <src path="${example.dir}"/>
+ <include name="tracing/*.java"/>
+
+ <!-- compilerarg's ignored unless using our compiler adapter -->
+ <compilerarg compiler="${ajc.adapter}"
+ line="-verbose -Xlint -proceedOnError"/>
+ <!-- use separate values if a path might have spaces -->
+ <compilerarg compiler="${ajc.adapter}"
+ value="-classpath"/>
+ <compilerarg compiler="${ajc.adapter}"
+ value="${aspectjrt.jar}"/>
+ <compilerarg compiler="${ajc.adapter}"
+ path="${example.dir}/tracing/version3/Trace.java"/>
+ </javac>
+ </target>
+
+ <target name="tracing-adapter-ajc" depends="init"
+ description="tracing example compiled using ajc via compiler adapter">
+ <!-- aspectjtools.jar must be on system/ant classpath -->
+ <antcall target="tracing-adapter">
+ <param name="build.compiler" value="${ajc.adapter}"/>
+ </antcall>
+ </target>
+
<!-- ============================================================= -->
<!-- do tracing example with 1.1 bytecode weaving (binary aspects) -->
<!-- ============================================================= -->