From 37e69c882f9aa50fe06952d555add2e0847d3733 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 21 Nov 2020 06:48:23 +0100 Subject: [PATCH] Added snapshot id in build_information file. --- build.properties | 1 + .../statoolinfos/util/BuildInformation.java | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index 22573d3..e0d632f 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,4 @@ product.name=statoolinfos product.revision.major=0 product.revision.minor=1 +product.revision.snapshot= diff --git a/src/fr/devinsy/statoolinfos/util/BuildInformation.java b/src/fr/devinsy/statoolinfos/util/BuildInformation.java index 6e3eac5..6544d9d 100644 --- a/src/fr/devinsy/statoolinfos/util/BuildInformation.java +++ b/src/fr/devinsy/statoolinfos/util/BuildInformation.java @@ -31,19 +31,20 @@ import org.slf4j.LoggerFactory; */ public class BuildInformation { + private static final Logger logger = LoggerFactory.getLogger(BuildInformation.class); + + private static String BUILD_INFORMATION_FILE = "/fr/devinsy/statoolinfos/build_information.properties"; + private static class SingletonHolder { private static final BuildInformation instance = new BuildInformation(); } - private static final Logger logger = LoggerFactory.getLogger(BuildInformation.class); - - private static String BUILD_INFORMATION_FILE = "/fr/devinsy/statoolinfos/build_information.properties"; - private String productName; private String majorRevision; private String minorRevision; private String buildNumber; + private String snapshotRevision; private String buildDate; private String generator; private String buildAuthor; @@ -70,6 +71,7 @@ public class BuildInformation this.majorRevision = build.getProperty("product.revision.major", "d"); this.minorRevision = build.getProperty("product.revision.minor", "e"); this.buildNumber = build.getProperty("product.revision.build", "v"); + this.snapshotRevision = build.getProperty("product.revision.snapshot", "").replace("SNAPSHOT_", ""); this.buildDate = build.getProperty("product.revision.date", "today"); this.generator = build.getProperty("product.revision.generator", "n/a"); this.buildAuthor = build.getProperty("product.revision.author", "n/a"); @@ -160,6 +162,16 @@ public class BuildInformation return this.productName; } + /** + * Snapshot revision. + * + * @return the string + */ + public String snapshotRevision() + { + return this.snapshotRevision; + } + /* (non-Javadoc) * @see java.lang.Object#toString() */ @@ -183,7 +195,7 @@ public class BuildInformation { String result; - result = String.format("%s.%s.%s", this.majorRevision, this.minorRevision, this.buildNumber); + result = String.format("%s.%s.%s%s", this.majorRevision, this.minorRevision, this.buildNumber, this.snapshotRevision); // return result;