export CVS_ROOT=":pserver:anonymous@dev.eclipse.org:/home/technology" cvs co org.aspectj/modulesIf using Eclipse, check out the subdirectories of
org.aspectj/modules
as Eclipse projects.
Skip the aspectj-attic
module.
Build an AspectJ distribution:
cd org.aspectj/modules/build ../lib/ant/bin/antInstall the distribution (e.g., into build/../aspectj-install):
java -jar ../aj-build/dist/aspectj-DEVELOPMENT.jarYou can skip the GUI by specifying an existing, empty writable target directory using
-to {targDir}
:
java -jar ../aj-build/dist/aspectj-DEVELOPMENT.jar -to .Test it by running the build script in the examples directory:
cd ../aspectj-install/doc/examples ../../lib/ant/bin/antThis should build and run the spacewar example.
To build requires only the AspectJ project modules and Java VM's. All necessary libraries and tools are in the lib directory, including Ant.
To get the source, check out from CVS. E.g., from the command line,
export CVS_ROOT=":pserver:anonymous@dev.eclipse.org:/home/technology" cvs co org.aspectj/modules
Eclipse users should check out each relevant subdirectory of
org.aspectj/modules
as a project
(most have .project files).
Not all modules are required.
The aspectj-attic
module only has old code.
src
(or java5-src
for Java 5 code) and test source files in
testsrc
(or java5-testsrc
),
and can handle Java and AspectJ projects.
For more information on the build infrastructure and setup, see
readme-build-module.html
and below.
You should use the Ant in ../lib/ant. Currently this is a vanilla distribution of Ant 1.6.3, but that might change.
This build directory has a master
build.xml script, and the modules have
satellite build.xml
which support building only that
module.
The release directory has scripts for doing
release builds (in multiple VM's, with testing). These are run by
automated build and before any AspectJ distribution.
Custom build.xml
files are in
The ../docs/build.xml,
org.aspectj.lib/build-aspectjlib.xml,
and ../eclipse.plugin/build.xml.
These are invoked by the master
build.xml as needed.
Other modules have generic build.xml
's that just
use the master build file to run targets compile
and
test
for that module.
(If you do clean
, all binaries for all
modules are cleaned.)
The master build.xml
creates an AspectJ distribution in
../aj-build/dist/aspectj-DEVELOPMENT.jar
;
You'll notice module jar results are put in
../aj-build/jars,
including {module}.jar
and {module}-test.jar
(for the release and test classes) and
{module}-all.jar
, and
{module}-test-all.jar
(including all antecedant classes and libraries).
See build.xml for other targets.
For any build, you should create your own version of
local.properties, using
sample.local.properties
as a template.
When using the master build.xml
,
consider defining "build.config" to pass flags to the Ant
builder. E.g., to reuse Eclipse classes and log verbosely,
ant -Dbuild.config=useEclipseCompiles,verbose
(useEclipseCompiles
is incompatible with release builds
since it mixes testing and release classes.)
For example, to build everything into a release bundle, with verbose logging:
cd modules/build ../lib/ant/bin/ant
To build only the asm module (and any modules it requires) using
modules/build
:
cd modules/build ../lib/ant/bin/ant -f build.xml any-module -Dmodule.name=asm
To build and test the asm module from that module:
cd modules/asm ../lib/ant/bin/ant test
To build the test harness into
../aj-build/jars/testing-drivers-all.jar
:
cd modules/build ../lib/ant/bin/ant build-harness-jar
As mentioned above, the modules are Eclipse projects, so once checked out, they should build as-is. (You will need to be using a version of Eclipse that can handle the .project and .classpath files in the modules/projects.) That will enable you to run the compiler or test harness from within Eclipse (see below), but it will not build the AspectJ release as Ant does. If you are making changes in Eclipse, you should set your default JRE to the minimum supported by the AspectJ tools (currently JDK 1.3) to avoid using later API's. You'll need to set some variables in your Eclipse environment; currently these are:
JAVA_HOME/lib/tools.jar
../lib/build/build.jar
, which is
added via a taskdef declaration.)
If you find on rebuilding that the build products are not
being regenerated, you may need to manually delete them
or restart eclipse (the files are not being closed); see
readme-build-module.html
for more information.
useEclipseCompiles
in the
build.config
. That reduces the build process
to product assembly.
(And of course you can run Ant from Eclipse as described above.)
java -jar {file} {arguments}
.
To run the compiler from the command-line, use the ajbrowser
jar file:
java -jar aj-build/jars/ajbrowser-all.jar {compile arguments}This will run
ajbrowser
if you provide no arguments or
only (unflagged) .lst file arguments. To run the test harness,
use the testing-drivers
jar file:
java -jar aj-build/jars/testing-drivers-all.jar tests/ajcTests.xml ...
Program | Module | Main |
---|---|---|
AspectJ compiler | org.aspectj.ajdt.core | org.aspectj.tools.ajc.Main |
AspectJ browser | ajbrowser | org.aspectj.tools.ajbrowser.Main |
Test harness | testing-drivers | org.aspectj.testing.drivers.Harness |
Each module has a tree of JUnit tests in the testsrc
directory.
These parallel the src
directories and contain roll-up suites
for each package
({module}/testsrc/{packagePath}/{package}Tests.java
) and
for the module as a whole
({module}/testsrc/{module}ModuleTests.java
).
The AspectJ project also has additional custom tests in the tests module, mainly the compiler tests run by the harness in ajcTests.xml. It is important to run these additional compiler tests (not covered by the JUnit suite) before and after any change to the compiler.
The module run-all-junit-tests refers to all the other modules and the compiler tests adapted through the ../tests/src. So the easiest way to run the JUnit and compiler tests is to run the top-level suite RunTheseBeforeYouCommitTests.
../lib/ant/bin/ant tests.
To run JUnit directly, put JUnit and the {module}-test-all.jar file on the classpath:
set cp="lib/junit/junit.jar;aj-build/jars/util-test-all.jar" java -classpath "$cp" junit.textui.TestRunner UtilModuleTests
The assembled (-all
) jar files include all antecedants,
except for those "skipped" (like Ant and JUnit).
(For more on skipped libraries, see
readme-build-module.html).
The build.xml build-harness-jar
target builds a single jar with
the AspectJ binaries and a test harness as the main class.
It reads test suite files like
../tests/ajcTests.xml;
use the -help flag to see available options.
For more information, see
../tests/readme-tests-module.html.
org.aspectj.bridge.Version
.
Do not run using the build.config
value
useEclipseCompiles
,
because this will include testing classes in the release libraries.
See Version synchronization below
for more details on how the version is updated.
tests/ajcTestsFailing.xml
are fixed and moved to
tests/ajcTests.xml
.
Before a release, run the release tests as described in
../tests/readme-release-tests.html
(deprecated? using:
../build/release-checklist.txt).
cd org.aspectj/ cvs tag -R -c v1_1_0Pushing the release out to the web involves manually updating the web with the release files and documentation, verifying the downloads and pages, and sending any release notifications. Save the release installer, test results, and any notes about deferred bugs or tests in
org.aspectj/releases/aspectj-{version}/
.
To reiterate (and as described more fully in readme-build-module.html), the build system introspects on module and the .classpath file to determine how to build. Further, it enforces stricter build invariants than the Eclipse projects do; when your code works in Eclipse but fails in the Ant, it's your responsibility to fix it by following the build invariants below.
What to do when adding a new module (i.e., eclipse project):
How the build system introspects, and the build invariants that are enforced by the Ant build:
{module.name}/.classpath
is read to determine
the source directories and required projects and libraries.
src
and testsrc
directories.
java5-src
and java5-testsrc
directories.
testsrc
directory is used in production builds.
{module.name}.jar
includes only the module classes, and {module.name}-all.jar
includes the module classes plus any antecendant modules and any
required libraries not skipped (see below).
{module.name}/{module.name}.mf.txt
, if available,
will be used as the jar file manifest, after replacing certain
variables in the .mf.txt
file.
resource.pattern
in
Builder.properties
are included with assembled jars.
testing-*
module is used in production builds,
directly or indirectly.
testsrc
code,
whether in the same or another module.
That means there are a number of legal Eclipse projects and code arrangements which are not valid AspectJ modules. When you add modules, libraries, or dependencies, you must build with Ant to verify these invariants are not broken.
javac
,
put the JDK bin directory on your PATH and/or define
the JAVA_HOME environment variable.
Ant requires the path to the javac
executable
when the BuildModule
taskdef runs. I think it either
gets it from $JAVA_HOME
or if the bin
directory is on the PATH
.