vmassol 2004/01/16 03:49:23
Modified: aspectwerkz plugin.jelly plugin.properties
aspectwerkz/xdocs properties.xml
aspectwerkz/src/plugin-test project.properties
Log:
- Allowed weaving to a different directory than ${maven.build.dest}
- Fixed AspectWerkzC usage. I was wrongly weaving all dependent jars... :-)
I believe the plugin now works for Attribdef offline mode. I haven't tried the other
use cases.
Revision Changes Path
1.18 +44 -18 maven-plugins/aspectwerkz/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven-plugins/aspectwerkz/plugin.jelly,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- plugin.jelly 4 Jan 2004 15:24:13 -0000 1.17
+++ plugin.jelly 16 Jan 2004 11:49:23 -0000 1.18
@@ -185,8 +185,6 @@
<!-- TODO: only run aspectc if sources are newer than target
XML definition file -->
- <ant:mkdir dir="${maven.aspectwerkz.weave.build.dir}"/>
-
<!-- Transforming Ant path structure into a list of dirs that can be used
to define an Ant fileset. We're using <pathconvert> to automatically
separate dirs with a known delimiter independently of any
@@ -206,10 +204,11 @@
classSrc="${maven.aspectwerkz.build.dest}"/>
</j:if>
- <!-- AspectC currently has a bug in that it creates a java.lang.Object class
file in the output directory. Until
- this is fixed, we need to remove that files. Otherwise, AspectWerkc will
try to instrument it, which will
- lead to an error... -->
- <ant:delete
file="${maven.aspectwerkz.weave.build.dir}/java/lang/Object.class"/>
+ <!-- AspectC currently has a bug in that it creates a java.lang.Object
+ class file in the output directory. Until this is fixed, we need to
+ remove that files. Otherwise, AspectWerkc will try to instrument it,
+ which will lead to an error... -->
+ <ant:delete
file="${maven.aspectwerkz.aspectc.build.dir}/java/lang/Object.class"/>
</j:if>
@@ -227,32 +226,49 @@
<!-- TODO: Add support for extension classes -->
+ <!-- Create a path for the -cp parameter of the AspectWerkzC class -->
+ <ant:path id="aspectwerkzc.cp">
+ <!-- Search for aspect libraries to weave to the source code. These are
+ defined as dependencies in project.xml -->
+ <j:forEach var="artifact" items="${pom.artifacts}">
+ <j:set var="dep" value="${artifact.dependency}"/>
+ <j:if test="${dep.getProperty('aspectwerkz.library') == 'true'}">
+ <ant:pathelement location="${artifact.path}"/>
+ </j:if>
+ </j:forEach>
+ </ant:path>
+ <ant:property name="aspectwerkzcp" refid="aspectwerkzc.cp"/>
+
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC">
<j:if test="${context.getVariable('maven.aspectwerkz.verbose') == 'true'}">
<ant:sysproperty key="aspectwerkz.transform.verbose" value="true"/>
</j:if>
+
+ <ant:sysproperty key="aspectwerkz.classloader.preprocessor"
+ value="${aspectwerkz.classloader.preprocessor}"/>
<ant:sysproperty key="aspectwerkz.transform.filter"
value="${maven.aspectwerkz.transform.filter}"/>
+
<ant:sysproperty key="aspectwerkz.definition.file"
value="${maven.aspectwerkz.definition.file}"/>
<ant:arg value="-verify"/>
<ant:arg value="-haltOnError"/>
- <ant:arg file="${maven.aspectwerkz.weave.build.dir}"/>
+ <j:if test="${!empty(aspectwerkzcp)}">
+ <ant:arg line="-cp ${aspectwerkzcp}"/>
+ </j:if>
+
+ <!-- If using the attribdef mode, weave classes generated by aspectc -->
+ <j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
+ <ant:arg file="${maven.aspectwerkz.aspectc.build.dir}"/>
+ </j:if>
+
+ <!-- TODO: Add support for xmldef mode -->
- <!-- Search for aspect libraries to weave to the source code. These are
- defined as dependencies in project.xml -->
- <j:forEach var="artifact" items="${pom.artifacts}">
- <j:set var="dep" value="${artifact.dependency}"/>
- <j:if test="${dep.getProperty('aspectwerkz.library') == 'true'}">
- <ant:arg file="${artifact.path}"/>
- </j:if>
- </j:forEach>
-
<ant:classpath>
<ant:path refid="classpath.main"/>
<ant:pathelement location="${plugin.getDependencyPath('ant:ant')}"/>
@@ -264,6 +280,14 @@
</ant:java>
+ <!-- Copy weaved classes to target directory -->
+ <ant:mkdir dir="${maven.aspectwerkz.weave.build.dir}"/>
+ <j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
+ <ant:copy todir="${maven.aspectwerkz.weave.build.dir}">
+ <ant:fileset dir="${maven.aspectwerkz.aspectc.build.dir}"/>
+ </ant:copy>
+ </j:if>
+
</goal>
<!--
@@ -281,6 +305,8 @@
<define:tag name="aspectc">
<ant:echo>Parsing [${javaSrc}] using [${classSrc}] ...</ant:echo>
+
+ <ant:mkdir dir="${maven.aspectwerkz.aspectc.build.dir}"/>
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
classname="org.codehaus.aspectwerkz.attribdef.definition.AspectC">
@@ -295,8 +321,8 @@
<!-- Path to classes dir -->
<ant:arg file="${classSrc}"/>
- <!-- (optional) Path to where weaved classes will be generated -->
- <ant:arg file="${maven.aspectwerkz.weave.build.dir}"/>
+ <!-- (optional) Path to where aspectc result will be put -->
+ <ant:arg file="${maven.aspectwerkz.aspectc.build.dir}"/>
<ant:classpath>
<ant:path refid="classpath.main"/>
1.8 +8 -1 maven-plugins/aspectwerkz/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven-plugins/aspectwerkz/plugin.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- plugin.properties 2 Jan 2004 14:09:03 -0000 1.7
+++ plugin.properties 16 Jan 2004 11:49:23 -0000 1.8
@@ -21,6 +21,9 @@
# Verbose mode
maven.aspectwerkz.verbose = false
+# Classloader to use for class files weaving
+aspectwerkz.classloader.preprocessor =
org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor
+
# (optional) The AW plugin looks for source files in ${pom.sourceDirectory}.
# It also supports all source directories added to the ${maven.compile.src.set}
# Ant path variable. Moreover, if you wish to keep non-production aspects in a
@@ -38,6 +41,9 @@
# Location of the XML definition file.
maven.aspectwerkz.definition.file.src = ${basedir}/conf/aspectwerkz.xml
+# Location where aspectc results will be generated.
+maven.aspectwerkz.aspectc.build.dir = ${maven.build.dir}/aspectwerkz/aspectc
+
#----------------------------------------------------------------------------
# xmldef mode properties
# ---------------------------------------------------------------------------
@@ -47,7 +53,8 @@
# used in "xmldef" mode.
maven.aspectwerkz.definition.file.build = ${maven.build.dir}/aspectwerkz.xml
-# TODO: explain property here
+# If set to "no", prevents org.codehaus.aspectwerkz and related classes
+# (jexl, trove, dom4j...) from being instrumented.
maven.aspectwerkz.transform.filter = no
# (optional). Definition file to be merged with the main definition file.
1.7 +19 -1 maven-plugins/aspectwerkz/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven-plugins/aspectwerkz/xdocs/properties.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- properties.xml 3 Jan 2004 11:14:57 -0000 1.6
+++ properties.xml 16 Jan 2004 11:49:23 -0000 1.7
@@ -104,6 +104,14 @@
<code>maven.aspectwerkz.build.dest =
${maven.build.dir}/aspectwerkz/classes</code>.
</td>
</tr>
+ <tr>
+ <td>aspectwerkz.classloader.preprocessor</td>
+ <td>Yes</td>
+ <td>
+ Classloader to use for class files weaving. Defaults to
+ <code>org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor</code>.
+ </td>
+ </tr>
</table>
</section>
@@ -122,6 +130,14 @@
<code>${basedir}/conf/aspectwerkz.xml</code>.
</td>
</tr>
+ <tr>
+ <td>maven.aspectwerkz.aspectc.build.dir</td>
+ <td>Yes</td>
+ <td>
+ Location where aspectc results will be generated. Defaults to
+ <code>${maven.build.dir}/aspectwerkz/aspectc</code>.
+ </td>
+ </tr>
</table>
</section>
@@ -163,7 +179,9 @@
<td>maven.aspectwerkz.transform.filter</td>
<td>Yes</td>
<td>
- TODO: explain property here. Defaults to <code>no</code>.
+ If set to "no", prevents <code>org.codehaus.aspectwerkz</code> and
+ related classes (jexl, trove, dom4j...) from being instrumented.
+ Defaults to <code>no</code>.
</td>
</tr>
</table>
1.8 +1 -0 maven-plugins/aspectwerkz/src/plugin-test/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/maven-plugins/aspectwerkz/src/plugin-test/project.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- project.properties 2 Jan 2004 14:28:20 -0000 1.7
+++ project.properties 16 Jan 2004 11:49:23 -0000 1.8
@@ -5,3 +5,4 @@
maven.aspectwerkz.verbose = true
maven.aspectwerkz.src.dir = ${basedir}/src/aspectwerkz
maven.aspectwerkz.build.dest = ${maven.build.dir}/aspectwerkz/classes
+maven.aspectwerkz.weave.build.dir = ${maven.build.dir}/aspectwerkz/weaved
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]