You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by vm...@apache.org on 2003/12/27 14:11:25 UTC

cvs commit: maven-plugins/aspectwerkz/src/plugin-test maven.xml project.properties

vmassol     2003/12/27 05:11:25

  Modified:    aspectwerkz plugin.jelly plugin.properties
               aspectwerkz/xdocs properties.xml goals.xml
               aspectwerkz/src/plugin-test maven.xml project.properties
  Log:
  - Ok, I think I now better understand how AW works. The plugin should be in a workable state for attribdef style. It has not been fully tested for xmldef style yet.
  - The next step is probably to add support for executing java applications using the different AW bootstrapping mechanisms
  
  Revision  Changes    Path
  1.8       +135 -46   maven-plugins/aspectwerkz/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectwerkz/plugin.jelly,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- plugin.jelly	26 Dec 2003 14:11:44 -0000	1.7
  +++ plugin.jelly	27 Dec 2003 13:11:25 -0000	1.8
  @@ -3,6 +3,13 @@
   <!--
     =============================================================================
       AspectWerkz plugin for Maven.
  +    
  +    Definition: AW supports 2 types of Aspects/Advice/Pointcuts definition: 
  +    - xmldef   : Advice are defined as extending *Advice classes (BeforeAdvice,
  +                 AroundAdvice, etc). Custom javadoc attributes can be used to 
  +                 link code to weave with advices.
  +    - attribdef: Advices and pcds are defined purely using custom javadoc
  +                 attributes (@Execute, @Aspect, etc).
     =============================================================================
   -->
   <project 
  @@ -19,6 +26,26 @@
   
       <ant:mkdir dir="${maven.build.dir}"/>
   
  +    <!-- Location of the XML definition file. If "xmldef" mode is used, then 
  +         the location of thus file is the location where attributec has 
  +         generated its xml file
  +         (i.e. ${maven.aspectwerkz.build.definition.file}). If "attribdef"
  +         mode is used then this property should point to its source 
  +         location. -->
  +    <j:choose>
  +      <j:when test="${context.getVariable('maven.aspectwerkz.mode') == 'xmldef'}">
  +        <j:set var="maven.aspectwerkz.definition.file"
  +            value="${maven.aspectwerkz.definition.file.build}"/>
  +      </j:when>
  +      <j:when test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
  +        <j:set var="maven.aspectwerkz.definition.file"
  +            value="${maven.aspectwerkz.definition.file.src}"/>
  +      </j:when>
  +      <j:otherwise>
  +        <ant:fail>Valid values for [maven.aspectwerkz.mode] are [xmldef] and [attribdef] only.</ant:fail>
  +      </j:otherwise>
  +    </j:choose>
  +
       <path id="classpath.main">
           <ant:pathelement location="${maven.dependency.classpath}"/>
           <ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz')}"/>
  @@ -30,72 +57,134 @@
   
     <!--
        ========================================================================
  -       Compile AW javadoc attributes.
  +       Compile javadoc attributes and generate an XML definition file. Used
  +       only in xmldef mode.
        ========================================================================
     -->
     <goal name="aspectwerkz:attributec" prereqs="aspectwerkz:init"
  -    description="Compile AspectWerkz javadoc attributes">
  +      description="Compile AspectWerkz javadoc attributes (xml-defined aspects)">
   
  -    <!-- TODO: only run attributeC if sources are newer than target
  -         XML definition file -->
  +    <j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'xmldef'}">
  +      
  +      <!-- TODO: only run attributeC if sources are newer than target
  +           XML definition file -->
                
  -    <ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
  -        classname="org.codehaus.aspectwerkz.metadata.AttributeC">
  +      <ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
  +          classname="org.codehaus.aspectwerkz.metadata.AttributeC">
   
  -      <ant:sysproperty key="aspectwerkz.definition.validate" 
  -          value="${maven.aspectwerkz.definition.validate}"/>
  +        <ant:sysproperty key="aspectwerkz.definition.validate" 
  +            value="${maven.aspectwerkz.definition.validate}"/>
   
  -      <ant:arg file="${maven.aspectwerkz.src.dir}"/>
  -      <ant:arg file="${maven.aspectwerkz.build.definition.file}"/>
  -      <j:if test="${context.getVariable('maven.aspectwerkz.definition.merge.file') != null}">
  -        <ant:arg line="-m ${maven.aspectwerkz.definition.merge.file}"/>
  -      </j:if>
  -      <j:if test="${context.getVariable('maven.aspectwerkz.uuid') != null}">
  -        <ant:arg line="-u ${maven.aspectwerkz.uuid}"/>
  -      </j:if>
  -
  -      <ant:classpath>
  -        <ant:path refid="classpath.main"/>
  -        <ant:pathelement location="${plugin.getDependencyPath('qdox:qdox')}"/>
  -        <ant:pathelement location="${plugin.getDependencyPath('jrexx:jrexx')}"/>
  -      </ant:classpath>
  +        <ant:arg file="${maven.aspectwerkz.src.dir}"/>
  +        <ant:arg file="${maven.aspectwerkz.definition.file}"/>
  +        <j:if test="${context.getVariable('maven.aspectwerkz.definition.file.merge') != null}">
  +          <ant:arg line="-m ${maven.aspectwerkz.definition.file.merge}"/>
  +        </j:if>
  +        <j:if test="${context.getVariable('maven.aspectwerkz.uuid') != null}">
  +          <ant:arg line="-u ${maven.aspectwerkz.uuid}"/>
  +        </j:if>
  +
  +        <ant:classpath>
  +          <ant:path refid="classpath.main"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('qdox:qdox')}"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('jrexx:jrexx')}"/>
  +        </ant:classpath>
   
  -    </ant:java>
  +      </ant:java>
  +
  +    </j:if>
   
     </goal>
   
     <!--
        ========================================================================
  -       Tranform source code by weaving aspects to them (offline mode).
  +       Weave aspects at build time (offline mode). Works for both "xmldef"
  +       and "attribdef" modes.
        ========================================================================
     -->
  -  <goal name="aspectwerkz:transform" 
  -    prereqs="aspectwerkz:init,aspectwerkz:attributec,java:compile"
  -    description="Weave aspects to sources (offline mode)">
  +  <goal name="aspectwerkz:weave" 
  +      prereqs="aspectwerkz:aspectc,aspectwerkz:aspectwerkc"
  +      description="Weave aspects (offline mode)"/>
   
  -    <!-- TODO: Add support for extension classes -->
  -    
  -    <ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
  -        classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC">
  +  <!--
  +     ========================================================================
  +       Weave "attribdef" aspects at build time (offline mode).
  +     ========================================================================
  +  -->
  +  <goal name="aspectwerkz:aspectc" prereqs="aspectwerkz:init,java:compile">
  +
  +    <j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
  +
  +      <!-- TODO: only run aspectc if sources are newer than target
  +           XML definition file -->
  +
  +      <ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
  +          classname="org.codehaus.aspectwerkz.attribdef.definition.AspectC">
  +
  +        <j:if test="${context.getVariable('maven.aspectwerkz.verbose') == 'true'}">
  +          <ant:arg value="-verbose"/>
  +        </j:if>
  +
  +        <!-- Path to source dir -->
  +        <ant:arg file="${maven.aspectwerkz.src.dir}"/>
  +
  +        <!-- Path to classes dir -->
  +        <ant:arg file="${maven.build.dest}"/>
  +
  +        <!-- (optional) Path to where weaved classes will be generated -->
  +        <ant:arg file="${maven.aspectwerkz.build.dir}"/>
   
  -      <ant:sysproperty key="aspectwerkz.transform.verbose" 
  -          value="${maven.aspectwerkz.transform.verbose}"/>
  -      <ant:sysproperty key="aspectwerkz.transform.filter" 
  -          value="${maven.aspectwerkz.transform.filter}"/>
  -      <ant:sysproperty key="aspectwerkz.definition.file" 
  -          value="${maven.aspectwerkz.definition.file}"/>
  +        <ant:classpath>
  +          <ant:path refid="classpath.main"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz-core')}"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('qdox:qdox')}"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('bcel:bcel')}"/>
  +        </ant:classpath>
  +         
  +      </ant:java>
   
  -      <ant:arg value="-verify"/>
  -      <ant:arg file="${maven.build.dest}"/>
  +    </j:if>
  +
  +  </goal>
  +
  +  <!--
  +     ========================================================================
  +       Weave "xmldef" aspects at build time (offline mode).
  +     ========================================================================
  +  -->
  +  <goal name="aspectwerkz:aspectwerkc"
  +      prereqs="aspectwerkz:init,aspectwerkz:attributec,java:compile">
  +
  +    <j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'xmldef'}">
  +
  +      <!-- TODO: Add support for extension classes -->
  +
  +      <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:classpath>
  -        <ant:path refid="classpath.main"/>
  -        <ant:pathelement location="${plugin.getDependencyPath('ant:ant')}"/>
  -        <ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz-core')}"/>
  -        <ant:pathelement location="${plugin.getDependencyPath('bcel:bcel')}"/>
  -      </ant:classpath>      
  +        <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 file="${maven.aspectwerkz.build.dir}"/>
  +        
  +        <ant:classpath>
  +          <ant:path refid="classpath.main"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('ant:ant')}"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz-core')}"/>
  +          <ant:pathelement location="${plugin.getDependencyPath('bcel:bcel')}"/>
  +        </ant:classpath>      
     
  -    </ant:java>
  +      </ant:java>
  +
  +    </j:if>
       
     </goal>
       
  
  
  
  1.6       +38 -8     maven-plugins/aspectwerkz/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectwerkz/plugin.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- plugin.properties	26 Dec 2003 14:11:44 -0000	1.5
  +++ plugin.properties	27 Dec 2003 13:11:25 -0000	1.6
  @@ -1,22 +1,52 @@
  +#============================================================================
  +# Properties for the AspectWerkz plugin for Maven
  +# ===========================================================================
  +
  +# AW supports 2 types of Aspects/Advice/Pointcuts definition: 
  +# - xmldef   : Advice are defined as extending *Advice classes (BeforeAdvice,
  +#              AroundAdvice, etc). Custom javadoc attributes can be used to 
  +#              link code to weave with advices.
  +# - attribdef: Advices and pcds are defined purely using custom javadoc
  +#              attributes (@Execute, @Aspect, etc).
  +# You need to tell the plugin how you have defined your AW 
  +# Aspects/Advices/Pointcuts. The 2 valid values are "xmldef" and "attribdef".
  +maven.aspectwerkz.mode = attribdef
  +
   # Location of AW sources
   maven.aspectwerkz.src.dir = ${basedir}/src/main
   
  -# Location of the AW XML definition file that will be created by the
  -# attribute compilation (when calling <aspectwerkz:attributeC>).
  -maven.aspectwerkz.build.definition.file = ${maven.build.dir}/aspectwerkz.xml
  +# Location where weaved classes will be generated.
  +maven.aspectwerkz.build.dir = ${maven.build.dest}
   
   # Decide whether definition validation is turned on or off.
   maven.aspectwerkz.definition.validate = false
   
  -maven.aspectwerkz.definition.file = ${maven.aspectwerkz.build.definition.file}
  +# Verbose mode
  +maven.aspectwerkz.verbose = false
  +
  +#----------------------------------------------------------------------------
  +# attribdef mode properties
  +# ---------------------------------------------------------------------------
  +
  +# Location of the XML definition file.
  +maven.aspectwerkz.definition.file.src = ${basedir}/conf/aspectwerkz.xml
  +
  +#----------------------------------------------------------------------------
  +# xmldef mode properties
  +# ---------------------------------------------------------------------------
  +
  +# Location of the AW XML definition file that will be created by the
  +# attribute compilation (when calling <aspectwerkz:attributeC>). This is only
  +# used in "xmldef" mode.
  +maven.aspectwerkz.definition.file.build = ${maven.build.dir}/aspectwerkz.xml
   
  +# TODO: explain property here
   maven.aspectwerkz.transform.filter = no
  -maven.aspectwerkz.transform.verbose = no
   
   # (optional). Definition file to be merged with the main definition file. 
  -# Used by the <aspectwerkz:attributeC> goal.
  -# maven.aspectwerkz.definition.merge.file =
  +# Used by the <aspectwerkz:attributeC> goal. Only for "xmldef" mode.
  +# maven.aspectwerkz.definition.file.merge =
   
   # (optional). UUID to use. If not specified a default one will be automatically
  -# generated. Used by the <aspectwerkz:attributeC> goal.
  +# generated. Used by the <aspectwerkz:attributeC> goal. Only for "xmldef" mode.
   # maven.aspectwerkz.uuid = 
  
  
  
  1.4       +84 -8     maven-plugins/aspectwerkz/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectwerkz/xdocs/properties.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- properties.xml	26 Dec 2003 12:55:20 -0000	1.3
  +++ properties.xml	27 Dec 2003 13:11:25 -0000	1.4
  @@ -6,7 +6,7 @@
       <author email="vmassol@apache.org">Vincent Massol</author>
     </properties>
     <body>
  -    <section name="AspectWerkz properties">
  +    <section name="AspectWerkz generic properties">
         <table>
           <tr>
             <th>Property</th>
  @@ -14,21 +14,43 @@
             <th>Description</th>
           </tr>
           <tr>
  +          <td>maven.aspectwerkz.mode</td>
  +          <td>Yes</td>
  +          <td>
  +            AW supports 2 types of Aspects/Advice/Pointcuts definition: 
  +            <ul>
  +              <li>
  +                <strong>xmldef</strong>: Advice are defined as extending 
  +                *Advice classes (BeforeAdvice, AroundAdvice, etc). Custom 
  +                javadoc attributes can be used to link code to weave with 
  +                advices.
  +              </li>
  +              <li>
  +                <strong>attribdef</strong>: Advices and pcds are defined 
  +                purely using custom javadoc attributes (@Execute, @Aspect,
  +                etc).
  +              </li>
  +            </ul>
  +            You need to tell the plugin how you have defined your AW 
  +            Aspects/Advices/Pointcuts. The 2 valid values are 
  +            <code>xmldef</code> and <code>attribdef</code>.
  +            The default value is <code>attribdef</code>.
  +          </td>
  +        </tr>
  +        <tr>
             <td>maven.aspectwerkz.src.dir</td>
             <td>Yes</td>
             <td>
               Location of aspect sources. Default location is
  -            <code>${basedir}/src/aspectwerkz</code>.
  +            <code>${basedir}/src/main</code>.
             </td>
           </tr>
           <tr>
  -          <td>maven.aspectwerkz.build.definition.file</td>
  +          <td>maven.aspectwerkz.build.dir</td>
             <td>Yes</td>
             <td>
  -            Location of the AW XML definition file that will be created by the
  -            attribute compilation (when calling the 
  -            <code>aspectwerkz:attributeC</code> goal). Defaults to
  -            <code>${maven.build.dir}/aspectwerkz.xml</code>.
  +            Location where weaved classes will be generated. Default to
  +            <code>${maven.build.dest}</code>.
             </td>
           </tr>
           <tr>
  @@ -40,7 +62,54 @@
             </td>
           </tr>
           <tr>
  -          <td>maven.aspectwerkz.definition.merge.file</td>
  +          <td>maven.aspectwerkz.verbose</td>
  +          <td>Yes</td>
  +          <td>
  +            Decide whether to use verbose output or not during execution of
  +            this plugin's goals. Defaults to <code>false</code>.
  +          </td>
  +        </tr>
  +      </table>
  +    </section>
  +
  +    <section name="AspectWerkz properties specific to 'attribdef' mode">
  +      <table>
  +        <tr>
  +          <th>Property</th>
  +          <th>Optional?</th>
  +          <th>Description</th>
  +        </tr>
  +        <tr>
  +          <td>maven.aspectwerkz.definition.file.src</td>
  +          <td>Yes</td>
  +          <td>
  +            Location of the XML definition file. Default to
  +            <code>${basedir}/conf/aspectwerkz.xml</code>.
  +          </td>
  +        </tr>
  +      </table>
  +    </section>
  +
  +    <section name="AspectWerkz properties specific to 'xmldef' mode">
  +      <table>
  +        <tr>
  +          <th>Property</th>
  +          <th>Optional?</th>
  +          <th>Description</th>
  +        </tr>
  +        <tr>
  +          <td>maven.aspectwerkz.definition.file.build</td>
  +          <td>Yes</td>
  +          <td>
  +            Location of the AW XML definition file that will be created by the
  +            attribute compilation (when calling the 
  +            <code>aspectwerkz:attributec</code> goal). This is only used in 
  +            <code>xmldef</code> mode. Defaults to
  +            <code>${maven.build.dir}/aspectwerkz.xml</code>.
  +          </td>
  +        </tr>
  +        <tr>
  +          <td>maven.aspectwerkz.definition.file.merge</td>
             <td>Yes</td>
             <td>
               Definition file to be merged with the main definition file.
  @@ -53,6 +122,13 @@
             <td>
               UUID to use. If not specified a default one will be 
               automatically generated. This property is not defined by default.
  +          </td>
  +        </tr>
  +        <tr>
  +          <td>maven.aspectwerkz.transform.filter</td>
  +          <td>Yes</td>
  +          <td>
  +            TODO: explain property here. Defaults to <code>no</code>.
             </td>
           </tr>
         </table>
  
  
  
  1.3       +6 -3      maven-plugins/aspectwerkz/xdocs/goals.xml
  
  Index: goals.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectwerkz/xdocs/goals.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- goals.xml	26 Dec 2003 13:52:37 -0000	1.2
  +++ goals.xml	27 Dec 2003 13:11:25 -0000	1.3
  @@ -10,13 +10,16 @@
         <goal>
           <name>aspectwerkz:attributec</name>
           <description>
  -          Compile AspectWerkz javadoc attributes.
  +          Compile AspectWerkz javadoc attributes for xml-defined aspects
  +          (i.e. <code>maven.aspectwerkz.mode = xmldef</code>).
           </description>
         </goal>
         <goal>
  -        <name>aspectwerkz:transform</name>
  +        <name>aspectwerkz:weave</name>
           <description>
  -          Weaves aspects on byte code (offline mode).
  +           Weave aspects at build time (offline mode). Works for both "xmldef"
  +           (<code>maven.aspectwerkz.mode = xmldef</code>) and "attribdef" 
  +           (<code>maven.aspectwerkz.mode = attribdef</code>) modes.
           </description>
         </goal>
       </goals>
  
  
  
  1.3       +1 -1      maven-plugins/aspectwerkz/src/plugin-test/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectwerkz/src/plugin-test/maven.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- maven.xml	26 Dec 2003 13:52:37 -0000	1.2
  +++ maven.xml	27 Dec 2003 13:11:25 -0000	1.3
  @@ -2,7 +2,7 @@
   
     <goal name="testPlugin">
       <attainGoal name="clean"/>
  -    <attainGoal name="aspectwerkz:transform"/>
  +    <attainGoal name="aspectwerkz:weave"/>
     </goal>
            
   </project>
  
  
  
  1.5       +1 -4      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- project.properties	26 Dec 2003 14:11:44 -0000	1.4
  +++ project.properties	27 Dec 2003 13:11:25 -0000	1.5
  @@ -2,7 +2,4 @@
   # P R O J E C T  P R O P E R T I E S
   # -------------------------------------------------------------------
   
  -maven.aspectwerkz.uuid = test
  -maven.aspectwerkz.definition.merge.file = ${basedir}/conf/aspectwerkz.xml
  -maven.aspectwerkz.definition.validate = true
  -maven.aspectwerkz.transform.verbose = yes
  +maven.aspectwerkz.verbose = true
  
  
  

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