You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/02/11 03:40:41 UTC

cvs commit: jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/jelly ResolveSnapshotsTag.java ReleaseTagLibrary.java

jvanzyl     2003/02/10 18:40:41

  Modified:    src/plugins-build/release plugin.jelly
               src/plugins-build/release/src/main/org/apache/maven/release
                        AbstractPomTransformer.java
               src/plugins-build/release/src/main/org/apache/maven/release/jelly
                        ReleaseTagLibrary.java
  Added:       src/plugins-build/release/src/main/org/apache/maven/release/jelly
                        ResolveSnapshotsTag.java
  Log:
  o trying out interactive pom editing.
  
  Revision  Changes    Path
  1.11      +35 -35    jakarta-turbine-maven/src/plugins-build/release/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/release/plugin.jelly,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- plugin.jelly	11 Feb 2003 00:56:36 -0000	1.10
  +++ plugin.jelly	11 Feb 2003 02:40:41 -0000	1.11
  @@ -1,6 +1,6 @@
   <?xml version="1.0"?>
   
  -<project 
  +<project
     xmlns:j="jelly:core"
     xmlns:i="jelly:interaction"
     xmlns:u="jelly:util"
  @@ -30,8 +30,8 @@
      |   what went into a specific version. Eventually it would also be nice to
      |   trace back through the POMs so you could build any version of any
      |   project from sources at any point in time.
  -   | Q: so how do we find the latest timestamped version. 
  -   | A: when a snapshot is deployed we need a file with the real version 
  +   | Q: so how do we find the latest timestamped version.
  +   | A: when a snapshot is deployed we need a file with the real version
      |    of the latest snapshot.
      -->
   
  @@ -43,57 +43,57 @@
      |
      -->
     <goal name="convert-snapshots">
  -    
  -    <r:convert-snapshot-dependencies
  +
  +    <r:resolve-snapshots
         transformer="transformer"
         transformations="transformations"/>
   
  -    <i:ask 
  +    <i:ask
         question="There are ${size(transformations)} snapshot dependencies, would you like to update them to use timestamped versions?"
  -      answer="answer" 
  +      answer="answer"
         default="yes"/>
  -    
  +
       <j:if test="${answer == 'yes'}">
  -    
  +
         <j:forEach var="transformation" items="${transformations}"/>
  -        
  +
           <!-- Display transformation info. Needs to be consumable by a GUI. -->
  -        
  +
           <echo>
           ${transformation.beforeTransformation}
  -        <echo>
  +        </echo>
   
           <echo>
           ${transformation.afterTransformation}
  -        <echo>
  +        </echo>
   
  -        <i:ask 
  +        <i:ask
             question="Do you want to update this dependency?"
  -          answer="answer" 
  +          answer="answer"
             default="yes"/>
  -        
  +
           <j:if test=${answer == 'yes'}">
  -        
  +
             <!-- Change the node. -->
             <r:transform transformation="${transformation}"/>
  -          
  +
           </j:if>
  -      
  +
         </j:forEach>
  -      
  -      <i:ask 
  +
  +      <i:ask
           question="Would you like the update POM to be written out for the release?"
  -        answer="answer" 
  +        answer="answer"
           default="yes"/>
  -      
  +
         <j:if test=${answer == 'yes'}">
           <!-- Write out the pom. -->
  -        <r:write-pom/>
  +        ${transformer.write()}
         </j:if>
  -      
  +
       </j:if>
     </goal>
  -   
  +
     <!--
      |
      | Validate the POM for a release. This consists of:
  @@ -102,15 +102,15 @@
      |
      -->
     <goal name="validate-pom-for-release">
  -    
  +
       <j:useBean var="snapshots" class="java.util.ArrayList"/>
  -    
  +
       <j:forEach var="dependency" items="${pom.dependencies}">
         <j:if test="${dependency.version == 'SNAPSHOT'}">
           <j:set var="dummy" value="${snapshots.add(dependency)}"/>
         </j:if>
       </j:forEach>
  -    
  +
       <j:if test="${size(snapshots) > 0}">
         <echo/>
         <echo>The following dependencies have SNAPSHOT identifiers:</echo>
  @@ -121,19 +121,19 @@
         <fail message="">
         </fail>
       </j:if>
  -    
  +
     </goal>
  -  
  +
     <!--
      |
      | Release
      |
      -->
     <goal name="release">
  -  
  +
       <attainGoal name="validate-pom-for-release"/>
       <attainGoal name="deploy:pom"/>
  -    
  +
       <!--
        |
        | Build the binary and source distributions. We need to alter
  @@ -141,7 +141,7 @@
        | deploy instead of having to build everything all the time.
        |
        -->
  -    
  +
     </goal>
  - 
  +
   </project>
  
  
  
  1.5       +3 -2      jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/AbstractPomTransformer.java
  
  Index: AbstractPomTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/AbstractPomTransformer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractPomTransformer.java	11 Feb 2003 01:00:55 -0000	1.4
  +++ AbstractPomTransformer.java	11 Feb 2003 02:40:41 -0000	1.5
  @@ -71,6 +71,7 @@
   import java.util.List;
   import java.util.Iterator;
   import java.util.Properties;
  +import java.util.ArrayList;
   
   /**
    * This is the base class for any tool that attempts to transform fields
  @@ -102,7 +103,7 @@
       /** Nodes selected for transformation using xpath. */
       private List selectedNodes;
   
  -    private List transformations;
  +    private List transformations = new ArrayList();
   
       // -------------------------------------------------------------------------
       // Accessors
  
  
  
  1.2       +2 -1      jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/jelly/ReleaseTagLibrary.java
  
  Index: ReleaseTagLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/jelly/ReleaseTagLibrary.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReleaseTagLibrary.java	10 Feb 2003 14:06:03 -0000	1.1
  +++ ReleaseTagLibrary.java	11 Feb 2003 02:40:41 -0000	1.2
  @@ -17,5 +17,6 @@
        */
       public ReleaseTagLibrary()
       {
  +        registerTag( "resolve-snapshots", ResolveSnapshotsTag.class );
       }
   }
  
  
  
  1.1                  jakarta-turbine-maven/src/plugins-build/release/src/main/org/apache/maven/release/jelly/ResolveSnapshotsTag.java
  
  Index: ResolveSnapshotsTag.java
  ===================================================================
  package org.apache.maven.release.jelly;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache MavenSession" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache MavenSession", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.JellyTagException;
  import org.apache.maven.release.SnapshotResolver;
  import org.apache.maven.project.Project;
  import org.apache.maven.MavenConstants;
  
  public abstract class ResolveSnapshotsTag
      extends TagSupport
  {
      private SnapshotResolver snapshotResolver;
  
      private String transformer;
  
      private String transformations;
  
      public void setTransformations( String transformations )
      {
          this.transformations = transformations;
      }
  
      public String getTransformations()
      {
          return transformations;
      }
  
      public void setTransformer( String transformer )
      {
          this.transformer = transformer;
      }
  
      public String getTransformer()
      {
          return transformer;
      }
  
      public void doTag( XMLOutput output )
          throws JellyTagException
      {
          Project project = (Project) context.getVariable( MavenConstants.MAVEN_POM );
  
          snapshotResolver = new SnapshotResolver();
          snapshotResolver.setProject( project.getFile() );
  
          context.setVariable( getTransformer(), snapshotResolver );
          context.setVariable( getTransformations(), snapshotResolver.getTransformations() );
      }
  }