diff options
author | acolyer <acolyer> | 2004-04-02 12:03:40 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2004-04-02 12:03:40 +0000 |
commit | 33d8ee9eededcd1219a6cbd1d063af005d40a3f7 (patch) | |
tree | d30f882cbab26f54b62dc1cddfab666d97d6bd3d /docs/dist | |
parent | fc1c15110e8a9cfafabad0dcc4c10445725c9fb2 (diff) | |
download | aspectj-33d8ee9eededcd1219a6cbd1d063af005d40a3f7.tar.gz aspectj-33d8ee9eededcd1219a6cbd1d063af005d40a3f7.zip |
fix for Bugzilla Bug 31460
Weaving class loader
Diffstat (limited to 'docs/dist')
-rw-r--r-- | docs/dist/doc/examples/build.xml | 58 | ||||
-rw-r--r-- | docs/dist/doc/examples/ltw/README | 22 | ||||
-rw-r--r-- | docs/dist/doc/examples/ltw/aj | 16 | ||||
-rw-r--r-- | docs/dist/doc/examples/ltw/aj.bat | 22 |
4 files changed, 118 insertions, 0 deletions
diff --git a/docs/dist/doc/examples/build.xml b/docs/dist/doc/examples/build.xml index 8fd48dbc7..ba2931fba 100644 --- a/docs/dist/doc/examples/build.xml +++ b/docs/dist/doc/examples/build.xml @@ -394,4 +394,62 @@ </target> + <!-- ============================================================= --> + <!-- do tracing example with 1.2 load-time weaving --> + <!-- (and use fork/forkclasspath to avoid Eclipse 2.x bug) --> + <!-- ============================================================= --> + <target name="tracing-lt" depends="init" + description="tracing example with load-time aspect weaving"> + <antcall target="clean" /> + + <!-- build application classes --> + <iajc outjar="${jar.dir}/tracingApp.jar" + classpath="${aspectjrt.jar}" + fork="true" + forkclasspath="${aspectjtools.jar}" + verbose="off"> + <src path="${example.dir}"/> + <include name="tracing/*.java" /> + </iajc> + + <!-- Build a read-only tracing library --> + <iajc outjar="${jar.dir}/tracingLib.jar" + classpath="${aspectjrt.jar}:${jar.dir}/tracingApp.jar" + fork="true" + forkclasspath="${aspectjtools.jar}" + verbose="off"> + <src path="${example.dir}"/> + <include name="tracing/version2/Trace.java" /> + <include name="tracing/version2/TraceMyClasses.java" /> + </iajc> + + <!-- test standalone application by running without tracing --> + <echo message="---------- running without tracing - START"/> + <java classname="tracing.ExampleMain"> + <classpath> + <pathelement path="${aspectjrt.jar}"/> + <pathelement path="${jar.dir}/tracingApp.jar"/> + </classpath> + </java> + <echo message="---------- running without tracing - FINISH "/> + + <!-- run appliaction with LTW to add tracing --> + <echo message="---------- running with tracing - START"/> + <java classname="tracing.ExampleMain" + fork="true"> + <classpath> + <pathelement path="${aspectjrt.jar}"/> + <pathelement path="${aspectjtools.jar}"/> + <pathelement path="d:/eclipse_aspectj/workspace/weaver/bin"/> + </classpath> + <jvmarg line="-showversion"/> + <sysproperty key="java.system.class.loader" value="org.aspectj.weaver.WeavingURLClassLoader"/> + <sysproperty key="aj.weaving.verbose" value="True"/> + <sysproperty key="aj.class.path" path="${jar.dir}/tracingLib.jar:${jar.dir}/tracingApp.jar"/> + <sysproperty key="aj.aspect.path" path="${jar.dir}/tracingLib.jar"/> + </java> + <echo message="---------- running with tracing - FINISH"/> + + </target> + </project> diff --git a/docs/dist/doc/examples/ltw/README b/docs/dist/doc/examples/ltw/README new file mode 100644 index 000000000..bbeb56290 --- /dev/null +++ b/docs/dist/doc/examples/ltw/README @@ -0,0 +1,22 @@ +
+This directory contains a script "aj" to demonstrate load-time weaving. Java
+classes on the CLASSPATH are loaded and woven with aspects on the ASPECTPATH.
+This feature is only supported on JDK 1.4 and later.
+
+--To compile the tracing example--
+
+ ant -f ../build.xml tracing-lt
+
+--To run the example--
+
+ set CLASSPATH to include "../jars/tracingApp.jar"
+
+ aj tracing.ExampleMain
+
+--To run the example with tracing--
+
+ set ASPECTPATH=../jars/tracingLib.jar
+
+ aj tracing.ExampleMain
+
+
diff --git a/docs/dist/doc/examples/ltw/aj b/docs/dist/doc/examples/ltw/aj new file mode 100644 index 000000000..8e7a250bb --- /dev/null +++ b/docs/dist/doc/examples/ltw/aj @@ -0,0 +1,16 @@ +# *******************************************************************
+# Copyright (c) 2004 IBM Corporation
+# All rights reserved.
+# This program and the accompanying materials are made available
+# under the terms of the Common Public License v1.0
+# which accompanies this distribution and is available at
+# http://www.eclipse.org/legal/cpl-v10.html
+#
+# Contributors:
+# Matthew Webster initial implementation
+# ******************************************************************/
+
+if [ "$ASPECTJ_HOME" = "" ] ; then ASPECTJ_HOME=../../../
+fi
+
+"$JAVA_HOME/bin/java" -classpath "$ASPECTJ_HOME/lib/aspectjtools.jar" "-Djava.system.class.loader=org.aspectj.weaver.WeavingURLClassLoader" "-Daj.class.path=$ASPECTPATH:$CLASSPATH" "-Daj.aspect.path=$ASPECTPATH" "$@"
diff --git a/docs/dist/doc/examples/ltw/aj.bat b/docs/dist/doc/examples/ltw/aj.bat new file mode 100644 index 000000000..c004598bb --- /dev/null +++ b/docs/dist/doc/examples/ltw/aj.bat @@ -0,0 +1,22 @@ +@echo off
+rem *******************************************************************
+rem Copyright (c) 2004 IBM Corporation
+rem All rights reserved.
+rem This program and the accompanying materials are made available
+rem under the terms of the Common Public License v1.0
+rem which accompanies this distribution and is available at
+rem http://www.eclipse.org/legal/cpl-v10.html
+rem
+rem Contributors:
+rem Matthew Webster initial implementation
+rem ******************************************************************/
+
+if "%ASPECTJ_HOME%" == "" set ASPECTJ_HOME=..\..\..\
+
+if exist "%JAVA_HOME%\bin\java.exe" goto haveJava
+if exist "%JAVA_HOME%\bin\java.bat" goto haveJava
+if exist "%JAVA_HOME%\bin\java" goto haveJava
+echo java does not exist as %JAVA_HOME%\bin\java
+echo please fix the JAVA_HOME environment variable
+:haveJava
+"%JAVA_HOME%\bin\java" -classpath "%ASPECTJ_HOME%\lib\aspectjtools.jar" "-Djava.system.class.loader=org.aspectj.weaver.WeavingURLClassLoader" "-Daj.class.path=%ASPECTPATH%;%CLASSPATH%" "-Daj.aspect.path=%ASPECTPATH%" %1 %2 %3 %4 %5 %6 %7 %8 %9
|