Added snapshot id in build_information file.

This commit is contained in:
Christian P. MOMON 2020-11-21 06:48:23 +01:00
parent bfc3dbb942
commit 37e69c882f
2 changed files with 18 additions and 5 deletions

View file

@ -1,3 +1,4 @@
product.name=statoolinfos
product.revision.major=0
product.revision.minor=1
product.revision.snapshot=

View file

@ -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;