blob: 0cae97a3670647b2bfc97e8a3c72ef3a70fd722c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
<!-- ajc-ant script, not to be used from Ant commant line - see AntSpec -->
<project name="ltw">
<!-- using this we can debug the forked VM -->
<property
name="jdwp"
value="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"/>
<property name="aj.bootpath" refid="aj.path"/>
<target name="JDK14 LTW with XML">
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<classpath refid="aj.path"/>
<jvmarg value="-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
<jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
<!--
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
-->
<!-- use META-INF/aop.xml style -->
<!--<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
<!--<jvmarg line="${jdwp}"/>-->
<sysproperty key="aj.class.path" path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar"/>
</java>
</target>
<target name="JDK14 LTW with ASPECTPATH">
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<classpath refid="aj.path"/>
<jvmarg value="-Djava.system.class.loader=org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
<jvmarg value="-Dorg.aspectj.tracing.debug=true"/>
<!--
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
-->
<!-- use META-INF/aop.xml style -->
<!--<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>-->
<!--<jvmarg line="${jdwp}"/>-->
<sysproperty key="aj.class.path" path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar"/>
<sysproperty key="aj.aspect.path" path="${aj.sandbox}/handler.jar"/>
</java>
</target>
<!-- We have three JARs files, two containing aspects (ExceptionHandler and Tracing)
for which aop-ajc.xml files have been generate. However we supply our own
aop.xml which declares only ExceptionHandler. We then override the
configuration search path -->
<target name="override default path using -Dorg.aspectj.weaver.loadtime.configuration">
<copy file="${aj.root}/tests/ltw/aop-orgaspectjweaverloadtimeconfiguration.xml"
tofile="${aj.sandbox}/META-INF/aop-random.xml"/>
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<classpath refid="aj.path"/>
<classpath>
<pathelement path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar:${aj.sandbox}/tracing.jar"/>
</classpath>
<jvmarg value="-Dorg.aspectj.weaver.loadtime.configuration=META-INF/aop-random.xml"/>
<jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
<!-- Beware, this is complicated! We need to intercept class loading on
the System class loader before any classes are loaded. We do this
by replacing the URLClassLoader. We then define a custom
SecurityManager that will be loaded _before_ the class loader
hierarch is fully initialized. -->
<target name="NPE with custom agent">
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<!-- Prepend custom URLClassLoader and append AspectJ
to bootclasspath -->
<jvmarg value="-Xbootclasspath/p:${aj.sandbox}"/>
<jvmarg value="-Xbootclasspath/a:${aj.bootpath}"/>
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
<classpath>
<pathelement path="${aj.sandbox}/hello.jar:${aj.sandbox}/handler.jar:${aj.sandbox}/security.jar"/>
</classpath>
<!-- Specify custom SecurityManager that will be loaded
and woven very early -->
<jvmarg value="-Djava.security.manager=NullSecurityManager"/>
<jvmarg value="-Daj.weaving.verbose=true"/>
<jvmarg value="-Dorg.aspectj.weaver.showWeaveInfo=true"/>
<!--
<jvmarg value="-Dorg.aspectj.tracing.enabled=true"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<jvmarg value="-Dorg.aspectj.tracing.messages=true"/>
-->
</java>
</target>
<target name="simple LTW">
<copy file="${aj.root}/tests/ltw/aop-simple.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"/>
<java fork="yes" classname="HelloWorldWithException" failonerror="yes">
<classpath refid="aj.path"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
<target name="dump on error">
<copy file="${aj.root}/tests/ltw/aop-dumponerror.xml"
tofile="${aj.sandbox}/META-INF/aop.xml"/>
<java fork="yes" classname="HelloWorldWithException" failonerror="no">
<classpath refid="aj.path"/>
<jvmarg value="-Dorg.aspectj.weaver.Dump.condition=error"/>
<sysproperty key="org.aspectj.dump.directory" path="${aj.sandbox}"/>
<!-- use META-INF/aop.xml style -->
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
<jvmarg value="${aj.addOpensKey}"/>
<jvmarg value="${aj.addOpensValue}"/>
<jvmarg value="-Dorg.aspectj.tracing.factory=default"/>
<!-- <jvmarg line="${jdwp}"/>-->
</java>
</target>
</project>
|