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/06/19 21:14:53 UTC

cvs commit: maven-plugins/aspectj project.xml plugin.jelly

carlos      2004/06/19 12:14:53

  Modified:    aspectj/xdocs changes.xml goals.xml index.xml
               aspectj  project.xml plugin.jelly
  Log:
  Weave test classes
  
  Revision  Changes    Path
  1.17      +3 -0      maven-plugins/aspectj/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/changes.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- changes.xml	17 Jun 2004 18:09:20 -0000	1.16
  +++ changes.xml	19 Jun 2004 19:14:52 -0000	1.17
  @@ -28,6 +28,9 @@
     </properties>
     <body>
       <release version="3.1-SNAPSHOT" date="in CVS">
  +      <action dev="carlos" type="add" issue="MPASPECTJ-6">
  +        Weave test classes
  +      </action>
         <action dev="carlos" type="add" issue="MPASPECTJ-10">
           Added "Compiling aspect sources" section to xdoc
         </action>
  
  
  
  1.6       +7 -1      maven-plugins/aspectj/xdocs/goals.xml
  
  Index: goals.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/goals.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- goals.xml	7 May 2004 19:19:10 -0000	1.5
  +++ goals.xml	19 Jun 2004 19:14:52 -0000	1.6
  @@ -32,13 +32,19 @@
           <name>aspectj</name>
           <description>
               This is the default goal of the plugin and simply attains
  -            the <code>aspectj:compile</code> goal.
  +            the <code>aspectj:test-compile</code> goal.
           </description>
         </goal>
         <goal>
           <name>aspectj:compile</name>
           <description>
               Weaves project classes and dependency libraries.
  +        </description>
  +      </goal>
  +      <goal>
  +        <name>aspectj:test-compile</name>
  +        <description>
  +            Weaves project test classes after calling <code>aspectj:compile</code>.
           </description>
         </goal>
       </goals>
  
  
  
  1.7       +11 -2     maven-plugins/aspectj/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/index.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- index.xml	17 Jun 2004 18:23:38 -0000	1.6
  +++ index.xml	19 Jun 2004 19:14:52 -0000	1.7
  @@ -128,11 +128,20 @@
         add the following to your maven.xml file.
         </p>
         <source>
  -          <![CDATA[
  +         <![CDATA[
  +           <preGoal name="java:compile">
  +             <attainGoal name="aspectj"/>
  +           </preGoal>
  +         ]]>
  +      </source>
  +      <p>If you don't want to weave test classes use the following code instead.
  +      </p>
  +      <source>
  +         <![CDATA[
              <preGoal name="java:compile">
                <attainGoal name="aspectj:compile"/>
              </preGoal>
  -          ]]>
  +         ]]>
         </source>
       </section>
   
  
  
  
  1.37      +15 -4     maven-plugins/aspectj/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/project.xml,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- project.xml	3 Jun 2004 11:53:16 -0000	1.36
  +++ project.xml	19 Jun 2004 19:14:53 -0000	1.37
  @@ -78,12 +78,18 @@
           <role>Documentation</role>
         </roles>
       </developer>
  -  </developers>
  -  <contributors>
  -    <contributor>
  +    <developer>
         <name>Carlos Sanchez</name>
  +      <id>carlos</id>
         <email>carlossg@users.sourceforge.net</email>
  -    </contributor>
  +      <organization/>
  +      <roles>
  +        <role>Java Developer</role>
  +        <role>Documentation</role>
  +      </roles>
  +    </developer>
  +  </developers>
  +  <contributors>
       <contributor>
         <name>Charlie Harvey</name>
         <email>sbzoom@yahoo.com</email>
  @@ -99,6 +105,11 @@
         <groupId>aspectj</groupId>
         <artifactId>aspectjtools</artifactId>
         <version>1.2</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>junit</groupId>
  +      <artifactId>junit</artifactId>
  +      <version>3.8.1</version>
       </dependency>
     </dependencies>
   </project>
  
  
  
  1.14      +109 -55   maven-plugins/aspectj/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/plugin.jelly,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- plugin.jelly	17 Jun 2004 18:07:50 -0000	1.13
  +++ plugin.jelly	19 Jun 2004 19:14:53 -0000	1.14
  @@ -30,16 +30,87 @@
   
   <project
     xmlns:j="jelly:core"
  -  xmlns:ant="jelly:ant">
  +  xmlns:ant="jelly:ant"
  +  xmlns:define="jelly:define"
  +  xmlns:test="test"
  +  xmlns:aspectj="aspectj">
   
     <!--
  +  Taglib to compile aspects
  +  
  +  Parameters:
  +    - sourcePathRefid
  +    - classpathRefid
  +    - destDir
  +  -->
  +  <define:taglib uri="aspectj">
  +
  +    <define:tag name="compile">
  +
  +      <ant:iajc
  +          fork="${maven.aspectj.fork}"
  +          incremental="${maven.aspectj.incremental}"
  +          destDir="${destDir}"
  +          sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilter}"
  +          debug="${maven.aspectj.debug}"
  +          emacssym="${maven.aspectj.emacssym}"
  +          verbose="${maven.aspectj.verbose}">
  +
  +        <j:if test="${context.getVariable('maven.aspectj.fork') == true}">
  +          <j:if test="${context.getVariable('maven.aspectj.maxmem') != null}">
  +            <ant:setProperty name="maxmem" value="${maven.aspectj.maxmem}" />
  +          </j:if>
  +        </j:if>
  +        
  +        <ant:sourceroots>
  +          <ant:path refid="${sourcePathRefid}"/>
  +          <j:if test="${aspectSourcesPresent == 'true'}">
  +            <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
  +          </j:if>
  +        </ant:sourceroots>
  +
  +        <ant:classpath>
  +          <ant:path refid="${classpathRefid}"/>
  +          <ant:pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  +          <ant:pathelement path="${maven.build.dest}"/>
  +        </ant:classpath>
  +
  +        <!-- Look for aspect libraries to use for weaving -->
  +        <ant:aspectpath>
  +          <j:forEach var="artifact" items="${pom.artifacts}">
  +            <j:set var="dep" value="${artifact.dependency}"/>
  +            <j:if test="${dep.getProperty('aspectj.weaveWith')=='true'}">
  +              <ant:echo>Weaving with: ${dep.artifactId}</ant:echo>
  +              <ant:pathelement location="${artifact.path}"/>
  +            </j:if>
  +          </j:forEach>
  +        </ant:aspectpath>
  +
  +        <!-- Look for libraries for weaving into -->
  +        <ant:inpath>
  +          <j:forEach var="artifact" items="${pom.artifacts}">
  +            <j:set var="dep" value="${artifact.dependency}"/>
  +            <j:if test="${dep.getProperty('aspectj.weaveInto')=='true'}">
  +              <ant:echo>Weaving into: ${dep.artifactId}</ant:echo>
  +              <ant:pathelement location="${artifact.path}"/>
  +            </j:if>
  +          </j:forEach>
  +        </ant:inpath>
  +
  +      </ant:iajc>
  +      
  +
  +    </define:tag>
  +
  +  </define:taglib>
  +  
  +  <!--
       ========================================================================
       Default goal.
       ========================================================================
     -->
  -  <goal name="aspectj" description="Weave with AspectJ">
  -      <attainGoal name="aspectj:compile"/>
  -  </goal>
  +  <goal name="aspectj" description="Weave with AspectJ"
  +    prereqs="aspectj:test-compile"/>
   
     <!--
       ========================================================================
  @@ -87,69 +158,52 @@
   
     <!--
       ========================================================================
  -    Weave aspect classes
  +    Weave classes
       ========================================================================
     -->
     <goal name="aspectj:compile" prereqs="aspectj:init"
  -    description="Weave with AspectJ">
  +    description="Weave classes with AspectJ">
   
       <j:if test="${shouldWeave == 'true'}">
   
  -      <ant:iajc
  -          fork="${maven.aspectj.fork}"
  -          incremental="${maven.aspectj.incremental}"
  -          destDir="${maven.build.dest}"
  -          sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilter}"
  -          debug="${maven.aspectj.debug}"
  -          emacssym="${maven.aspectj.emacssym}"
  -          verbose="${maven.aspectj.verbose}"
  -          source="${maven.aspectj.source}"
  -          time="${maven.aspectj.time}">
  -
  -        <j:if test="${context.getVariable('maven.aspectj.fork') == true}">
  -          <j:if test="${context.getVariable('maven.aspectj.maxmem') != null}">
  -            <ant:setProperty name="maxmem" value="${maven.aspectj.maxmem}" />
  -          </j:if>
  -        </j:if>
  -
  -        <ant:sourceroots>
  -          <ant:path refid="maven.compile.src.set"/>
  -          <j:if test="${aspectSourcesPresent == 'true'}">
  -            <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
  -          </j:if>
  -        </ant:sourceroots>
  +      <!-- Weave classes -->
  +      <aspectj:compile
  +        sourcePathRefid="maven.compile.src.set"
  +        classpathRefid="maven.dependency.classpath"
  +        destDir="${maven.build.dest}"/>
   
  -        <ant:classpath>
  -          <ant:path refid="maven.dependency.classpath"/>
  -          <ant:pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  -          <ant:pathelement path="${maven.build.dest}"/>
  -        </ant:classpath>
  +    </j:if>
   
  -        <!-- Look for aspect libraries to use for weaving -->
  -        <ant:aspectpath>
  -          <j:forEach var="artifact" items="${pom.artifacts}">
  -            <j:set var="dep" value="${artifact.dependency}"/>
  -            <j:if test="${dep.getProperty('aspectj.weaveWith')=='true'}">
  -              <ant:echo>Weaving with: ${dep.artifactId}</ant:echo>
  -              <ant:pathelement location="${artifact.path}"/>
  -            </j:if>
  -          </j:forEach>
  -        </ant:aspectpath>
  +  </goal>
  +  
  +  <!--
  +    ========================================================================
  +    Weave test classes
  +    ========================================================================
  +  -->
  +  <goal name="aspectj:test-compile" prereqs="aspectj:compile"
  +    description="Weave tests with AspectJ">
   
  -        <!-- Look for libraries for weaving into -->
  -        <ant:inpath>
  -          <j:forEach var="artifact" items="${pom.artifacts}">
  -            <j:set var="dep" value="${artifact.dependency}"/>
  -            <j:if test="${dep.getProperty('aspectj.weaveInto')=='true'}">
  -              <ant:echo>Weaving into: ${dep.artifactId}</ant:echo>
  -              <ant:pathelement location="${artifact.path}"/>
  -            </j:if>
  -          </j:forEach>
  -        </ant:inpath>
  +    <j:if test="${shouldWeave == 'true'}">
   
  -      </ant:iajc>
  +      <!-- By calling a goal from the test plugin we ensure that all its 
  +           properties are loaded and are thus accessible from this plugin -->
  +      <test:dependency-handle/>
  +      <j:set var="testPlugin" value="${pom.getPluginContext('maven-test-plugin')}"/>
  +
  +      <!-- Weave test classes -->
  +      <ant:path id="testClasspath">
  +        <ant:path refid="maven.dependency.classpath"/>
  +        <ant:pathelement path="${plugin.getDependencyPath('junit')}"/>
  +      </ant:path>
  +
  +      <aspectj:compile
  +        sourcePathRefid="maven.test.compile.src.set"
  +        classpathRefid="testClasspath"
  +        destDir="${maven.test.dest}"/>
   
       </j:if>
  +
     </goal>
     
   </project>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org