db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew McIntyre <fuzzylo...@nonintuitive.com>
Subject Re: version scheme
Date Fri, 03 Sep 2004 22:21:55 GMT

On Sep 3, 2004, at 11:54 AM, Daniel John Debrunner wrote:
> Then we need an ant way of executing svnversion and setting
> changenumber, this is in top level build.xml file.

Attached is a patch for this. Note that this patch assumes that it is  
ok to have letters in the build number, which is not currently the  
case.  Currently,
org.apache.derby.iapi.services.info.ProductVersionHolder assumes that  
the build number will be an integer, so if your version string  
contained a letter (like the M from the version string svnversion  
supplies), the version would actually be set to -1 according to how  
NumberFormatExceptions are handled there. See  
ProductVersionHolder.java, lines 291 and 371-385.

To work with the current method which expects an integer, you could add:

<replaceregexp file="${basedir}/changenumber.properties" match="M"  
<replaceregexp file="${basedir}/changenumber.properties" match="S"  
<replaceregexp file="${basedir}/changenumber.properties" match="^.*:"  

to the getsvnversion target to handle the possible outputs of  
svnversion which might lead to error.

Note for this patch also that if svnversion fails, the revision will be  
set to 1 (or to the last time changenumber.properties was set).


Index: build.xml
--- build.xml   (revision 13)
+++ build.xml   (working copy)
@@ -631,16 +631,20 @@
    <target name="buildjarsclean"  
    <target name="buildjars"  

-  <target name="initjars" depends="setsanityname">
+  <target name="initjars" depends="setsanityname,getsvnversion">
      <property name="derby.jar.dir"  
      <property name="derby.jar.topdir" value="${basedir}/jars"/>
      <mkdir dir="${derby.jar.dir}"/>
      <mkdir dir="${derby.jar.dir}/lists"/>
+    <loadfile srcFile="${basedir}/changenumber.properties"
+              failonerror="false"
+              property="changenumber"/>
      <condition property="changenumber" value="1">
          <isset property="changenumber"/>
+    <echo message="Revision number set to ${changenumber}."/>

@@ -930,6 +934,14 @@

+  <target name="getsvnversion">
+    <exec executable="svnversion"
+          failifexecutionfails="no"
+          output="${basedir}/changenumber.properties">
+      <arg value="${basedir}"/>
+      <arg value="-n"/>
+    </exec>
+  </target>

    <target name="cleanjars" depends="setsanityname">
      <delete dir="${basedir}/jars/${sanity.name}"/>

View raw message