* hippity hoppity git no longer has properties

* for some reason it has to be there

* Build properties wont refresh?
This commit is contained in:
Telesphoreo 2018-08-08 13:05:57 -07:00 committed by Seth
parent 1588ab8baa
commit 94d91bbb31
4 changed files with 49 additions and 69 deletions

1
.gitignore vendored
View File

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

View File

@ -11,6 +11,7 @@
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.2" level="project" /> <orderEntry type="library" name="Maven: org.bstats:bstats-bukkit:1.2" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13-R0.1-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.13-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
@ -59,7 +60,6 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.15.0" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: net.coreprotect:coreprotect:2.15.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:6.2" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldguard:worldguard-legacy:6.2" level="project" />
</component> </component>
</module> </module>

97
pom.xml
View File

@ -15,7 +15,7 @@
<tfm.build.number>${maven.buildnumber}</tfm.build.number> <tfm.build.number>${maven.buildnumber}</tfm.build.number>
<tfm.build.date>${maven.build.timestamp}</tfm.build.date> <tfm.build.date>${maven.build.timestamp}</tfm.build.date>
<tfm.build.author>${buildAuthor}</tfm.build.author> <tfm.build.author>${buildAuthor}</tfm.build.author>
<tfm.build.head>${buildHead}</tfm.build.head> <tfm.build.head>${git.commit.id.abbrev}</tfm.build.head>
<jar.finalName>${project.name}</jar.finalName> <jar.finalName>${project.name}</jar.finalName>
<timestamp>${maven.build.timestamp}</timestamp> <timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>MM/dd/yyyy HH:mm</maven.build.timestamp.format> <maven.build.timestamp.format>MM/dd/yyyy HH:mm</maven.build.timestamp.format>
@ -198,6 +198,47 @@
</configuration> </configuration>
</plugin> </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>
<format>properties</format>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<includeOnlyProperties>
<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>
<!-- Antrun --> <!-- Antrun -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -205,16 +246,18 @@
<version>1.8</version> <version>1.8</version>
<executions> <executions>
<execution> <execution>
<id>default-cli</id>
<phase>initialize</phase> <phase>initialize</phase>
<configuration> <configuration>
<target> <target>
<propertyfile file="src/main/resources/build.properties" <propertyfile file="${project.basedir}/src/main/resources/build.properties"
comment="Build information. Edit this to your liking."> comment="Build information. Edit this to your liking.">
<entry key="buildAuthor" default="unknown"/> <entry key="buildAuthor" default="unknown"/>
<entry key="buildNumber" default="0"/> <entry key="buildNumber" default="0"/>
<entry key="buildCodeName" default="${tfm.build.codename}"/> <entry key="buildCodeName" default="${tfm.build.codename}"/>
<entry key="buildVersion" default="${project.version}"/> <entry key="buildVersion" default="${project.version}"/>
<entry key="buildDate" default="${timestamp}"/> <entry key="buildDate" default="${timestamp}"/>
<entry key="buildHead" default="${git.commit.id.abbrev}"/>
</propertyfile> </propertyfile>
</target> </target>
</configuration> </configuration>
@ -239,7 +282,7 @@
</goals> </goals>
<configuration> <configuration>
<files> <files>
<file>${basedir}/src/main/resources/build.properties</file> <file>${project.basedir}/src/main/resources/build.properties</file>
</files> </files>
</configuration> </configuration>
</execution> </execution>
@ -267,52 +310,6 @@
</configuration> </configuration>
</plugin> </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>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>
<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 --> <!-- Buildnumber -->
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
@ -329,7 +326,7 @@
<configuration> <configuration>
<buildNumberPropertyName>maven.buildnumber</buildNumberPropertyName> <buildNumberPropertyName>maven.buildnumber</buildNumberPropertyName>
<buildNumberPropertiesFileLocation>${basedir}/src/main/resources/build.properties <buildNumberPropertiesFileLocation>${project.basedir}/src/main/resources/build.properties
</buildNumberPropertiesFileLocation> </buildNumberPropertiesFileLocation>
<format>{0,number,#}</format> <format>{0,number,#}</format>
<items> <items>

View File

@ -310,29 +310,13 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
version = props.getProperty("buildVersion", pluginVersion); version = props.getProperty("buildVersion", pluginVersion);
number = props.getProperty("buildNumber", "1"); number = props.getProperty("buildNumber", "1");
date = props.getProperty("buildDate", "unknown"); date = props.getProperty("buildDate", "unknown");
head = props.getProperty("buildHead", "unknown");
} }
catch (Exception ex) catch (Exception ex)
{ {
FLog.severe("Could not load build properties! Did you compile with NetBeans/Maven?"); FLog.severe("Could not load build properties! Did you compile with NetBeans/Maven?");
FLog.severe(ex); FLog.severe(ex);
} }
try
{
final Properties gitprops;
try (InputStream in = plugin.getResource("git.properties"))
{
gitprops = new Properties();
gitprops.load(in);
}
head = gitprops.getProperty("git.commit.id.abbrev", "unknown");
}
catch (Exception ex)
{
FLog.severe("Could not load Git properties! Is there a valid .git directory?");
FLog.severe(ex);
}
} }
public String formattedVersion() public String formattedVersion()