From 9da3b4c2b56c1061beea60a562d5a572fcdfbdf2 Mon Sep 17 00:00:00 2001
From: wisberg
-
@@ -60,14 +62,13 @@ the "resource" attribute to specify the default names:
The current resource file retains the name "ajc" for the Ajc10 task,
and uses "iajc" for the AspectJ 1.1 task.
-This may change in the final release of AspectJ 1.1.
For more information on using Ant, please refer to Jakarta's documentation on integrating user-defined Ant tasks into builds.
-
build.compiler
property to the class name. This enables users to
to easily switch between Javac and the AspectJ compiler.
+However, javac's handling of source files prevents the adapter from
+doing a correct compile in some cases, so use
+AjcTask where possible.
-To build this way, install aspectjtools.jar in ${ANT_HOME}/lib
+To build using the adapter,
+put the aspectjtools.jar on the system/ant
+classpath (e.g., in ${ANT_HOME}/lib)
and define the build.compiler
-property as the fully-qualified name of the class:
+property as the fully-qualified name of the class.
+The AspectJ compiler should run for any compile using the Javac task
+(for options, see the Ant documentation for the Javac task).
+For example, this passes all out-of-date source files in the
+src/org/aspectj/
subdirectories to the ajc command
+along with the destination directory:
+-- command: + cp aspectj1.1/lib/aspectjtools.jar ant/lib ant/bin/ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter ... + +-- task invocation in the build script: + + <javac srcdir="src" includes="org/aspectj/**/*.java" destdir="dest" /> +-The AspectJ compiler should run for any compile using the Javac task -(for options, see the Ant documentation for the Javac task).
To pass ajc-specific arguments, use a compilerarg
entry.
-For example,
- -- command - Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11BuildCompiler + Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter -- build script <property name="ajc" - value="org.aspectj.tools.ant.taskdefs.Ajc11BuildCompiler"/> + value="org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter"/> - <javac srcdir="src" destdir="dest" > - <compilerarg compiler="$${ajc}" line="-argfile src/args.lst"/> + <javac srcdir="src" includes="org/aspectj/**/*.java" destdir="dest" > + <compilerarg compiler="${ajc}" line="-argfile src/args.lst"/> <javac >-Beware of using regular source lists with this; javac may prune unchanged -files, which excludes them from the compile process for ajc, which requires -that all files affected by any aspects be listed explicitly. +The adapter supports any
ajc
command-line option
+passed using compilerarg, as well as
+the following options available only in AjcTask.
+Find more details on the following options in the
+AjcTask documentation.
+Warning - use build.compiler.clean
+ to get all files, when available:
+Javac prunes the source file list of "up-to-date" source files
+based on the timestamps of corresponding .class files (and will not
+compile if no sources are out of date).
+This is wrong for ajc which requires all the files for each compile
+and which may refer indirectly to sources using argument files.
+To work around this, set the global property "build.compiler.clean".
+This tells the compiler adapter
+to delete all .class files in the destination directory
+and re-execute the javac task
+so javac can recalculate the list of source files. e.g.,
+
+ Ant -Dbuild.compiler=org.aspectj.tools.ant.taskdefs.Ajc11CompilerAdapter + -Dbuild.compiler.clean=anything ... ++Caveats to consider when using this global property: +
+Forking is now supported in both the adapter and AjcTask (iajc), +and you can set the maximum memory available. +You can also not fork and increase the memory available to Ant (see the Ant documentation, searching for ANT_OPTS, the variable they use in their scripts to pass VM options, e.g., ANT_OPTS=-Xmx128m).
You can send email to -- 2.39.5