MPASPECTJ-12 Added maven.aspectj.argfiles and maven.aspectj.weaveAspectSources properties.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
carlos committed 2004-10-03 19:30:14 +00:00
1 parent d1ba3f8fd8
commit 683739220b
11 files changed
+180 -22

No files matched your search

+22 -4
View File
@@ -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>
+9
View File
@@ -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
+2
View File
@@ -0,0 +1,2 @@
src\aspect\org\apache\maven\aspectj\Sample.aj
src\aspect\org\apache\maven\aspectj\TestA.aj
+9 -3
View File
@@ -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>
@@ -20,17 +20,17 @@ package org.apache.maven.aspectj;
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");
}
}
@@ -0,0 +1,30 @@
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);
}
}
@@ -0,0 +1,30 @@
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);
}
}
@@ -19,7 +19,32 @@ package org.apache.maven.aspectj;
public class Dummy
{
private boolean aspectA;
private boolean aspectB;
public void someMethod()
{
}
}
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;
}
}
@@ -20,12 +20,13 @@ import junit.framework.TestCase;
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
{
@@ -35,6 +36,16 @@ public class AspectTest extends TestCase
{
assertEquals(EXCEPTION_MESSAGE, expected.getMessage());
}
if (argfiles == null)
{
assertTrue(dummy.isAspectAWeaved());
assertTrue(dummy.isAspectBWeaved());
} else
{
assertTrue(dummy.isAspectAWeaved());
assertFalse(dummy.isAspectBWeaved());
}
}
public void testTestIsCorrectlyWeaved()
+5 -2
View File
@@ -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>
+24
View File
@@ -37,6 +37,30 @@
<th>Description</th>
</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>