Fixes to the build info as suggested on the issue. Resolves #2119

This commit is contained in:
Ryan 2018-05-21 19:36:31 +01:00
parent 6448bc934a
commit 75d20605e1
3 changed files with 75 additions and 5 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
# TFM excludes
/lib
build.properties
git.properties
# Netbeans excludes
/nbproject/private

66
pom.xml
View file

@ -180,10 +180,8 @@
<propertyfile file="src/main/resources/build.properties" comment="Build information. Edit this to your liking.">
<entry key="buildAuthor" default="unknown" />
<entry key="buildNumber" default="0" />
<entry key="buildDate" default="${maven.build.timestamp}" />
<entry key="buildCodeName" default="Electrum (MC 1.12) Pre-Release 1" />
<entry key="buildVersion" default="${project.version}" />
<entry key="buildHead" default="${buildHead}" />
</propertyfile>
</target>
</configuration>
@ -237,7 +235,69 @@
</configuration>
</plugin>
<!-- Git describe -->
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
</execution>
<execution>
<id>validate-the-git-infos</id>
<goals>
<goal>validateRevision</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<prefix>git</prefix>
<dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
<verbose>false</verbose>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${basedir}/src/main/resources/git.properties</generateGitPropertiesFilename>
<format>properties</format>
<failOnNoGitDirectory>true</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<excludeProperties>
<excludeProperty>git.branch</excludeProperty>
<excludeProperty>git.build.host</excludeProperty>
<excludeProperty>git.build.user.email</excludeProperty>
<excludeProperty>git.build.user.name</excludeProperty>
<excludeProperty>git.closest.tag.commit.count</excludeProperty>
<excludeProperty>git.closest.tag.name</excludeProperty>
<excludeProperty>git.commit.id.describe</excludeProperty>
<excludeProperty>git.commit.id.describe-short</excludeProperty>
<excludeProperty>git.commit.message.full</excludeProperty>
<excludeProperty>git.commit.message.short</excludeProperty>
<excludeProperty>git.commit.time</excludeProperty>
<excludeProperty>git.commit.user.email</excludeProperty>
<excludeProperty>git.dirty</excludeProperty>
<excludeProperty>git.remote.origin.url</excludeProperty>
<excludeProperty>git.tags</excludeProperty>
<includeOnlyProperty>git.build.version</includeOnlyProperty>
<includeOnlyProperty>git.commit.user.name</includeOnlyProperty>
</excludeProperties>
<includeOnlyProperties>
<includeOnlyProperty>git.build.time</includeOnlyProperty>
<includeOnlyProperty>git.commit.id</includeOnlyProperty>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
</includeOnlyProperties>
<gitDescribe>
<skip>false</skip>
<always>false</always>
<abbrev>7</abbrev>
<dirty>-dirty</dirty>
<match>*</match>
</gitDescribe>
</configuration>
</plugin>
<!-- Buildnumber -->
<plugin>

View file

@ -259,18 +259,27 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
try
{
final Properties props;
final Properties gitprops;
try (InputStream in = plugin.getResource("build.properties"))
{
props = new Properties();
props.load(in);
}
try (InputStream in = plugin.getResource("git.properties"))
{
gitprops = new Properties();
gitprops.load(in);
}
author = props.getProperty("buildAuthor", "unknown");
codename = props.getProperty("buildCodeName", "unknown");
version = props.getProperty("buildVersion", pluginVersion);
number = props.getProperty("buildNumber", "1");
date = props.getProperty("buildDate", "unknown");
head = props.getProperty("buildHead", "unknown");
date = gitprops.getProperty("git.build.time", "unknown");
head = gitprops.getProperty("git.commit.id.abbrev", "unknown");
}
catch (Exception ex)
{