Incremental test of AjcTask Ant task
This directory contains files for manually testing
two AjcTask Ant task facilities:
- incremental builds, using tag file or input stream
(supported directly by the compiler)
- resource copying using input jars or source roots
and output jar or directory
(only supported in the Ant task).
incTest.xml
is an Ant script which builds two input jars
and runs an incremental test using a tag file.
The results must be verified by hand manually at present;
This test should be updated to run using JUnit like
AjcTaskTest.java.
Sample procedure
This shows how to set up the test and check whether
the incremental tag file and resource-copying features work.
Throughout, {ant}
is assumed to be
../../../lib/ant/bin/ant
and the directory
is assumed to be this directory, with the Ant build script
incTest.xml.
The script uses the eclipse classpath rather than aspectjtools.jar,
so that updates to the sources can be tested without
rebuilding the distribution.
- Set up the output jars
{ant} -f incTest.xml setup
This should produce one.jar
and two.jar
in the directory injars/.
- Start the run with the default settings
(use
output/tagfile.txt
as the tag file
and to include the non-.class contents of the input jars
in the output jar):
{ant} -f incTest.xml test
The task will do an initial compilation and silently wait.
- In another shell, test the classes in the generated output jar:
export CLASSPATH="../../../lib/test/aspectjrt.jar;output/outjar.jar"
java packageOne.Main
Inspect the files in the src/ and
injarSrc/ directories to find other
main classes and to determine the expected result of the aspect.
As of this writing,
the aspect src/TraceMains.java
should emit messages before and after
the execution of any static main(String[]) method.
- Check that the output jar got the injar and src files:
jar tf output/outjar.jar
The output should list the
non-.class files in injarSrc/
and the non CVS/.java files in the src/ dir.
- To test incremental compiles,
edit the aspect src/TraceMains.java
to modify the behavior. You can also modify the input jars or
source files.
Then touch or edit output/tagfile.txt
to provoke recompilation.
- Test the generated output jar again
to see if the changes are reflected in the runtime behavior
and if files are being copied correctly.
- Repeat this process until satisfied. Delete the tagfile to quit:
rm output/tagfile.txt
- Also run the targets
test-all
and test-both
.
Many combination of the option variants are possible.
Test the relevant ones by editing the
incTest.xml script
and redoing the test.
Option | Variants |
incremental | none, -incremental, -tagFile |
output | none (default "."), destDir, output jar |
injars | none, one, two |
injar copying | off (default), on |
source resource copying | off (default), various patterns |
Clean-up
Take care to preserve CVS state after running this test.
It calls on you to edit checked-in files and generates files
to local repository directories. The best thing is to delete
the output
and injars
directories
(using the clean
task)
and revert to repository forms for sources (unless fixing them).
Upgrade
This needs to be upgraded to run automatically.
There is a file/tree-comparison utility to revive from the
aspectj-attic which can be used to compare expected and actual
results of the jar files. Setting up the tasks to run incrementally
might be done using the parallel task, but...
In any case, the nested options tested here should move
to non-incremental JUnit tests.