aboutsummaryrefslogtreecommitdiffstats
path: root/taskdefs
diff options
context:
space:
mode:
authorwisberg <wisberg>2003-10-01 05:25:04 +0000
committerwisberg <wisberg>2003-10-01 05:25:04 +0000
commit50c4883bf47070933f4431c47c1fc5a8779e2477 (patch)
tree1ca52f09ad15a1b0a23c2793be3aca7855ff2060 /taskdefs
parent83b5e4a3a53ef41d14c2e565bdcc742a363ab2f5 (diff)
downloadaspectj-50c4883bf47070933f4431c47c1fc5a8779e2477.tar.gz
aspectj-50c4883bf47070933f4431c47c1fc5a8779e2477.zip
tests for fixes for bugs disclosed by fixes for 40807
Diffstat (limited to 'taskdefs')
-rw-r--r--taskdefs/testdata/aspectsrc/SampleAspect.java7
-rw-r--r--taskdefs/testdata/aspectsrc/aspects.lst1
-rw-r--r--taskdefs/testdata/test-build.xml125
3 files changed, 126 insertions, 7 deletions
diff --git a/taskdefs/testdata/aspectsrc/SampleAspect.java b/taskdefs/testdata/aspectsrc/SampleAspect.java
new file mode 100644
index 000000000..6ed9aab50
--- /dev/null
+++ b/taskdefs/testdata/aspectsrc/SampleAspect.java
@@ -0,0 +1,7 @@
+
+public aspect SampleAspect {
+ before () : staticinitialization(!SampleAspect) {
+ System.out.println("initializing class " +
+ thisJoinPointStaticPart.getSignature().getDeclaringType());
+ }
+} \ No newline at end of file
diff --git a/taskdefs/testdata/aspectsrc/aspects.lst b/taskdefs/testdata/aspectsrc/aspects.lst
new file mode 100644
index 000000000..41210a48d
--- /dev/null
+++ b/taskdefs/testdata/aspectsrc/aspects.lst
@@ -0,0 +1 @@
+SampleAspect.java
diff --git a/taskdefs/testdata/test-build.xml b/taskdefs/testdata/test-build.xml
index cb66c09b9..20f8ed3fc 100644
--- a/taskdefs/testdata/test-build.xml
+++ b/taskdefs/testdata/test-build.xml
@@ -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>