db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1021394 - in /db/derby/code/trunk: build.xml java/build/org/apache/derbyPreBuild/ReleaseProperties.java
Date Mon, 11 Oct 2010 15:47:38 GMT
Author: rhillegas
Date: Mon Oct 11 15:47:38 2010
New Revision: 1021394

URL: http://svn.apache.org/viewvc?rev=1021394&view=rev
Log:
DERBY-2573: More some of the release-id drudgery into the master release-building target.

Modified:
    db/derby/code/trunk/build.xml
    db/derby/code/trunk/java/build/org/apache/derbyPreBuild/ReleaseProperties.java

Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/build.xml?rev=1021394&r1=1021393&r2=1021394&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Mon Oct 11 15:47:38 2010
@@ -322,8 +322,14 @@
     </propertyfile>
   </target>  
 
-    <!-- Create the release properties file -->
-  <target name="writeReleaseProperties" depends="init,prebuild">
+    <!--
+        Create the release properties file and check it in
+
+        Args:
+
+            bumpID    true or false, depending on whether you want to increment the last
digit of the release id (defaults to false)
+    -->
+  <target name="writeReleaseProperties" depends="init,prebuild,promptforsvncredentials,promptforreleaseid">
 
     <taskdef
       name="writeReleaseProperties"
@@ -331,11 +337,27 @@
       classpath="${out.dir}"
     />
 
+    <property name="releasePropertyFile" value="${properties.dir}/release.properties"/>
+    <property name="bumpID" value="false"/>
+
     <writeReleaseProperties
       releaseID="${derby.release.id}"
-      releasePropertiesFileName="${properties.dir}/release.properties"
+      releasePropertiesFileName="${releasePropertyFile}"
+      bump="${bumpID}"
     />
 
+    <!--
+        If we were asked to bump the release id, then the actual release id
+        will be different from the original id passed into this target.
+    -->
+    <echo message="Derby release ID set to: ${derby.release.id.new}"/>
+
+    <!-- Check in the new release id. -->
+    <antcall target="checkinfile">
+       <param name="checkinComment" value="Derby release ID set to: ${derby.release.id.new}"/>
+       <param name="fileName" value="${releasePropertyFile}"/>
+    </antcall>
+    
   </target>  
 
 <!-- ==================================================================== -->
@@ -1868,11 +1890,35 @@
    <!-- Checkin the generated error documentation to the docs client -->
    <target name="copyerrordocs">
 
+     <property name="refdir" value="${docs.root}/src/ref"/>
+
+     <copy file="${sqlstateTables}" todir="${refdir}"/>
+
+      <antcall target="checkinfile">
+         <param name="checkinComment" value="Check in SQLState tables as part of building
a release."/>
+         <param name="fileName" value="${refdir}/${sqlstateTables}"/>
+      </antcall>
+
+     <!-- Bring the docs client up to date again -->
+     <antcall target="updatesvndoc"/>
+
+   </target>
+
+   <!--
+       Checkin in-flight edits
+
+       Args:
+           checkinComment   This is the subversion checkin comment.
+           fileName   This is the name of the file to checking (could be the root of the
client).
+   -->
+   <target name="checkinfile">
+
      <property name="checkinMessage" value="${release.base}/tmp.checkin.message"/>
+     <property name="fullComment" value="[RELEASE CHECKIN] ${checkinComment}"/>
 
-     <copy file="${sqlstateTables}" todir="${docs.root}/src/ref"/>
+     <echo file="${checkinMessage}" message="${fullComment}"/>
+     <echo message="Checking in ${fileName} with this comment: ${fullComment}"/>
 
-     <echo file="${checkinMessage}" message="Check in SQLState tables as part of building
a release."/>
      <exec executable="svn">
        <arg value="commit"/>
        <arg value="--username"/>
@@ -1881,7 +1927,7 @@
        <arg value="${svn.password}"/>
        <arg value="-F"/>
        <arg value="${checkinMessage}"/>
-       <arg value="${docs.root}"/>
+       <arg value="${fileName}"/>
      </exec>
 
      <!-- Bring the docs client up to date again -->
@@ -2483,11 +2529,21 @@ you should not have to do this.
       <delete dir="${lf.dir}"/>
       <delete file="${release.dir}/maintversion.properties"/>
 
+       <!-- the release candidate has been built. now we can bump the release id.  -->
+       <antcall target="writeReleaseProperties">
+          <param name="bumpID" value="true"/>
+       </antcall>
+
     </target>
 
     <!-- do most of the ant calls to prepare a release -->
     <target name="prepareforrelease" depends="checkdocsroot,checksvnclientsclean,promptforreleaseproperties,checkstateremoved,checksanenotset,cleanalljars,cleandocs,clobber,cleanreleasefiles">
 
+        <!-- set the release id -->
+        <antcall target="writeReleaseProperties">
+           <param name="bumpID" value="false"/>
+        </antcall>
+
         <!-- we should already be squeeky clean, depends removed jars, javadoc, snapshot,
classes, and old release artifacts -->
         <antcall target="updatesvnclients"/>
 
@@ -2535,7 +2591,10 @@ you should not have to do this.
 
         Sneaky, very, very sneaky.
     -->
-    <target name="promptforreleaseproperties" depends="prebuild">
+    <target name="promptforreleaseproperties" depends="promptforsvncredentials,promptforpgpcredentials,promptforreleaseid"/>
+
+    <!-- Define the task which prompts for missing properties -->
+    <target name="defineprompt" depends="prebuild">
 
         <taskdef
           name="promptForProperty"
@@ -2543,6 +2602,11 @@ you should not have to do this.
           classpath="${out.dir}"
         />
 
+    </target>
+
+    <!-- Prompt for subversion credentials if they are missing -->
+    <target name="promptforsvncredentials" depends="defineprompt">
+
         <promptForProperty
           propertyName="svn.username"
           prompt="Enter your Apache subversion username >  "
@@ -2553,6 +2617,11 @@ you should not have to do this.
           prompt="Enter your Apache subversion password >  "
         />
 
+    </target>
+
+    <!-- Prompt for key-signing credentials if they are missing -->
+    <target name="promptforpgpcredentials" depends="defineprompt">
+
         <promptForProperty
           propertyName="pgp.passphrase"
           prompt="Enter your pgp passphrase >  "
@@ -2560,6 +2629,16 @@ you should not have to do this.
 
     </target>
 
+    <!-- Prompt for release id if it is missing -->
+    <target name="promptforreleaseid" depends="defineprompt">
+
+        <promptForProperty
+          propertyName="derby.release.id"
+          prompt="Enter the id of this release (e.g., 10.7.1.0) >  "
+        />
+
+    </target>
+
     <target name="checkstateremoved" depends="state.exists">
         <fail message="Cannot build a release; please remove java/engine/state.properties
by running ant cleanstate (or run ant clobber)">
             <condition>

Modified: db/derby/code/trunk/java/build/org/apache/derbyPreBuild/ReleaseProperties.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/build/org/apache/derbyPreBuild/ReleaseProperties.java?rev=1021394&r1=1021393&r2=1021394&view=diff
==============================================================================
--- db/derby/code/trunk/java/build/org/apache/derbyPreBuild/ReleaseProperties.java (original)
+++ db/derby/code/trunk/java/build/org/apache/derbyPreBuild/ReleaseProperties.java Mon Oct
11 15:47:38 2010
@@ -29,6 +29,7 @@ import java.util.Calendar;
 import java.util.StringTokenizer;
 
 import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.Property;
 import org.apache.tools.ant.Task;
 
 /**
@@ -81,6 +82,9 @@ public class ReleaseProperties extends T
     // set by caller. name of file where release properties will be written
     private String _releasePropertiesFileName;
     
+    // set by caller. true if the last digit of the release id should be bumped.
+    private boolean _bump;
+    
     /////////////////////////////////////////////////////////////////////////
     //
     //  CONSTRUCTORS
@@ -108,9 +112,13 @@ public class ReleaseProperties extends T
     /** <p>Let Ant set the output file name.</p>*/
     public void setReleasePropertiesFileName( String fileName ) { _releasePropertiesFileName
= fileName; }
 
+    /** <p>Let Ant set our bumping behavior to true or false.</p>*/
+    public void setBump( String bumpFlag ) { _bump = Boolean.parseBoolean( bumpFlag ); }
+
    /**
      * <p>
-     * Create the release properties file from the release id.
+     * Create the release properties file from the release id. Sets the
+     * property derby.release.id.new equal to the resulting release id.
      * </p>
      */
     public  void    execute()
@@ -122,6 +130,8 @@ public class ReleaseProperties extends T
 
         try {
             VersionID versionID = new VersionID( _releaseID );
+            if ( _bump ) { versionID.bump(); }
+            
             int major = versionID.getMajor();
             int minor = versionID.getMinor();
 
@@ -138,6 +148,8 @@ public class ReleaseProperties extends T
             propertiesPW.println( "beta=" + versionID.isBeta() );
             propertiesPW.println( "copyright.comment=Copyright 1997, " + getCurrentYear()
+ " The Apache Software Foundation or its licensors, as applicable." );
             propertiesPW.println( "vendor=The Apache Software Foundation" ) ;
+
+            setProperty( "derby.release.id.new", versionID.toString() );
         }
         catch (Exception e)
         {
@@ -244,17 +256,51 @@ public class ReleaseProperties extends T
             catch (Exception e) { throw badID( text ); }
         }
 
+        /** Bump the last digit of the release id */
+        public void bump() { _point++; }
+
         public int getMajor() { return _major; }
         public int getMinor() { return _minor; }
         public int getFixpack() { return _fixpack; }
         public int getPoint() { return _point; }
         public boolean isBeta() { return _isBeta; }
 
+        public String toString()
+        {
+            StringBuffer buffer = new StringBuffer();
+
+            buffer.append( _major ); buffer.append( '.' );
+            buffer.append( _minor ); buffer.append( '.' );
+            buffer.append( _fixpack ); buffer.append( '.' );
+            buffer.append( _point );
+
+            if ( _isBeta ) { buffer.append( " beta" ); }
+
+            return buffer.toString();
+        }
+
         private BuildException badID( String text )
         {
             return new BuildException( "Version id \"" + text + "\" is not a string of the
form \"N.N.N.N\" or \"N.N.N.N beta\"" );
         }
     }
 
+    /**
+     * <p>
+     * Set an ant property.
+     * </p>
+     */
+    private void    setProperty( String name, String value )
+        throws BuildException
+    {
+        Property    property = new Property();
+
+        property.setName( name );
+        property.setValue( value );
+
+        property.setProject( getProject() );
+        property.execute();
+    }
+
 }
 



Mime
View raw message