Skip to content

Commit

Permalink
Drop branch from version string/product id info
Browse files Browse the repository at this point in the history
  • Loading branch information
pzygielo committed Jun 11, 2023
1 parent f985ae7 commit 3391229
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
product.name=${product.name}
product.name.abbreviation=${product.name.abbreviation}
product.version=${project.version}
product.build.git.branch=${git.branch}
product.build.git.commit=${git.commit.id.full}
product.build.timestamp=${git.build.time}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,10 @@ public void versionAfterShutdown() {

private void checkOutput(String output) throws MultipleFailuresError {
assertThat(output,
stringContainsInOrder("Version = Eclipse GlassFish ", " (branch: ", ", commit: ", ", timestamp: "));
String branch = StringUtils.substringBetween(output, "branch: ", ",");
stringContainsInOrder("Version = Eclipse GlassFish ", "commit: ", ", timestamp: "));
String commit = StringUtils.substringBetween(output, "commit: ", ",");
String timestamp = StringUtils.substringBetween(output, ", timestamp: ", ")");
assertAll(
() -> assertThat(branch, matchesPattern("[^\\ ]+")),
() -> assertThat(commit, matchesPattern("[a-f0-9]+")),
() -> assertDoesNotThrow(() -> Instant.parse(timestamp))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -936,8 +936,6 @@ The meaning of each keyword-value pair is as follows:
Specifies an abbreviated form of the product name without any release information.
`product.version=2023.02.24`::
Returns the product version. It should follow standard form `major.minor.patch[-suffix]`
`product.build.git.branch=experimental`::
Specifies the git branch, used for the build.
`product.build.git.commit=ec1ce24934f0bb174333a9886b58a0d2f9e52b44`::
Specifies the git commit, used for the build.
`product.build.timestamp=2023-02-27T11:09:42Z`::
Expand All @@ -956,7 +954,6 @@ The abbreviated product name is `GF`.
product.name=Eclipse GlassFish
product.name.short=GF
product.version=7.0.3-SNAPSHOT
product.build.git.branch=master
product.build.git.commit=93176e2555176091c8522e43d1d32a0a30652d4a
product.build.timestamp=2023-02-27T11:09:42Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class Version {
private static final String KEY_PRODUCT_NAME = "product.name";
private static final String KEY_PRODUCT_NAME_ABBREVIATION = "product.name.abbreviation";
private static final String KEY_PRODUCT_VERSION = "product.version";
private static final String KEY_GIT_BRANCH = "product.build.git.branch";
private static final String KEY_GIT_COMMIT = "product.build.git.commit";
private static final String KEY_BUILD_TIMESTAMP = "product.build.timestamp";
private static final String KEY_BASED_ON = "based.on";
Expand All @@ -62,7 +61,6 @@ public class Version {
private static final int VERSION_MINOR;
private static final int VERSION_PATCH;

private static final String GIT_BRANCH;
private static final String COMMIT;
private static final Instant BUILD_TIMESTAMP;

Expand Down Expand Up @@ -107,7 +105,6 @@ public class Version {
}
VERSION_RELEASE = Integer.toString(VERSION_MAJOR) + '.' + Integer.toString(VERSION_MINOR) + '.'
+ Integer.toString(VERSION_PATCH);
GIT_BRANCH = getProperty(KEY_GIT_BRANCH, null);
COMMIT = getProperty(KEY_GIT_COMMIT, null);
String timestamp = getProperty(KEY_BUILD_TIMESTAMP, null);
BUILD_TIMESTAMP = timestamp == null ? null : Instant.parse(timestamp);
Expand Down Expand Up @@ -144,7 +141,7 @@ public static String getProductId() {
* </pre>
*/
public static String getProductIdInfo() {
return getProductName() + " " + getVersion() + " (branch: " + GIT_BRANCH + ", commit: " + COMMIT
return getProductName() + " " + getVersion() + " (commit: " + COMMIT
+ ", timestamp: " + BUILD_TIMESTAMP + ")";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void parse() {
assertAll(
() -> assertEquals("Wonderful GlassFish 2023.2.27", Version.getProductId()),
() -> assertEquals(
"Wonderful GlassFish 2023.2.27-SNAPSHOT (branch: experimental,"
+ " commit: 93176e2555176091c8522e43d1d32a0a30652d4a, timestamp: 2023-02-27T11:09:42Z)",
"Wonderful GlassFish 2023.2.27-SNAPSHOT ("
+ "commit: 93176e2555176091c8522e43d1d32a0a30652d4a, timestamp: 2023-02-27T11:09:42Z)",
Version.getProductIdInfo()),
() -> assertEquals("Wonderful GlassFish", Version.getProductName()),
() -> assertEquals("WGF", Version.getProductNameAbbreviation()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
product.name=Wonderful GlassFish
product.name.abbreviation=WGF
product.version=2023.2.27-SNAPSHOT
product.build.git.branch=experimental
product.build.git.commit=93176e2555176091c8522e43d1d32a0a30652d4a
product.build.timestamp=2023-02-27T11:09:42Z

Expand Down
1 change: 0 additions & 1 deletion nucleus/parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,6 @@
<dateFormatTimeZone>UTC</dateFormatTimeZone>
<commitIdGenerationMode>full</commitIdGenerationMode>
<includeOnlyProperties>
<includeOnlyProperty>git.branch</includeOnlyProperty>
<includeOnlyProperty>git.build.time</includeOnlyProperty>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
<includeOnlyProperty>git.commit.id.full</includeOnlyProperty>
Expand Down

0 comments on commit 3391229

Please sign in to comment.