Change instance initializer in About.java to static. Most of the work, though, was on the Ant files such that once the filtered copies have already been generated, they will re-generate IFF the gwt OR svn versions have changed (i.e. after an svn up).
Review by: scottb
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@3646 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/common.ant.xml b/common.ant.xml
index c8ab767..160faa1 100755
--- a/common.ant.xml
+++ b/common.ant.xml
@@ -199,10 +199,7 @@
</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"/>
+ <macrodef name="gwt.getsvninfo" description="Identifies the SVN info of a workspace">
<sequential>
<exec outputproperty="svn.info" executable="svn"
failifexecutionfails="false" logError="true">
@@ -227,7 +224,31 @@
casesensitive="false" />
<property name="gwt.svnrev"
value="${gwt.svn.branch}@${gwt.svn.version}"/>
+ <!-- Windows NTFS and FAT don't like ':' or '@', and we need a sentinel file to test
+ for out-of-dateness, so this is a filename-acceptable equivalent to svnrev -->
+ <propertyregex property="gwt.svnrev.filename"
+ input="${gwt.svnrev}"
+ regexp="[:@]"
+ replace="-"
+ defaultValue="${gwt.svnrev}"/>
+ <!-- Generally, filtering requires a sentinel file so that changes to svn rev will
+ be noticed as invalidating the previously-generated filter output. This property
+ names where such a sentinel lives; it is tested with <available/> and created
+ with <touch/> -->
+ <mkdir dir="${project.build}/sentinels" />
+ <property name="filter.sentinel"
+ location="${project.build}/sentinels/gwt-${gwt.version}-svn-${gwt.svnrev.filename}" />
+ </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>
<!-- These files must be filtered for versioning -->
+ <echo message="Branding as GWT version ${gwt.version}, SVN rev ${gwt.svnrev}"/>
<mkdir dir="@{todir}" />
<copy todir="@{todir}" overwrite="true">
<src.fileset/>
@@ -236,7 +257,6 @@
<filter token="GWT_SVNREV" value="${gwt.svnrev}" />
</filterset>
</copy>
- <echo message="Branding as GWT version ${gwt.version}, SVN rev ${gwt.svnrev}"/>
</sequential>
</macrodef>
diff --git a/dev/common.ant.xml b/dev/common.ant.xml
index 58266be..4353204 100755
--- a/dev/common.ant.xml
+++ b/dev/common.ant.xml
@@ -19,8 +19,11 @@
<target name="build" depends="compile" description="Build and package this project">
<mkdir dir="${gwt.build.lib}" />
<gwt.jar>
- <fileset dir="src" excludes="**/package.html" />
- <fileset dir="${gwt.core.root}/src" excludes="**/package.html" />
+ <fileset dir="src" excludes="**/package.html"/>
+ <fileset dir="${gwt.core.root}/src">
+ <exclude name="**/package.html"/>
+ <exclude name="com/google/gwt/dev/About.properties"/>
+ </fileset>
<fileset dir="${gwt.core.root}/super" excludes="**/package.html" />
<fileset dir="${javac.out}" />
<fileset dir="${gwt.core.build}/bin" />
diff --git a/dev/core/build.xml b/dev/core/build.xml
index 5b6a713..bcc6f13 100755
--- a/dev/core/build.xml
+++ b/dev/core/build.xml
@@ -57,12 +57,12 @@
<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" />
- <gwt.revfilter todir="${src.filtered}" >
+ <target name="-filter.props" description="Creates filtered About.properties with version info"
+ unless="filter.uptodate">
+ <gwt.revfilter todir="${javac.out}">
<fileset dir="src" includes="${filter.pattern}" />
</gwt.revfilter>
- <touch file="${src.filtered}/gwt.version-${gwt.version}" />
+ <touch file="${filter.sentinel}" />
</target>
<target name="build" depends="build.alldeps.jar" description="Compiles this project">
@@ -76,22 +76,8 @@
<mkdir dir="${javac.out-dummy}" />
<gwt.javac srcdir="src-dummy" destdir="${javac.out-dummy}" />
- <!-- Files with hardcoded version information must be filtered -->
- <property name="src.filtered" location="${project.build}/src-filtered" />
- <condition property="filter.uptodate">
- <and>
- <available file="${src.filtered}/gwt.version-${gwt.version}" />
- <uptodate>
- <srcfiles dir="src" includes="${filter.pattern}" />
- <globmapper from="*" to="${src.filtered}/*" />
- </uptodate>
- </and>
- </condition>
- <antcall target="-filter.src" />
-
<mkdir dir="${javac.out}" />
<gwt.javac srcdir="super" excludes="com/google/gwt/dev/jjs/intrinsic/"/>
- <gwt.javac srcdir="${src.filtered}" />
<gwt.javac srcdir="src" excludes="${filter.pattern}">
<classpath>
<pathelement location="${javac.out-dummy}" />
@@ -102,8 +88,21 @@
</classpath>
</gwt.javac>
<copy todir="${javac.out}">
- <fileset dir="src" includes="**/*.properties"/>
- </copy>
+ <fileset dir="src" includes="**/*.properties" excludes="${filter.pattern}"/>
+ </copy>
+
+ <!-- Files with hardcoded version information must be filtered -->
+ <gwt.getsvninfo />
+ <condition property="filter.uptodate">
+ <and>
+ <available file="${filter.sentinel}" />
+ <uptodate>
+ <srcfiles dir="src" includes="${filter.pattern}" />
+ <globmapper from="*" to="${javac.out}/*" />
+ </uptodate>
+ </and>
+ </condition>
+ <antcall target="-filter.props" />
</target>
<target name="checkstyle" description="Static analysis of source">
diff --git a/dev/core/src/com/google/gwt/dev/About.java b/dev/core/src/com/google/gwt/dev/About.java
index 98d15f1..b64eb5a 100644
--- a/dev/core/src/com/google/gwt/dev/About.java
+++ b/dev/core/src/com/google/gwt/dev/About.java
@@ -32,13 +32,10 @@
public static String GWT_VERSION;
- {
- Class<? extends About> myClass = this.getClass();
- String propsPath = myClass.getName().replace('.', '/').concat(".properties");
+ static {
Properties props = new Properties();
try {
- InputStream instream = myClass.getClassLoader().getResourceAsStream(
- propsPath);
+ InputStream instream = About.class.getResourceAsStream("About.properties");
props.load(instream);
} catch (IOException iox) {
// okay... we use default values, then.
diff --git a/distro-source/common.ant.xml b/distro-source/common.ant.xml
index a1c24cf..4657d66 100755
--- a/distro-source/common.ant.xml
+++ b/distro-source/common.ant.xml
@@ -17,9 +17,24 @@
</patternset>
<target name="filter" description="Filters distro files for versioning">
+ <gwt.getsvninfo />
+ <condition property="filter.uptodate">
+ <and>
+ <available file="${filter.sentinel}" />
+ <uptodate>
+ <srcfiles dir="../core/src" />
+ <globmapper from="*" to="${project.build}/*" />
+ </uptodate>
+ </and>
+ </condition>
+ <antcall target="-filter.props" />
+ </target>
+
+ <target name="-filter.props" unless="filter.uptodate">
<gwt.revfilter todir="${project.build}" >
<fileset dir="../core/src" />
</gwt.revfilter>
+ <touch file="${filter.sentinel}" />
</target>
<target name="clean" description="Cleans this project's intermediate and output files">
diff --git a/distro-source/linux/build.xml b/distro-source/linux/build.xml
index dc0aa37..c3739a3 100755
--- a/distro-source/linux/build.xml
+++ b/distro-source/linux/build.xml
@@ -25,6 +25,7 @@
</tarfileset>
<tarfileset dir="${project.build}" prefix="${project.distname}">
<patternset refid="chmod.not.executables" />
+ <exclude name="sentinels/**"/>
</tarfileset>
<tarfileset dir="src" prefix="${project.distname}" mode="755">
<patternset refid="chmod.executables" />
diff --git a/distro-source/mac/build.xml b/distro-source/mac/build.xml
index 338d8f7..f6c86c9 100755
--- a/distro-source/mac/build.xml
+++ b/distro-source/mac/build.xml
@@ -27,6 +27,7 @@
</tarfileset>
<tarfileset dir="${project.build}" prefix="${project.distname}">
<patternset refid="chmod.not.executables" />
+ <exclude name="sentinels/**"/>
</tarfileset>
<tarfileset dir="src" prefix="${project.distname}" mode="755">
<patternset refid="chmod.executables" />
diff --git a/distro-source/windows/build.xml b/distro-source/windows/build.xml
index 015ec56..8f3c813 100755
--- a/distro-source/windows/build.xml
+++ b/distro-source/windows/build.xml
@@ -20,7 +20,9 @@
</zipfileset>
<!-- raw files -->
- <zipfileset dir="${project.build}" prefix="${project.distname}" />
+ <zipfileset dir="${project.build}" prefix="${project.distname}">
+ <exclude name="sentinels/**"/>
+ </zipfileset>
<zipfileset dir="src" prefix="${project.distname}" />
<!-- doc -->