You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ca...@apache.org on 2004/10/03 21:30:15 UTC
cvs commit: maven-plugins/aspectj/src/plugin-test/src/main/org/apache/maven/aspectj Dummy.java
carlos 2004/10/03 12:30:14
Modified: aspectj/xdocs changes.xml properties.xml
aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj
Sample.aj
aspectj plugin.jelly plugin.properties
aspectj/src/plugin-test/src/test/org/apache/maven/aspectj
AspectTest.java
aspectj/src/plugin-test maven.xml
aspectj/src/plugin-test/src/main/org/apache/maven/aspectj
Dummy.java
Added: aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj
TestB.aj TestA.aj
aspectj/src/plugin-test argfile.lst
Log:
MPASPECTJ-12 Added maven.aspectj.argfiles and maven.aspectj.weaveAspectSources properties.
Revision Changes Path
1.26 +5 -2 maven-plugins/aspectj/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/xdocs/changes.xml,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- changes.xml 5 Sep 2004 20:00:25 -0000 1.25
+++ changes.xml 3 Oct 2004 19:30:14 -0000 1.26
@@ -28,12 +28,15 @@
</properties>
<body>
<release version="3.2-SNAPSHOT" date="in CVS">
+ <action dev="carlos" type="add" issue="MPASPECTJ-12" due-to="Mark Proctor">Added
+ <code>maven.aspectj.argfiles</code> and
+ <code>maven.aspectj.weaveAspectSources</code> properties.</action>
<action dev="felipeal" type="add" issue="MPASPECTJ-13">Added
<code>maven.aspectj.noweave</code> and
- <code>maven.aspectj.lint</code>properties.</action>
+ <code>maven.aspectj.lint</code> properties.</action>
<action dev="carlos" type="fix">Added
<code>maven.aspectj.source</code> and
- <code>maven.aspectj.time</code>properties that where incorrectly removed.</action>
+ <code>maven.aspectj.time</code> properties that where incorrectly removed.</action>
</release>
<release version="3.1.1" date="2004-07-09">
<action dev="carlos" type="fix" issue="MPASPECTJ-11">Check that unitTestSourceDirectory is defined in pom</action>
1.11 +24 -0 maven-plugins/aspectj/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/xdocs/properties.xml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- properties.xml 5 Sep 2004 20:00:25 -0000 1.10
+++ properties.xml 3 Oct 2004 19:30:14 -0000 1.11
@@ -38,6 +38,30 @@
</tr>
<tr>
+ <td>maven.aspectj.argfiles</td>
+ <td>Yes</td>
+ <td>
+ List of argument files separated by commas.
+ An argument file contains a list of arguments read by the
+ compiler. Each line is read into one element of the argument
+ array and may include another argfile by reference.
+ If specified, <code>maven.aspectj.weaveAspectSources</code>
+ is set to a default <code>false</code> value.
+ </td>
+ </tr>
+
+ <tr>
+ <td>maven.aspectj.weaveAspectSources</td>
+ <td>Yes</td>
+ <td>
+ If true weave aspect sources in
+ <code>pom.build.aspectSourceDirectory</code>.
+ Default <code>true</code>, <code>false</code> if
+ <code>maven.aspectj.argfiles</code> is specified.
+ </td>
+ </tr>
+
+ <tr>
<td>maven.aspectj.sourceRootCopyFilter</td>
<td>Yes</td>
<td>
1.3 +10 -10 maven-plugins/aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj/Sample.aj
Index: Sample.aj
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj/Sample.aj,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Sample.aj 8 Jul 2004 11:27:58 -0000 1.2
+++ Sample.aj 3 Oct 2004 19:30:14 -0000 1.3
@@ -20,17 +20,17 @@
public aspect Sample
{
pointcut srcPointcut() :
- execution(public * org.apache.maven.aspectj.Dummy.someMethod());
+ execution(public * org.apache.maven.aspectj.Dummy.someMethod());
pointcut testPointcut() :
- execution(public * org.apache.maven.aspectj.AspectTest.someMethod());
+ execution(public * org.apache.maven.aspectj.AspectTest.someMethod());
- before() : srcPointcut()
- {
- throw new RuntimeException("test exception voluntarily raised and that should be caught in the test case");
- }
+ before() : srcPointcut()
+ {
+ throw new RuntimeException("test exception voluntarily raised and that should be caught in the test case");
+ }
- before() : testPointcut()
- {
- throw new RuntimeException("test exception voluntarily raised and that should be caught in the test case");
- }
+ before() : testPointcut()
+ {
+ throw new RuntimeException("test exception voluntarily raised and that should be caught in the test case");
+ }
}
1.1 maven-plugins/aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj/TestB.aj
Index: TestB.aj
===================================================================
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
public aspect TestB
{
pointcut srcPointcut(Dummy dummy) :
execution(public * org.apache.maven.aspectj.Dummy.isAspectBWeaved())
&& target(dummy);
before(Dummy dummy) : srcPointcut(dummy)
{
dummy.setAspectBWeaved(true);
}
}
1.1 maven-plugins/aspectj/src/plugin-test/src/aspect/org/apache/maven/aspectj/TestA.aj
Index: TestA.aj
===================================================================
package org.apache.maven.aspectj;
/* ====================================================================
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ====================================================================
*/
public aspect TestA
{
pointcut srcPointcut(Dummy dummy) :
execution(public * org.apache.maven.aspectj.Dummy.isAspectAWeaved())
&& target(dummy);
before(Dummy dummy) : srcPointcut(dummy)
{
dummy.setAspectAWeaved(true);
}
}
1.23 +22 -4 maven-plugins/aspectj/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/plugin.jelly,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- plugin.jelly 5 Sep 2004 21:17:50 -0000 1.22
+++ plugin.jelly 3 Oct 2004 19:30:14 -0000 1.23
@@ -30,6 +30,7 @@
xmlns:define="jelly:define"
xmlns:log="jelly:log"
xmlns:maven="jelly:maven"
+ xmlns:util="jelly:util"
xmlns:aspectj="aspectj">
<!--
@@ -62,12 +63,29 @@
<ant:setProperty name="maxmem" value="${maven.aspectj.maxmem}" />
</j:if>
</j:if>
-
+
+ <j:set var="weaveAspectSources" value="true"/>
+ <j:if test="${context.getVariable('maven.aspectj.argfiles') != null}">
+ <ant:argfiles>
+ <util:tokenize var="tokens" delim="," trim="true">${context.getVariable('maven.aspectj.argfiles')}</util:tokenize>
+ <j:forEach var="token" items="${tokens}">
+ <log:info>Using argument file ${token.trim()}</log:info>
+ <j:if test="${token != ''}">
+ <pathelement location="${token.trim()}" />
+ </j:if>
+ </j:forEach>
+ </ant:argfiles>
+ <j:set var="weaveAspectSources" value="false"/>
+ </j:if>
+ <j:if test="${context.getVariable('maven.aspectj.weaveAspectSources') != null}">
+ <j:set var="weaveAspectSources" value="${context.getVariable('maven.aspectj.weaveAspectSources')}"/>
+ </j:if>
+
<ant:sourceroots>
<ant:path refid="${sourcePathRefid}"/>
- <j:if test="${aspectSourcesPresent == 'true'}">
- <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
- </j:if>
+ <j:if test="${aspectSourcesPresent and weaveAspectSources}">
+ <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
+ </j:if>
</ant:sourceroots>
<ant:classpath>
1.8 +9 -0 maven-plugins/aspectj/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/plugin.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- plugin.properties 5 Sep 2004 20:00:25 -0000 1.7
+++ plugin.properties 3 Oct 2004 19:30:14 -0000 1.8
@@ -18,6 +18,15 @@
# Default properties for the AspectJ Plugin
# -------------------------------------------------------------------
+# List of argument files separated by commas.
+# An argument file contains a list of arguments read by the compiler.
+# Each line is read into one element of the argument array and may include
+# another argfile by reference.
+#maven.aspectj.argfiles=
+
+# If true weave aspect sources in pom.build.aspectSourceDirectory
+#maven.aspectj.weaveAspectSources=true
+
# List of resource files to exclude when copying resources from the input
# jar to the weaved output jar
maven.aspectj.sourceRootCopyFilter = **/CVS/*,**/*.java,**/*.aj
1.3 +13 -2 maven-plugins/aspectj/src/plugin-test/src/test/org/apache/maven/aspectj/AspectTest.java
Index: AspectTest.java
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/src/plugin-test/src/test/org/apache/maven/aspectj/AspectTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AspectTest.java 8 Jul 2004 11:27:58 -0000 1.2
+++ AspectTest.java 3 Oct 2004 19:30:14 -0000 1.3
@@ -20,12 +20,13 @@
public class AspectTest extends TestCase
{
-
+
private static final String EXCEPTION_MESSAGE = "test exception " +
"voluntarily raised and that should be caught in the test case";
-
+
public void testSourceIsCorrectlyWeaved()
{
+ String argfiles = System.getProperty("maven.aspectj.argfiles");
Dummy dummy = new Dummy();
try
{
@@ -34,6 +35,16 @@
} catch (Exception expected)
{
assertEquals(EXCEPTION_MESSAGE, expected.getMessage());
+ }
+
+ if (argfiles == null)
+ {
+ assertTrue(dummy.isAspectAWeaved());
+ assertTrue(dummy.isAspectBWeaved());
+ } else
+ {
+ assertTrue(dummy.isAspectAWeaved());
+ assertFalse(dummy.isAspectBWeaved());
}
}
1.3 +9 -3 maven-plugins/aspectj/src/plugin-test/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/src/plugin-test/maven.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- maven.xml 8 Jul 2004 11:27:58 -0000 1.2
+++ maven.xml 3 Oct 2004 19:30:14 -0000 1.3
@@ -16,14 +16,20 @@
*/
-->
<project xmlns:util="jelly:util" xmlns:j="jelly:core">
-
- <goal name="testPlugin" prereqs="clean,test-aspectj-compile">
+
+ <goal name="testPlugin" prereqs="clean,test-aspectj-compile,test-optional-aspectj-compile">
</goal>
-
+
<goal name="test-aspectj-compile">
<attainGoal name="aspectj:test-compile"/>
<attainGoal name="test:test"/>
<attainGoal name="clean"/>
+ </goal>
+
+ <goal name="test-optional-aspectj-compile">
+ <j:set var="maven.junit.sysproperties" value="maven.aspectj.argfiles" />
+ <j:set var="maven.aspectj.argfiles" value="argfile.lst" />
+ <attainGoal name="test-aspectj-compile"/>
</goal>
</project>
1.1 maven-plugins/aspectj/src/plugin-test/argfile.lst
Index: argfile.lst
===================================================================
src\aspect\org\apache\maven\aspectj\Sample.aj
src\aspect\org\apache\maven\aspectj\TestA.aj
1.2 +26 -1 maven-plugins/aspectj/src/plugin-test/src/main/org/apache/maven/aspectj/Dummy.java
Index: Dummy.java
===================================================================
RCS file: /home/cvs/maven-plugins/aspectj/src/plugin-test/src/main/org/apache/maven/aspectj/Dummy.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Dummy.java 7 May 2004 23:09:22 -0000 1.1
+++ Dummy.java 3 Oct 2004 19:30:14 -0000 1.2
@@ -19,7 +19,32 @@
public class Dummy
{
+
+ private boolean aspectA;
+
+ private boolean aspectB;
+
public void someMethod()
{
}
-}
\ No newline at end of file
+
+ public boolean isAspectAWeaved()
+ {
+ return this.aspectA;
+ }
+
+ public boolean isAspectBWeaved()
+ {
+ return this.aspectB;
+ }
+
+ public void setAspectAWeaved(boolean isSet)
+ {
+ this.aspectA = isSet;
+ }
+
+ public void setAspectBWeaved(boolean isSet)
+ {
+ this.aspectB = isSet;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org