Adding SVN branding of About.* with svn branch@version information git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3547 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/common.ant.xml b/common.ant.xml index 6708595..b183d80 100755 --- a/common.ant.xml +++ b/common.ant.xml
@@ -150,7 +150,7 @@ <classpath> <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> <pathelement location="${gwt.tools.antlib}/ant-junit-1.6.5.jar" /> - <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> + <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> </classpath> </taskdef> @@ -172,7 +172,7 @@ <pathelement location="${javac.out}" /> <pathelement location="${gwt.dev.staging.jar}" /> <pathelement location="${gwt.tools.lib}/junit/junit-3.8.1.jar" /> - <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> + <pathelement location="${gwt.tools.lib}/selenium/selenium-java-client-driver.jar" /> <extraclasspaths /> </classpath> @@ -199,6 +199,47 @@ </sequential> </macrodef> + <macrodef name="gwt.revfilter" description="Filters files for versioning"> + <attribute name="todir" description="Destination for the filtered copy"/> + <element name="src.fileset" implicit="true" + description="Source for the filtered copy"/> + <sequential> + <exec outputproperty="svn.info" executable="svn" + failifexecutionfails="false" logError="true"> + <arg value="info"/> + <arg value="${gwt.root}"/> + </exec> + <propertyregex property="gwt.svn.branch" + input="${svn.info}" + regexp="URL: https?://google-web-toolkit.googlecode.com/svn/([^\r\n]+)" + select="\1" + defaultValue="unknown" + casesensitive="false" /> + <exec outputproperty="svn.version" executable="svnversion" + failifexecutionfails="false" logError="true"> + <arg value="${gwt.root}"/> + </exec> + <propertyregex property="gwt.svn.version" + input="${svn.version}" + regexp="^(\d+(:\d+)?[MSP]*)$" + replace="\1" + defaultValue="unknown" + casesensitive="false" /> + <property name="gwt.svnrev" + value="${gwt.svn.branch}@${gwt.svn.version}"/> + <!-- These files must be filtered for versioning --> + <mkdir dir="@{todir}" /> + <copy todir="@{todir}" overwrite="true"> + <src.fileset/> + <filterset> + <filter token="GWT_VERSION" value="${gwt.version}" /> + <filter token="GWT_SVNREV" value="${gwt.svnrev}" /> + </filterset> + </copy> + <echo message="Branding as GWT version ${gwt.version}, SVN rev ${gwt.svnrev}"/> + </sequential> + </macrodef> + <macrodef name="gwt.timer"> <attribute name="name"/> <element name="timer.elements" implicit="true" optional="false"/>
diff --git a/dev/core/build.xml b/dev/core/build.xml index 748985e..b48abc7 100755 --- a/dev/core/build.xml +++ b/dev/core/build.xml
@@ -55,17 +55,13 @@ </gwt.jar> </target> - <property name="filter.pattern" value="com/google/gwt/dev/About.java" /> + <property name="filter.pattern" value="com/google/gwt/dev/About.properties" /> <target name="-filter.src" description="Creates filtered copies of source files" unless="filter.uptodate"> <delete dir="${src.filtered}" failonerror="false" /> - <mkdir dir="${src.filtered}" /> - <copy todir="${src.filtered}" overwrite="true"> + <gwt.revfilter todir="${src.filtered}" > <fileset dir="src" includes="${filter.pattern}" /> - <filterset> - <filter token="GWT_VERSION" value="${gwt.version}" /> - </filterset> - </copy> + </gwt.revfilter> <touch file="${src.filtered}/gwt.version-${gwt.version}" /> </target>
diff --git a/dev/core/src/com/google/gwt/dev/About.java b/dev/core/src/com/google/gwt/dev/About.java index 1349f3d..98d15f1 100644 --- a/dev/core/src/com/google/gwt/dev/About.java +++ b/dev/core/src/com/google/gwt/dev/About.java
@@ -15,18 +15,46 @@ */ package com.google.gwt.dev; +import java.io.InputStream; +import java.io.IOException; +import java.util.Properties; + /** - * About information for GWT. + * About information for GWT. */ public class About { - public static final String GWT_VERSION_NUM = "@GWT_VERSION@"; + public static String GWT_SVNREV; - public static final String GWT_NAME = "Google Web Toolkit"; + public static String GWT_VERSION_NUM; - public static final String GWT_VERSION = GWT_NAME + " " + GWT_VERSION_NUM; + public static String GWT_NAME = "Google Web Toolkit"; + + public static String GWT_VERSION; + + { + Class<? extends About> myClass = this.getClass(); + String propsPath = myClass.getName().replace('.', '/').concat(".properties"); + Properties props = new Properties(); + try { + InputStream instream = myClass.getClassLoader().getResourceAsStream( + propsPath); + props.load(instream); + } catch (IOException iox) { + // okay... we use default values, then. + } + + GWT_SVNREV = props.getProperty("gwt.svnrev"); + if (GWT_SVNREV == null) { + GWT_SVNREV = "unknown"; + } + GWT_VERSION_NUM = props.getProperty("gwt.version"); + if (GWT_VERSION_NUM == null) { + GWT_VERSION_NUM = "0.0.0"; + } + GWT_VERSION = GWT_NAME + " " + GWT_VERSION_NUM; + } private About() { } - }
diff --git a/dev/core/src/com/google/gwt/dev/About.properties b/dev/core/src/com/google/gwt/dev/About.properties new file mode 100644 index 0000000..a30bc0c --- /dev/null +++ b/dev/core/src/com/google/gwt/dev/About.properties
@@ -0,0 +1,2 @@ +gwt.version=@GWT_VERSION@ +gwt.svnrev=@GWT_SVNREV@ \ No newline at end of file
diff --git a/distro-source/common.ant.xml b/distro-source/common.ant.xml index e5904f5..eed395f 100755 --- a/distro-source/common.ant.xml +++ b/distro-source/common.ant.xml
@@ -17,14 +17,9 @@ </patternset> <target name="filter" description="Filters distro files for versioning"> - <!-- These files must be filtered for versioning --> - <mkdir dir="${project.build}" /> - <copy todir="${project.build}"> + <gwt.revfilter todir="${project.build}" > <fileset dir="../core/src" /> - <filterset> - <filter token="GWT_VERSION" value="${gwt.version}" /> - </filterset> - </copy> + </gwt.revfilter> </target> <target name="clean" description="Cleans this project's intermediate and output files">
diff --git a/distro-source/core/src/about.html b/distro-source/core/src/about.html index 753f22a..0158831 100644 --- a/distro-source/core/src/about.html +++ b/distro-source/core/src/about.html
@@ -43,7 +43,7 @@ <td id="title"><a href="http://code.google.com/webtoolkit/">Google Web Toolkit</a></td> </tr> <tr> - <td id="version">Version @GWT_VERSION@</td> + <td id="version">Version @GWT_VERSION@ <br> (Subversion @GWT_SVNREV@)</td> </tr> </table>
diff --git a/distro-source/core/src/about.txt b/distro-source/core/src/about.txt index dd2dfdc..a11ca4b 100644 --- a/distro-source/core/src/about.txt +++ b/distro-source/core/src/about.txt
@@ -1,4 +1,5 @@ Google Web Toolkit @GWT_VERSION@ +(svn revision @GWT_SVNREV@) Copyright (c) Google, Inc. 2008. All rights reserved. Visit Google Code (http://code.google.com/webtoolkit/).