PR: MPASPECTJ-14

Submitted by: Alexey Dashkevich
Unable to weave only sources defined in argument files.
New property maven.aspectj.src.argfilesOnly.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@390240 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl
2006-03-30 21:08:35 +00:00
parent 5164cf086d
commit f96417c014
10 changed files with 136 additions and 6 deletions

View File

@@ -88,10 +88,12 @@
</j:if>
<ant:sourceroots>
<ant:path refid="${sourcePathRefid}"/>
<j:if test="${aspectSourcesPresent and weaveAspectSources}">
<ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
</j:if>
<j:if test="${context.getVariable('maven.aspectj.src.argfilesOnly') != 'true'}">
<ant:path refid="${sourcePathRefid}"/>
</j:if>
<j:if test="${aspectSourcesPresent and weaveAspectSources}">
<ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
</j:if>
</ant:sourceroots>
<ant:classpath>

View File

@@ -24,6 +24,11 @@
# another argfile by reference.
#maven.aspectj.argfiles=
# If true, only sources that are defined in argument files will be weaved.
# By default weave sources from argument files and from build sources path
# or test sources path.
#maven.aspectj.src.argfilesOnly=false
# If true weave aspect sources in pom.build.aspectSourceDirectory
#maven.aspectj.weaveAspectSources=true

View File

@@ -1,2 +1,3 @@
src/aspect/org/apache/maven/aspectj/Sample.aj
src/aspect/org/apache/maven/aspectj/TestA.aj
src/aspect/org/apache/maven/aspectj/TestA.aj
src/aspect/org/apache/maven/aspectj/BOTest.aj

View File

@@ -0,0 +1,2 @@
src/aspect/org/apache/maven/aspectj/BOTest.aj
src/main/org/apache/maven/aspectj/BO.java

View File

@@ -17,7 +17,7 @@
-->
<project xmlns:util="jelly:util" xmlns:j="jelly:core">
<goal name="testPlugin" prereqs="clean,test-aspectj-compile,test-optional-aspectj-compile">
<goal name="testPlugin" prereqs="clean,test-aspectj-compile,test-optional-aspectj-compile,test-mix-aspectj-compile">
</goal>
<goal name="test-aspectj-compile">
@@ -32,4 +32,14 @@
<attainGoal name="test-aspectj-compile"/>
</goal>
<goal name="test-mix-aspectj-compile">
<j:set var="maven.aspectj.argfiles" value="argfilemix.lst" />
<j:set var="maven.aspectj.src.argfilesOnly" value="true"/>
<j:set var="testcase" value="org.apache.maven.aspectj.AspectBOTest"/>
<attainGoal name="aspectj:compile"/>
<attainGoal name="test:single"/>
<attainGoal name="clean"/>
</goal>
</project>

View File

@@ -0,0 +1,29 @@
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 BOTest
{
pointcut mockupPointcut() :
execution(public * org.apache.maven.aspectj.BO.findByKey(..));
BO around() : mockupPointcut()
{
return new BO("dummy");
}
}

View File

@@ -0,0 +1,38 @@
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 class BO
{
private String id;
public BO(String id){
this.id = id;
}
public static BO findByKey(String id)
{
//some code with connection to database
return null;
}
public String getId(){
return this.id;
}
}

View File

@@ -0,0 +1,32 @@
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.
* ====================================================================
*/
import junit.framework.TestCase;
public class AspectBOTest extends TestCase
{
public void testSourceIsCorrectlyWeaved()
{
BO bo = BO.findByKey("test");
assertNotNull(bo);
assertEquals("dummy", bo.getId());
}
}

View File

@@ -28,6 +28,7 @@
</properties>
<body>
<release version="4.0-SNAPSHOT" date="in SVN">
<action dev="ltheussl" type="fix" issue="MPASPECTJ-14" due-to="Alexey Dashkevich">Unable to weave only sources defined in argument files. New property <code>maven.aspectj.src.argfilesOnly</code>.</action>
<action dev="ltheussl" type="add" issue="MPASPECTJ-23" due-to="Shinobu Kawai Yoshida">Add a report for the plugin.</action>
<action dev="carlos" type="update" issue="MPASPECTJ-21">Upgraded to AspectJ 1.5.0</action>
<action dev="carlos" type="add" issue="MPASPECTJ-24" due-to="Shinobu Kawai">

View File

@@ -61,6 +61,16 @@
</td>
</tr>
<tr>
<td>maven.aspectj.src.argfilesOnly</td>
<td>Yes</td>
<td>
If true, only sources that are defined in argument files will be weaved.
By default, weave sources from argument files and from build-
or test sources path.
</td>
</tr>
<tr>
<td>maven.aspectj.sourceRootCopyFilter</td>
<td>Yes</td>