]> source.dussan.org Git - poi.git/commitdiff
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-63924...
authorNick Burch <nick@apache.org>
Sat, 12 Jul 2008 19:43:06 +0000 (19:43 +0000)
committerNick Burch <nick@apache.org>
Sat, 12 Jul 2008 19:43:06 +0000 (19:43 +0000)
https://svn.apache.org:443/repos/asf/poi/trunk

........
  r676221 | nick | 2008-07-12 20:37:17 +0100 (Sat, 12 Jul 2008) | 1 line

  Implement idea from bug #35583 - Include a version class, org.apache.poi.Version, to allow easy introspection of the POI version
........

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@676225 13f79535-47bb-0310-9956-ffa450edef68

build.xml
src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/resources/version/Version.java.template [new file with mode: 0644]

index 29e2333b87f513f60e430e446696723569b5536b..b3d4ca8dd0a3d91c4ba7a5adb3cb7579cbb321e1 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -554,6 +554,32 @@ under the License.
     </javac>
   </target>
 
+  <target name="compile-version" depends="init"
+        description="Compiles the version class">
+       <!-- Generate the .java file -->
+       <property name="version.java" value="${main.output.dir}/org/apache/poi/Version.java" />
+       <delete file="${version.java}" />
+       <copy 
+               file="src/resources/version/Version.java.template"
+               tofile="${version.java}">
+               <filterset>
+                       <filter token="VERSION" value="${version.id}" />
+                       <filter token="DSTAMP" value="${DSTAMP}" />
+               </filterset>
+       </copy>
+
+       <!-- Compile -->
+    <javac target="${jdk.version.class}" source="${jdk.version.source}"
+      failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
+      srcdir="${main.output.dir}" />
+    <javac target="${jdk14.version.class}" source="${jdk14.version.source}"
+      failonerror="true" destdir="${main14.output.dir}" debug="on" fork="yes"
+      srcdir="${main.output.dir}" />
+
+       <!-- Tidy up -->
+       <delete file="${version.java}" />
+  </target>
+
   <target name="test" depends="test-main,test-scratchpad,test-contrib"
     description="Tests main, contrib and scratchpad"/>
 
@@ -1185,7 +1211,7 @@ FORREST_HOME environment variable!</echo>
                <!-- And that's it for maven -->
        </target>
 
-    <target name="jar-14" depends="compile-main-14" description="Creates the jdk 1.4 only jar file">
+    <target name="jar-14" depends="compile-main-14, compile-version" description="Creates the jdk 1.4 only jar file">
         <jar destfile="${dist.dir}/${jar.name}-jdk14-${version.id}-${DSTAMP}.jar">
                        <fileset dir="${main14.output.dir}" />
                        <fileset dir="legal/" />
@@ -1200,7 +1226,7 @@ FORREST_HOME environment variable!</echo>
             </manifest>        
         </jar>
        </target>
-    <target name="jar" depends="compile, jar-14" description="Creates jar files for distribution">
+    <target name="jar" depends="compile, compile-version, jar-14" description="Creates jar files for distribution">
         <jar destfile="${dist.dir}/${jar.name}-${version.id}-${DSTAMP}.jar">
                        <fileset dir="${main.output.dir}" />
                        <fileset dir="legal/" />
index 971e0df451d9aa9497fcce757f81c4b9ac7c7a2c..ab7565ea3d83c85ad6fa9229e44e243db07083eb 100644 (file)
@@ -50,6 +50,7 @@
            <action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
         </release>
         <release version="3.1.1-alpha1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="add">35583 - Include a version class, org.apache.poi.Version, to allow easy introspection of the POI version</action>
            <action dev="POI-DEVELOPERS" type="add">Allow the cloning of one HSSFCellStyle onto another, including cloning styles from one HSSFWorkbook onto another</action>
            <action dev="POI-DEVELOPERS" type="fix">45289 - finished support for special comparison operators in COUNTIF</action>
            <action dev="POI-DEVELOPERS" type="fix">45126 - Avoid generating multiple NamedRanges with the same name, which Excel dislikes</action>
index 88099bf3e09d051cf93a66cf3f5af982185acecf..0c55a1e963e9e46c936db13f74e558fb1d1c0bc8 100644 (file)
@@ -47,6 +47,7 @@
            <action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
         </release>
         <release version="3.1.1-alpha1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="add">35583 - Include a version class, org.apache.poi.Version, to allow easy introspection of the POI version</action>
            <action dev="POI-DEVELOPERS" type="add">Allow the cloning of one HSSFCellStyle onto another, including cloning styles from one HSSFWorkbook onto another</action>
            <action dev="POI-DEVELOPERS" type="fix">45289 - finished support for special comparison operators in COUNTIF</action>
            <action dev="POI-DEVELOPERS" type="fix">45126 - Avoid generating multiple NamedRanges with the same name, which Excel dislikes</action>
diff --git a/src/resources/version/Version.java.template b/src/resources/version/Version.java.template
new file mode 100644 (file)
index 0000000..716ec91
--- /dev/null
@@ -0,0 +1,69 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
+package org.apache.poi;
+
+/**
+ * Administrative class to keep track of the version number of the 
+ *  POI release.
+ *
+ * This class implements the upcoming standard of having 
+ *  org.apache.project-name.Version.getVersion() be a standard 
+ *  way to get version information.
+ */
+public class Version {
+       private static final String VERSION_STRING = "@VERSION@";
+       private static final String RELEASE_DATE = "@DSTAMP@";
+
+       /**
+        * Return the basic version string, of the form
+        *  nn.nn(.nn)
+        */
+       public static String getVersion() {
+               return VERSION_STRING;
+       }
+
+       /**
+        * Return the date of the release / build
+        */
+       public static String getReleaseDate() {
+               return RELEASE_DATE;
+       }
+
+       /**
+        * Name of product: POI
+        */
+       public static String getProduct() {
+               return "POI";
+       }
+       /**
+        * Implementation Language: Java
+        */
+       public static String getImplementationLanguage() {
+               return "Java";
+       }
+
+       /**
+        * Prints the version to the command line
+        */
+       public static void main(String[] args) {
+               System.out.println(
+                       "Apache " + getProduct() + " " +
+                       getVersion() + " (" + getReleaseDate() + ")"
+               );
+       }
+}