jvanzyl     2003/10/17 15:21:41

  Modified:    release  plugin.jelly
               release/xdocs goals.xml properties.xml
  Log:
  o incorporating Mauro Televi's patch to the release plugin, these
    changes have been battle tested with DNA/Loom.
  
    Mauro's comments are attached for posterity:
  
    ---
  
  attached is a first crack that incorporates the release functionality
  currently in DNA and Loom distribution modules.
  
  Two types of distributions:
  - bin: this requires user customisation - uses dependency properties to
  assign a category to a dependency and via a property
  Eg, maven.release.distribution.categories=shared:lib,tools:tools/lib
  tells it to place any "shared" dependency in path lib/ and
  "tools" dependendency in tools/lib.
  User can postGoal release:setup-distribution-bin to add any further
  content to distribution.
  
  - src: uses SCM plugin out of a box :-) works quite well IMO.
  
  distribution artifact names are customisable but default to
  ${maven.final.name}-[bin|src].[tar.gz|zip]
  
  Patch has documentation updated - so feel free to browse,
  and let me if too scarse or patch.
  
  If you create an issue in jira I can also attach the patch to it.
  (I'm not sure If I can create the issue myself on maven project)
  
  Further work would include incorporating the wrapper exes for the
  release,  but perhaps that's better done via a separate plugin.
  
  Revision  Changes    Path
  1.19      +131 -0    maven-plugins/release/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/release/plugin.jelly,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- plugin.jelly      29 Sep 2003 12:32:57 -0000      1.18
  +++ plugin.jelly      17 Oct 2003 22:21:41 -0000      1.19
  @@ -1,6 +1,11 @@
   <?xml version="1.0"?>
   
   <project
  +  xmlns:ant="jelly:ant"
  +  xmlns:archive="release:archive"
  +  xmlns:define="jelly:define"
  +  xmlns:deploy="deploy"
  +  xmlns:maven="jelly:maven"
     xmlns:j="jelly:core"
     xmlns:i="jelly:interaction"
     xmlns:u="jelly:util"
  @@ -36,6 +41,64 @@
      |    of the latest snapshot.
      -->
   
  +    <!--
  +    | Archive taglib:
  +    |        - copy-dependencies: copies dependencies for category groups
  +    |            attributes: category, todir
  +    |   - gzip: creates tar.gz distribution file
  +    |            attributes: dir, name
  +    |   - zip: creates zip distribution file         
  +    |            attributes: dir, name
  +    -->      
  +    <define:taglib uri="release:archive">
  +        <define:tag name="copy-dependencies">
  +            <j:if test="${projectDescriptor != null}">
  +                <maven:pom var="pom" projectDescriptor="${projectDescriptor}"/>
  +            </j:if>
  +
  +            <j:set var="mavenRepoLocal" 
value='${context.getVariable("maven.repo.local")}'/>
  +            <j:forEach var="dependency" items="${pom.dependencies}">
  +                <j:if test='${category.equals(dependency.getProperty("category"))}'>
  +                    <j:set var="addDependencies" value='true'/>
  +                </j:if>
  +            </j:forEach>
  +
  +            <j:if test='${addDependencies == "true" }'>
  +                <ant:mkdir dir="${todir}"/>
  +                <ant:copy todir="${todir}" flatten="true">
  +                    <ant:fileset dir="${mavenRepoLocal}">
  +                        <j:forEach var="dependency" items="${pom.dependencies}">
  +                            <j:if 
test='${category.equals(dependency.getProperty("category"))}'>
  +                                <ant:include 
name="${dependency.artifactDirectory}/jars/${dependency.artifact}"/>
  +                                <ant:include 
name="${dependency.artifactDirectory}/licenses/${dependency.artifactId}.license"/>
  +                            </j:if>
  +                        </j:forEach>
  +                    </ant:fileset>
  +                </ant:copy>
  +            </j:if>
  +        </define:tag>
  +        <define:tag name="gzip">
  +         <ant:tar longfile="gnu" tarfile="${maven.build.dir}/${name}.tar">
  +                <ant:tarfileset dir="${dir}" prefix="${name}"/>
  +            </ant:tar>
  +         <ant:gzip zipfile="${maven.build.dir}/${name}.tar.gz"
  +                        src="${maven.build.dir}/${name}.tar"/>
  +            <ant:delete file="${maven.build.dir}/${name}.tar"/>
  +        </define:tag>
  +        <define:tag name="zip">
  +            <ant:zip destfile="${maven.build.dir}/${name}.zip">
  +                <ant:zipfileset dir="${dir}" prefix="${name}"/>
  +         </ant:zip>
  +        </define:tag>
  +        <define:tag name="deploy">
  +         <deploy:artifact
  +               artifact="${maven.build.dir}/${name}"
  +                       type="distributions"
  +               assureDirectoryCommand="mkdir -p"
  +               siteCommand="cd @deployDirectory@; chmod g+w ${name}; chgrp 
${maven.remote.group} ${name}"/>
  +        </define:tag>
  +    </define:taglib>
  +
     <!--
      |
      | Convert SNAPSHOT version identifiers to real snapshot versions.
  @@ -158,7 +221,75 @@
        | deploy instead of having to build everything all the time.
        |
        -->
  +  </goal>
  +
  +  <!--
  +   |
  +   | Initialise release variables
  +   |
  +   -->
  +  <goal name="release:init">
  +    <j:set var="releaseNameBin" value="${maven.release.name.bin}"/>
  +    <j:if test="${empty(releaseNameBin)}">
  +      <j:set var="releaseNameBin" 
value="${pom.artifactId}-${pom.currentVersion}-bin"/>
  +    </j:if>
  +    <j:set var="releaseNameSrc" value="${maven.release.name.src}"/>
  +    <j:if test="${empty(releaseNameSrc)}">
  +      <j:set var="releaseNameSrc" 
value="${pom.artifactId}-${pom.currentVersion}-src"/>
  +    </j:if>
  +  </goal>
  + 
  + <!--
  +   |
  +   | Build a binary distribution copying dependencies according to 
  +   | category groups.
  +   |
  +   -->
  +  <goal name="release:setup-distribution-bin" prereqs="release:init">
  +    <ant:mkdir dir="${maven.build.dir}/${releaseNameBin}"/>
  +    <u:tokenize var="categories" delim="," 
trim="true">${maven.release.distribution.categories}</u:tokenize>
  +    <j:forEach var="category" items="${categories}">
  +     <u:tokenize var="pair" delim=":" trim="true">${category}</u:tokenize>
  +     <j:set var="name" value="${pair.get(0)}"/>
  +     <j:set var="path" value="${pair.get(1)}"/>
  +     <archive:copy-dependencies category="${name}" 
todir="${maven.build.dir}/${releaseNameBin}/${path}"/>
  +    </j:forEach> 
  +  </goal>
   
  +  <goal name="release:build-distribution-bin" 
prereqs="release:setup-distribution-bin">
  +    <archive:gzip name="${releaseNameBin}" 
dir="${maven.build.dir}/${releaseNameBin}"/>
  +    <archive:zip name="${releaseNameBin}" 
dir="${maven.build.dir}/${releaseNameBin}"/>
  +  </goal>
  +
  +  <!--
  +   |
  +   | Build a source distribution from source repository.
  +   | Uses scm plugin to checkout project.
  +   |
  +   -->
  +  <goal name="release:build-distribution-src" 
prereqs="release:init,scm:checkout-project">
  +    <archive:gzip name="${releaseNameSrc}" 
dir="${maven.scm.checkout.dir}/${maven.scm.cvs.module}"/>
  +    <archive:zip name="${releaseNameSrc}" 
dir="${maven.scm.checkout.dir}/${maven.scm.cvs.module}"/>
  +  </goal>
  +
  + <!--
  +   |
  +   | Deploy a binary distribution.
  +   |
  +   -->
  +  <goal name="release:deploy-distribution-bin" 
prereqs="release:build-distribution-bin">
  +    <archive:deploy name="${releaseNameBin}.tar.gz"/>
  +    <archive:deploy name="${releaseNameBin}.zip"/>
  +  </goal>
  +
  + <!--
  +   |
  +   | Deploy a source distribution.
  +   |
  +   -->
  +  <goal name="release:deploy-distribution-src" 
prereqs="release:build-distribution-src">
  +    <archive:deploy name="${releaseNameSrc}.tar.gz"/>
  +    <archive:deploy name="${releaseNameSrc}.zip"/>
     </goal>
   
   </project>
  
  
  
  1.2       +27 -0     maven-plugins/release/xdocs/goals.xml
  
  Index: goals.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/release/xdocs/goals.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- goals.xml 25 Jul 2003 06:00:33 -0000      1.1
  +++ goals.xml 17 Oct 2003 22:21:41 -0000      1.2
  @@ -27,6 +27,33 @@
           </description>
         </goal>
         <goal>
  +        <name>release:build-distribution-bin</name>
  +        <description>
  +            Builds binary distribution.  Uses 
<code>maven.release.distribution.categories</code> property
  +            to separated dependencies in categories and corresponding distribution 
directories.
  +            Users can postGoal <code>release:setup-distribution-bin</code> with 
custom additional 
  +            distribution content.
  +        </description>
  +      </goal>
  +      <goal>
  +        <name>release:build-distribution-src</name>
  +        <description>
  +            Builds source distribution from source control using SCM plugin.
  +        </description>
  +      </goal>
  +      <goal>
  +        <name>release:deploy-distribution-bin</name>
  +        <description>
  +            Deploys binary distribution built via 
<code>release:build-distribution-bin</code>
  +        </description>
  +      </goal>
  +      <goal>
  +        <name>release:deploy-distribution-src</name>
  +        <description>
  +            Deploys source distribution built via 
<code>release:build-distribution-src</code>
  +        </description>
  +      </goal>
  +      <goal>
           <name>validate-pom-for-release</name>
           <description>
           </description>
  
  
  
  1.2       +46 -1     maven-plugins/release/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/release/xdocs/properties.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- properties.xml    25 Jul 2003 06:00:33 -0000      1.1
  +++ properties.xml    17 Oct 2003 22:21:41 -0000      1.2
  @@ -6,7 +6,52 @@
     </properties>
     <body>
       <section name="Maven Release Plug-in Settings">
  -      <p>There are no settings to customize this plugin</p>
  +      <table>
  +        <tr>
  +          <th>Property</th>
  +          <th>Optional?</th>
  +          <th>Description</th>
  +        </tr>
  +        <tr>
  +          <td>maven.release.name.bin</td>
  +          <td>Yes</td>
  +          <td>The name of the binary release file.  
  +              Defaults to 
<code>${pom.artifactId}-${pom.currentVersion}-bin</code></td>
  +        </tr>        
  +        <tr>
  +          <td>maven.release.name.src</td>
  +          <td>Yes</td>
  +          <td>The name of the source release file.
  +              Defaults to 
<code>${pom.artifactId}-${pom.currentVersion}-src</code></td>
  +        </tr>        
  +        <tr>
  +          <td>maven.release.distribution.categories</td>
  +          <td>Yes</td>
  +          <td>The categories and relative paths of the dependencies to
  +               be included in the release. A list of category:path
  +               pairs, eg <code>shared:lib,tools:tools/lib</code>, where the 
  +               category is set via dependency properties:
  +<source><![CDATA[
  +   <dependency>
  +        <groupId>[groupId]</groupId>
  +        <artifactId>[artifactId]</artifactId>
  +        <version>[version]</version>
  +        <properties>
  +            <category>shared</category>
  +        </properties>
  +    </dependency>
  +   <dependency>
  +        <groupId>[anotherGroupId]</groupId>
  +        <artifactId>[anotherArtifactId]</artifactId>
  +        <version>[anotherVersion]</version>
  +        <properties>
  +            <category>tools</category>
  +        </properties>
  +    </dependency>
  +]]></source>
  +          </td>
  +        </tr>        
  +      </table>
       </section>
     </body>
   </document>
  
  
  

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

Reply via email to