jvanzyl     2002/05/31 20:31:56

  Modified:    .        build-bootstrap.xml project.xml project.xml-b4
               src/java/org/apache/maven BaseProjectTask.java
                        ProjectProperties.java
               src/templates/build/plugins/core build.xml
  Log:
  Adding some code to deal with making snapshot JARs.
  
  Revision  Changes    Path
  1.91      +45 -27    jakarta-turbine-maven/build-bootstrap.xml
  
  Index: build-bootstrap.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/build-bootstrap.xml,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- build-bootstrap.xml       27 May 2002 08:58:54 -0000      1.90
  +++ build-bootstrap.xml       1 Jun 2002 03:31:55 -0000       1.91
  @@ -9,12 +9,20 @@
     <!-- Set default values for the build -->
     <property file="project.properties" />
     
  -  <property name="maven.get.jars.baseUrl" 
  -            value="http://jakarta.apache.org/turbine/jars"; />
  -  <property name="maven.bootstrap.dir" 
  -            value="${basedir}/bootstrap" />
  -  <property name="maven.bootstrap.classes"
  -            value="${maven.bootstrap.dir}/classes" />
  +  <property 
  +    name="maven.get.jars.baseUrl" 
  +    value="http://jakarta.apache.org/turbine/jars";
  +  />
  +  
  +  <property 
  +    name="maven.bootstrap.dir" 
  +    value="${basedir}/bootstrap"
  +  />
  +  
  +  <property 
  +    name="maven.bootstrap.classes"
  +    value="${maven.bootstrap.dir}/classes"
  +  />
   
     <path id="pre-bootstrap-classpath">
       <pathelement location="${maven.bootstrap.classes}"/>
  @@ -79,8 +87,10 @@
       <ant antfile="build.xml" target="maven:install-jar"/>
     </target>
     
  -  <target name="clean"
  -          depends="check-properties">
  +  <target 
  +    name="clean"
  +    depends="check-properties">
  +    
       <!-- Remove any cruft left in build.dest -->
       <delete dir="target"/>
   
  @@ -437,48 +447,56 @@
          Create the maven.home directory if it doesn't exists, otherwise remove
          the directory contents.
     -->
  -  <target name="make-maven-home-dir"
  -          depends="clean-maven-home-dir"
  -          unless="maven.maven.home.dir.exists">
  +  <target 
  +    name="make-maven-home-dir"
  +    depends="clean-maven-home-dir"
  +    unless="maven.maven.home.dir.exists">
       <mkdir dir="${maven.home}" />
     </target>
   
     <!--
          Check for the existence of the maven.home directory.
     -->
  -  <target name="check-maven-home-dir">
  -    <available property="maven.maven.home.dir.exists"
  -               file="${maven.home}" 
  -               type="dir" />
  +  <target 
  +    name="check-maven-home-dir">
  +    <available 
  +      property="maven.maven.home.dir.exists"
  +      file="${maven.home}" 
  +      type="dir"
  +    />
     </target>
   
     <!--
         If the maven.home directory exists remove it's contents.
     -->
  -  <target name="clean-maven-home-dir"
  -          depends="check-maven-home-dir"
  -          if="maven.maven.home.dir.exists">
  +  <target 
  +    name="clean-maven-home-dir"
  +    depends="check-maven-home-dir"
  +    if="maven.maven.home.dir.exists">
       <delete includeEmptyDirs="yes" quiet="yes">
  -      <fileset dir="${maven.home}" />
  +      <fileset dir="${maven.home}"/>
       </delete>
     </target>
    
     <!--
          Create the lib.repo directory if it doesn't exist.
     -->
  -  <target name="make-lib-repo-dir"
  -          depends="check-lib-repo-dir"
  -          unless="maven.lib.repo.dir.exists">     
  -    <mkdir dir="${lib.repo}" />
  +  <target 
  +    name="make-lib-repo-dir"
  +    depends="check-lib-repo-dir"
  +    unless="maven.lib.repo.dir.exists">     
  +    <mkdir dir="${lib.repo}"/>
     </target>
   
     <!--
          Check for the existence of the lib.repo directory.
     -->
  -  <target name="check-lib-repo-dir">
  -    <available property="maven.lib.repo.dir.exists"
  -               file="${lib.repo}"
  -               type="dir" />
  +  <target 
  +    name="check-lib-repo-dir">
  +    <available 
  +    property="maven.lib.repo.dir.exists"
  +    file="${lib.repo}"
  +    type="dir"/>
     </target>
   
   </project>
  
  
  
  1.87      +2 -1      jakarta-turbine-maven/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- project.xml       30 May 2002 21:06:47 -0000      1.86
  +++ project.xml       1 Jun 2002 03:31:55 -0000       1.87
  @@ -4,7 +4,7 @@
     <version>2</version>
     <name>jakarta-turbine-maven</name>
     <id>maven</id>
  -  <currentVersion>1.0-b4-dev</currentVersion>
  +  <currentVersion>0.9.8</currentVersion>
     <organization>
       <name>Apache Software Foundation</name>
       <url>http://jakarta.apache.org/</url>
  @@ -375,6 +375,7 @@
       <!-- Unit test classes -->
       <unitTestPatterns>
         <unitTestPattern>include = **/*Test.java</unitTestPattern>
  +      <unitTestPattern>exclude = **/*Project*.java</unitTestPattern>
       </unitTestPatterns>
   
       <!-- Integration unit test classes -->
  
  
  
  1.9       +0 -8      jakarta-turbine-maven/project.xml-b4
  
  Index: project.xml-b4
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/project.xml-b4,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- project.xml-b4    31 May 2002 22:01:38 -0000      1.8
  +++ project.xml-b4    1 Jun 2002 03:31:55 -0000       1.9
  @@ -212,14 +212,6 @@
       </dependency>
   
       <dependency>
  -      <id>commons-xo</id>
  -      <version>0.8</version>
  -      <!--
  -      <url>http://jakarta.apache.org/commons/xo/</url>
  -      -->
  -    </dependency>
  -
  -    <dependency>
         <id>commons-betwixt</id>
         <version>1.0-dev</version>
       </dependency>
  
  
  
  1.14      +4 -1      
jakarta-turbine-maven/src/java/org/apache/maven/BaseProjectTask.java
  
  Index: BaseProjectTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/BaseProjectTask.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BaseProjectTask.java      30 May 2002 12:01:57 -0000      1.13
  +++ BaseProjectTask.java      1 Jun 2002 03:31:56 -0000       1.14
  @@ -75,7 +75,7 @@
    * An ant task for creating an xml schema from an sql schema
    *
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
  - * @version $Id: BaseProjectTask.java,v 1.13 2002/05/30 12:01:57 jvanzyl Exp $
  + * @version $Id: BaseProjectTask.java,v 1.14 2002/06/01 03:31:56 jvanzyl Exp $
    */
   public class BaseProjectTask
       extends TexenTask
  @@ -137,11 +137,14 @@
               context.put("buildElements", new ArrayList());
               context.put("delegators", new HashMap());
               context.put("project", mavenProject);
  +            
               if (listFile != null)
               {
                   context.put("jars", ListTask.getList(listFile));
               }
  +            
               context.put("callbacks", new HashMap());
  +            
               return context;
           }
           catch (Exception e)
  
  
  
  1.39      +43 -10    
jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java
  
  Index: ProjectProperties.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/ProjectProperties.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- ProjectProperties.java    30 May 2002 17:44:37 -0000      1.38
  +++ ProjectProperties.java    1 Jun 2002 03:31:56 -0000       1.39
  @@ -58,11 +58,15 @@
   
   import java.io.File;
   
  +import java.util.Date;
   import java.util.Iterator;
   import java.util.List;
   import java.util.Map;
  +import java.util.TimeZone;
   import java.util.Vector;
   
  +import java.text.SimpleDateFormat;
  +
   import org.apache.commons.lang.Strings;
   
   import org.apache.commons.collections.BeanMap;
  @@ -82,7 +86,7 @@
    *
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="[EMAIL PROTECTED]">Vincent Massol</a>
  - * @version $Id: ProjectProperties.java,v 1.38 2002/05/30 17:44:37 jvanzyl Exp $
  + * @version $Id: ProjectProperties.java,v 1.39 2002/06/01 03:31:56 jvanzyl Exp $
    */
   public class ProjectProperties
       extends ProjectExecutor
  @@ -230,6 +234,8 @@
           }
   
           createJarResourcesProperty();
  +        createSnapshotProperties();        
  +        
       }
       
       /**
  @@ -348,6 +354,42 @@
       /** 
        * Create properties relating to the distribution build 
        */
  +    private void createSnapshotProperties()
  +    {
  +        String mavenBuild = getProject().getProperty("maven.build");
  +        
  +        if (mavenBuild == null)
  +        {
  +            return;
  +        }            
  +        
  +        // If we are building a snapshot then we need to create
  +        // a snapshot signature that can be used on the final
  +        // JAR produced.
  +        if (mavenBuild.equals("snapshot"))
  +        {
  +            String finalName = createSnapshotSignature();        
  +            getProject().setProperty("maven.final.name", finalName);
  +        }
  +    }
  +    
  +    /**
  +     * Create a snapshot signature using a GMT timestamp.
  +     */
  +    private String createSnapshotSignature()
  +    {
  +        Date now = new Date();
  +        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd.hhmmss");
  +        formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
  +        String buildNumber = formatter.format(now);
  +        
  +        return getMavenProject().getId() + "-" + 
  +            getMavenProject().getCurrentVersion() + "." + buildNumber;
  +    }
  +
  +    /** 
  +     * Create properties relating to the distribution build 
  +     */
       private void createDistProperties()
       {
           String id = getProject().getProperty("maven.distid");
  @@ -356,15 +398,6 @@
           {
               Distribution d = (Distribution) 
                   getMavenProject().getDistributionById(id);
  -            
  -            // Now if the <tag> for this distribution is HEAD then
  -            // we will make a special snapshot JAR.
  -            if (d.getTag().equals("HEAD"))
  -            {
  -                // We now need to push our YYMMDD-HHMMSS
  -                // timestamp into the build so it can be used
  -                // for the snapshot JARs.
  -            }
               
               getProject().setProperty("maven.tag", d.getTag());
           }
  
  
  
  1.8       +5 -2      jakarta-turbine-maven/src/templates/build/plugins/core/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/core/build.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- build.xml 30 May 2002 17:45:11 -0000      1.7
  +++ build.xml 1 Jun 2002 03:31:56 -0000       1.8
  @@ -452,9 +452,12 @@
     <target
       name="jar"
       depends="compile,#callback("pre-jar"),do-jar,#callback("post-jar")"
  -    description="o Generates the ${project} JAR file (default)"/>
  +    description="o Generates the ${project} JAR file (default)"
  +  />
   
  -  <target name="do-jar" depends="jar-resources">
  +  <target 
  +    name="do-jar" 
  +    depends="jar-resources">
   
       <ant antfile="${maven.home}/plugins/test/build.xml" target="test"/>
   
  
  
  

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

Reply via email to