Skip to content
This repository was archived by the owner on Sep 26, 2020. It is now read-only.

Commit bce649e

Browse files
committed
Use buildnumber-maven-plugin to replace old svnInfo Ant task
1 parent a5f0141 commit bce649e

File tree

4 files changed

+56
-72
lines changed

4 files changed

+56
-72
lines changed

util/gwt-shared/pom.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,33 @@
1212

1313
<artifactId>gwt-shared</artifactId>
1414

15+
<build>
16+
<resources>
17+
<resource>
18+
<directory>src/main/resources</directory>
19+
<filtering>true</filtering>
20+
</resource>
21+
</resources>
22+
<plugins>
23+
<plugin>
24+
<groupId>org.codehaus.mojo</groupId>
25+
<artifactId>buildnumber-maven-plugin</artifactId>
26+
<version>1.1</version>
27+
<executions>
28+
<execution>
29+
<goals>
30+
<goal>create</goal>
31+
</goals>
32+
</execution>
33+
</executions>
34+
<configuration>
35+
<revisionOnScmFailure>unknown</revisionOnScmFailure>
36+
<shortRevisionLength>7</shortRevisionLength>
37+
</configuration>
38+
</plugin>
39+
</plugins>
40+
</build>
41+
1542
<dependencies>
1643
<dependency>
1744
<groupId>com.google.guava</groupId>

util/gwt-shared/src/main/java/com/google/gwt/dev/About.java

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -24,48 +24,8 @@
2424
*/
2525
public class About {
2626

27-
// TODO(zundel): These public constants should be removed some day.
28-
// Java inlines static final constants in compiled classes, leading to
29-
// version incompatibility warnings.
30-
/**
31-
* @deprecated use {@link #getGwtName()} instead.
32-
*/
33-
@Deprecated
34-
public static String GWT_NAME;
35-
36-
/**
37-
* @deprecated use {@link #getGwtSvnRev()} instead.
38-
*/
39-
@Deprecated
40-
public static String GWT_SVNREV;
41-
42-
/**
43-
* @deprecated use {@link #getGwtVersion()} instead.
44-
*/
45-
@Deprecated
46-
public static String GWT_VERSION;
47-
48-
/**
49-
* @deprecated use {@link #getGwtVersionObject()} or
50-
* {@link #getGwtVersionNum()} instead.
51-
*/
52-
@Deprecated
53-
public static String GWT_VERSION_NUM;
54-
55-
/**
56-
* Tag used for text replacement of the SVN version (split up to avoid
57-
* replacing it here).
58-
*/
59-
private static final String GWT_SVNREV_TAG = "@GWT_" + "SVNREV@";
60-
61-
/**
62-
* Tag used for text replacement of the GWT version (split up to avoid
63-
* replacing it here).
64-
*/
65-
private static final String GWT_VERSION_TAG = "@GWT_" + "VERSION@";
66-
6727
private static final String gwtName = "Google Web Toolkit";
68-
private static final String gwtSvnRev;
28+
private static final String gwtRevision;
6929
private static final GwtVersion gwtVersion;
7030

7131
static {
@@ -77,28 +37,14 @@ public class About {
7737
// okay... we use default values, then.
7838
}
7939

80-
String tmp;
81-
tmp = props.getProperty("gwt.svnrev");
82-
// Check for null or sentinel value
83-
if (tmp == null || tmp.equals(GWT_SVNREV_TAG)) {
84-
gwtSvnRev = "unknown";
85-
} else {
86-
gwtSvnRev = tmp;
87-
}
40+
gwtRevision = props.getProperty("gwt.revision", "unknown");
8841

89-
tmp = props.getProperty("gwt.version");
90-
// Check for null or sentinel value
91-
if (tmp == null || tmp.equals(GWT_VERSION_TAG)) {
42+
String tmp = props.getProperty("gwt.version");
43+
if (tmp == null) {
9244
gwtVersion = new GwtVersion();
9345
} else {
9446
gwtVersion = new GwtVersion(tmp);
9547
}
96-
97-
// Initialize deprecated constants
98-
GWT_NAME = getGwtName();
99-
GWT_VERSION = getGwtVersion();
100-
GWT_VERSION_NUM = getGwtVersionNum();
101-
GWT_SVNREV = getGwtSvnRev();
10248
}
10349

10450
/**
@@ -109,13 +55,26 @@ public static String getGwtName() {
10955
}
11056

11157
/**
112-
* Returns the Subversion repository revision number.
58+
* Returns the Git repository revision SHA1.
11359
*
114-
* @return the subversion revision or 'unknown' if the value couldn't be
60+
* @return the git revision or 'unknown' if the value couldn't be
11561
* determined at build time.
62+
*
63+
* @deprecated Use {@link #getGwtRevision()} instead
11664
*/
65+
@Deprecated
11766
public static String getGwtSvnRev() {
118-
return gwtSvnRev;
67+
return gwtRevision;
68+
}
69+
70+
/**
71+
* Returns the Git repository revision SHA1.
72+
*
73+
* @return the git revision or 'unknown' if the value couldn't be
74+
* determined at build time.
75+
*/
76+
public static String getGwtRevision() {
77+
return gwtRevision;
11978
}
12079

12180
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
gwt.version=@GWT_VERSION@
2-
gwt.svnrev=@GWT_SVNREV@
1+
gwt.version=@project.version@
2+
gwt.revision=@buildNumber@

util/gwt-shared/src/test/java/com/google/gwt/dev/AboutTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,20 @@
2222
*/
2323
public class AboutTest extends TestCase {
2424

25-
@SuppressWarnings("deprecation")
26-
public void testDeprecatedConstants() {
27-
assertEquals("GWT_NAME", About.getGwtName(), About.GWT_NAME);
28-
assertEquals("GWT_VERSION", About.getGwtVersion(), About.GWT_VERSION);
29-
assertEquals("GWT_VERSION_NUM", About.getGwtVersionNum(), About.GWT_VERSION_NUM);
30-
assertEquals("GWT_SVNREV", About.getGwtSvnRev(), About.GWT_SVNREV);
31-
}
32-
3325
public void testGwtName() {
3426
String result = About.getGwtName();
3527
assertTrue("Google Web Toolkit".equals(result));
3628
}
3729

3830
public void testGwtSvnRev() {
31+
@SuppressWarnings("deprecation")
3932
String result = About.getGwtSvnRev();
40-
assertFalse(result.length() == 0);
33+
assertFalse(result.length() == 0);
34+
}
35+
36+
public void testGwtRevision() {
37+
String result = About.getGwtRevision();
38+
assertFalse(result.length() == 0);
4139
}
4240

4341
public void testGwtVersion() {

0 commit comments

Comments
 (0)