brett       2004/12/10 04:18:15

  Modified:    gump     plugin.jelly plugin.properties project.xml
               gump/xdocs changes.xml
  Added:       gump/src/plugin-resources module.jelly project.jelly
  Removed:     gump/src/plugin-resources maven2gump.properties
  Log:
  rewritten gump plugin
  
  Revision  Changes    Path
  1.7       +55 -85    maven-plugins/gump/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/gump/plugin.jelly,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- plugin.jelly      12 Jun 2004 02:27:12 -0000      1.6
  +++ plugin.jelly      10 Dec 2004 12:18:15 -0000      1.7
  @@ -17,12 +17,13 @@
    */
    -->
   
  -
   <project 
  +  xmlns:multiproject="multiproject"
  +  xmlns:ant="jelly:ant"
     xmlns:define="jelly:define" 
  -  xmlns:gump="gump"
     xmlns:maven="jelly:maven"
     xmlns:j="jelly:core" 
  +  xmlns:x="jelly:xml" 
     xmlns:u="jelly:util">
   
     <!-- ================================================================== -->
  @@ -36,98 +37,67 @@
     <!-- ================================================================== -->
   
     <goal name="gump"
  -           description="Generate Gump descriptor from Maven descriptor"
  -           prereqs="gump:generate-descriptor"/>
  +        description="Generate Gump descriptor from Maven descriptor"
  +        prereqs="gump:gump" />
   
  +  <goal name="gump:gump"
  +        description="Generate Gump descriptor from Maven descriptor"
  +        prereqs="gump:generate-descriptor"/>
   
  -  <define:taglib uri="gump">
  -    <define:tag name="name" trim="yes">
  -      <u:properties var="map" 
file="${plugin.resources}/maven2gump.properties" />
  -      <j:set var="gumpName" value="${map.getProperty(project)}" />
  -      <j:if test="${empty(gumpName)}">${project}</j:if>
  -      <j:if test="${!empty(gumpName)}">${gumpName}</j:if>
  -    </define:tag>
  -  </define:taglib>
  -  
     <goal name="gump:generate-descriptor"
  -           description="Generate Gump descriptor from Maven descriptor">
  +        description="Generate Gump descriptor from Maven descriptor"
  +        prereqs="gump:init">
  +
  +    <j:new var="reactorProjects" className="java.util.ArrayList" />
  +    <j:set var="dummy" value="${reactorProjects.add(pom)}" />
  +    <j:set var="goal" value="gump:gump" />
  +    <ant:echo>Generating ${maven.gump.descriptor}...</ant:echo>
  +    <j:import file="${plugin.resources}/module.jelly" inherit="true" />
  +  </goal>
   
  +  <goal name="gump:init">
       <j:set var="genAnt" value="${maven.gump.ant.generate}" />
       <j:set var="genMaven" value="${maven.gump.maven.generate}" />
       <j:if test="${!genAnt and !genMaven}">
         <fail>You must specify one of maven.gump.ant and 
maven.gump.maven</fail>
       </j:if>
   
  -    <j:set var="gumpProject"><gump:name project="${pom.artifactId}"/></j:set>
  -    <j:file name="${basedir}/gump.xml" prettyPrint="true" xmlns="dummy">
  -<module name="${gumpProject}">
  -
  -  <description>${pom.shortDescription}</description>
  -  <url href="${pom.url}"/>
  -
  -  <u:tokenize var="scmTokens" 
delim=":">${pom.repository.connection}</u:tokenize>
  -  <cvs repository="${pom.gumpRepositoryId}"
  -       module="${scmTokens[5]}" />
  -  
  -  <!-- This is really the cvs module. We need to change this but -->
  -  <!-- I will leave this for now until everything works.         -->
  -  
  -  <project name="${gumpProject}">
  -    
  -    <!-- Standard Maven target to produce Javadocs, source -->
  -    <!-- and binary distributions.                         -->
  -<j:if test="${genAnt}">
  -    <ant buildfile="build.xml" target="${maven.gump.ant.target}">
  -      <property name="final.name" value="${pom.artifactId}-@@DATE@@"/>
  -    </ant>
  -</j:if>
  -<j:if test="${genMaven}">
  -    <maven goal="${maven.gump.maven.goals}">
  -      <property name="final.name" value="${pom.artifactId}-@@DATE@@"/>
  -    </maven>
  -</j:if>
  -    
  -    <package>${pom.package}</package>
  -
  -    <j:new var="dependentProjects" className="java.util.TreeSet" />
  -    <!-- All Maven projects need Ant and Xerces to build. -->
  -    <j:set var="dummy" value="${dependentProjects.add('jakarta-ant')}" />
  -    <j:set var="dummy" value="${dependentProjects.add('xml-xerces')}"/>
  -    
  -    <!-- 
  -       Add project dependencies to the set, using project Id only
  -       If there is a gump project mapping for the named maven
  -       dependency, use that for the project in the depend tag
  -       otherwise just use the project id
  -      -->
  -    <j:forEach var="dependency" items="${pom.dependencies}">
  -      <j:set var="gumpDepName"><gump:name project="${dependency.groupId}" 
/></j:set>
  -      <j:set var="dummy">${dependentProjects.add(gumpDepName)}</j:set>
  -    </j:forEach>
  -
  -    <!-- dump out the set of dependencies -->
  -    <j:forEach var="dependency" items="${dependentProjects}">
  -      <depend project="${dependency}" />
  -    </j:forEach>
  -
  -    <maven:makeRelativePath basedir="${basedir}" var="mavenBuildDest" 
separator="/" path="${maven.build.dest}" />
  -    <work nested="${mavenBuildDest}"/>
  -    <maven:makeRelativePath basedir="${basedir}" var="mavenBuildDir" 
separator="/" path="${maven.build.dir}" />
  -    <home nested="${mavenBuildDir}"/>
  -    <jar name="${pom.artifactId}-@@DATE@@.jar"/>
  -    
  -    <u:tokenize var="moduleTokens" delim="/">${scmTokens[5]}</u:tokenize>
  -    <maven:makeRelativePath basedir="${basedir}" var="mavenDocsDest" 
separator="/" path="${maven.docs.dest}" />
  -    <javadoc nested="${mavenDocsDest}/apidocs" module="${moduleTokens[0]}"/>
  -
  -    <nag from="${pom.artifactId} development 
&lt;${pom.build.nagEmailAddress}&gt;"
  -         to="${pom.build.nagEmailAddress}"/>
  -    
  -  </project>
  -
  -</module>
  -    </j:file>
  -  
  +    <u:tokenize var="scmTokens" 
delim=":">${pom.repository.connection}</u:tokenize>
  +    <j:choose>
  +      <j:when test="${scmTokens[1] == 'cvs'}">
  +        <j:set var="moduleName" value="${scmTokens[5]}"/>
  +      </j:when>
  +      <j:when test="${scmTokens[1] == 'svn'}">
  +        <j:set var="moduleName" value="${scmTokens[4]}"/>
  +      </j:when>
  +      <j:otherwise>
  +        <ant:echo>Unknown SCM type ${scmTokens[1]}: you may need to manually 
add the repository</ant:echo>
  +      </j:otherwise>
  +    </j:choose>
     </goal>
  -  
  +
  +  <multiproject:dependency-handle />
  +
  +  <goal name="gump:multiproject"
  +    description="Generate a single gump descriptor for a set of Maven 
projects"
  +    prereqs="gump:init">
  +
  +    <maven:get plugin="maven-multiproject-plugin" 
property="maven.multiproject.includes" var="includes" />
  +    <maven:get plugin="maven-multiproject-plugin" 
property="maven.multiproject.excludes" var="excludes" />
  +
  +    <maven:reactor
  +      basedir="${basedir}"
  +      banner="Generating gump descriptor for:"
  +      includes="${includes}"
  +      excludes="${excludes}"
  +      postProcessing="true"
  +      ignoreFailures="true"/>
  +
  +    <j:set var="goal" value="gump:multiproject" />
  +    <ant:echo>Generating ${maven.gump.descriptor}...</ant:echo>
  +    <j:import file="${plugin.resources}/module.jelly" inherit="true" />
  +  </goal>
  +
  +
   </project>
  +
  
  
  
  1.4       +3 -1      maven-plugins/gump/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/gump/plugin.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- plugin.properties 12 Jun 2004 02:27:12 -0000      1.3
  +++ plugin.properties 10 Dec 2004 12:18:15 -0000      1.4
  @@ -18,4 +18,6 @@
   maven.gump.maven.generate = true
   
   maven.gump.ant.target = dist
  -maven.gump.maven.goals = jar
  +maven.gump.maven.goals=jar
  +
  +maven.gump.descriptor=${basedir}/gump.xml
  
  
  
  1.26      +1 -1      maven-plugins/gump/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/gump/project.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- project.xml       11 Jul 2004 02:07:29 -0000      1.25
  +++ project.xml       10 Dec 2004 12:18:15 -0000      1.26
  @@ -23,7 +23,7 @@
     <pomVersion>3</pomVersion>
     <id>maven-gump-plugin</id>
     <name>Maven Gump Plug-in</name>
  -  <currentVersion>1.4</currentVersion>
  +  <currentVersion>2.0-SNAPSHOT</currentVersion>
     <description/>
     <shortDescription>produce Gump descriptor</shortDescription>
     <url>http://maven.apache.org/reference/plugins/gump/</url>
  
  
  
  1.1                  maven-plugins/gump/src/plugin-resources/module.jelly
  
  Index: module.jelly
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- 
  /*
   * Copyright 2001-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.
   */
   -->
  
  <j:file name="${maven.gump.descriptor}"
      prettyPrint="true"
      xmlns:j="jelly:core" 
      xmlns:x="jelly:xml" 
      xmlns="dummy">
  <!-- This should probably be pom.groupId, except I think module may need to 
be unique in gump space -->
  <module name="${pom.artifactId}">
  <j:whitespace><x:comment>
    - This descriptor was automatically generated using Maven.
    - To regenerate, run: "maven ${goal}"
    -
    - If you have a requirement that leads to hand editing, please consider 
filing
    - a feature request at ${plugin.issueTrackingUrl}
  </x:comment></j:whitespace>
    <description>${pom.shortDescription}</description>
    <url href="${pom.url}"/>
    <j:choose>
      <j:when test="${scmTokens[1] == 'cvs'}">
        <cvs repository="${pom.gumpRepositoryId}" module="${moduleName}" />
      </j:when>
      <j:when test="${scmTokens[1] == 'svn'}">
        <svn repository="${pom.gumpRepositoryId}" dir="${moduleName}" />
      </j:when>
      <!-- this field has already been validated to ensure there isn't 
something missing here -->
    </j:choose>
    <j:forEach var="project" items="${reactorProjects}">
      <j:import file="${plugin.resources}/project.jelly" inherit="true" />
    </j:forEach>
  </module>
  </j:file>
  
  
  
  
  1.1                  maven-plugins/gump/src/plugin-resources/project.jelly
  
  Index: project.jelly
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!-- 
  /*
   * Copyright 2001-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.
   */
   -->
  
  <!-- Note: all variables must be relative to the project, or from the project 
context -->
  <j:whitespace
      xmlns:j="jelly:core" 
      xmlns:maven="jelly:maven" 
      xmlns:u="jelly:util" 
      xmlns:license="license"
      xmlns="dummy">
  <project name="${project.artifactId}">
    <maven:makeRelativePath basedir="${basedir}" var="homeDir" separator="/" 
path="${project.file.parent}" />
  
    <j:if test="${genAnt}">
      <ant buildfile="build.xml" target="${maven.gump.ant.target}">
        <property name="final.name" value="${project.artifactId}-@@DATE@@"/>
      </ant>
    </j:if>
    <j:if test="${genMaven}">
      <maven goal="${maven.gump.maven.goals}" basedir="${homeDir}">
        <property name="maven.final.name" 
value="${project.artifactId}-@@DATE@@"/>
      </maven>
    </j:if>
        
    <j:forEach var="dep" items="${project.dependencies}">
      <j:set var="projectId" value="${dep.artifactId}"/>
      <j:if test="${dep.getProperty('gump.project') != null}">
        <j:set var="projectId" value="${dep.getProperty('gump.project')}"/>
      </j:if>
      <depend project="${projectId}" />
    </j:forEach>
    
    <home nested="${homeDir}" />
  
    <maven:makeRelativePath basedir="${project.file.parent}" 
var="mavenBuildDir" separator="/" 
path="${project.context.getVariable('maven.build.dir')}" />
    <jar name="${mavenBuildDir}/${project.artifactId}-@@DATE@@.jar" />
      
    <maven:makeRelativePath basedir="${basedir}" var="mavenDocsDest" 
separator="/" path="${project.context.getVariable('maven.docs.dest')}" />
    <javadoc nested="${mavenDocsDest}/apidocs" />
  
    <!-- As the test reports is a plugin property, we can't reliably get it 
from the project context.
         Forced to assume the default -->
    <maven:get var="testReportsDirectory" plugin="maven-test-plugin" 
property="maven.test.reportsDirectory" />
    <maven:makeRelativePath basedir="${basedir}" var="mavenTestReportsDest" 
separator="/" path="${testReportsDirectory}" />
    <junitreport nested="${homeDir}/${mavenTestReportsDest}" />
    
    <nag from="${project.artifactId} development 
&lt;${project.build.nagEmailAddress}&gt;"
         to="${project.build.nagEmailAddress}"/>
    
  </project>
  </j:whitespace>
  
  
  
  
  1.11      +8 -0      maven-plugins/gump/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/gump/xdocs/changes.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- changes.xml       11 Jul 2004 02:07:29 -0000      1.10
  +++ changes.xml       10 Dec 2004 12:18:15 -0000      1.11
  @@ -24,6 +24,14 @@
       <author email="[EMAIL PROTECTED]">dIon Gillard</author>
     </properties>
     <body>
  +    <release version="2.0-SNAPSHOT" date="in CVS">
  +      <action dev="brett" type="add">Add junitreport element to the 
descriptor</action>
  +      <action dev="brett" type="add">Add multiproject module for generating 
a single module with several projects within the one descriptor.</action>
  +      <action dev="brett" type="fix">Set maven.final.name as a property for 
the &lt;maven element, instead of final.name</action>
  +      <action dev="brett" type="fix">Set &lt;home to ${basedir} instead of 
${maven.build.dir}, and set jar path relative to that</action>
  +      <action dev="brett" type="update">Stop mapping Maven names to gump 
names inside the plugin, but allow the project to do this for itself</action>
  +      <action dev="brett" type="add">Handle subversion as an SCM 
type</action>
  +    </release>
       <release version="1.4" date="2004-07-10">
         <action dev="brett" type="add" issue="MPGUMP-1">Allow creation of 
&lt;maven descriptor element, and default to it</action>
         <action dev="brett" type="add">Add maven.gump.ant.target and 
maven.gump.maven.goal properties</action>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to