Add git commit hash to dumps

This commit is contained in:
KennyTV 2020-04-16 21:39:28 +02:00
parent d9291e6457
commit 83a6346a8d
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 42 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package us.myles.ViaVersion.commands.defaultsubs;
import com.google.common.io.CharStreams;
import com.google.gson.JsonObject;
import net.md_5.bungee.api.ChatColor;
import us.myles.ViaVersion.ViaManager;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.command.ViaCommandSender;
import us.myles.ViaVersion.api.command.ViaSubCommand;
@ -43,7 +44,8 @@ public class DumpSubCmd extends ViaSubCommand {
ProtocolRegistry.getSupportedVersions(),
Via.getPlatform().getPlatformName(),
Via.getPlatform().getPlatformVersion(),
Via.getPlatform().getPluginVersion()
Via.getPlatform().getPluginVersion(),
ViaManager.class.getPackage().getImplementationVersion()
);
Map<String, Object> configuration = Via.getPlatform().getConfigurationProvider().getValues();

View File

@ -10,8 +10,10 @@ public class VersionInfo {
private final String platformName;
private final String platformVersion;
private final String pluginVersion;
private final String implementationVersion;
public VersionInfo(String javaVersion, String operatingSystem, int serverProtocol, Set<Integer> enabledProtocols, String platformName, String platformVersion, String pluginVersion) {
public VersionInfo(String javaVersion, String operatingSystem, int serverProtocol, Set<Integer> enabledProtocols,
String platformName, String platformVersion, String pluginVersion, String implementationVersion) {
this.javaVersion = javaVersion;
this.operatingSystem = operatingSystem;
this.serverProtocol = serverProtocol;
@ -19,6 +21,7 @@ public class VersionInfo {
this.platformName = platformName;
this.platformVersion = platformVersion;
this.pluginVersion = pluginVersion;
this.implementationVersion = implementationVersion;
}
public String getJavaVersion() {
@ -48,5 +51,9 @@ public class VersionInfo {
public String getPluginVersion() {
return pluginVersion;
}
public String getImplementationVersion() {
return implementationVersion;
}
}

View File

@ -34,13 +34,42 @@
</resources>
<plugins>
<!-- Libs Shading and Relocation -->
<!-- Write git commit hash into build properties -->
<plugin>
<groupId>net.md-5</groupId>
<artifactId>scriptus</artifactId>
<version>0.3.2</version>
<configuration>
<format>git-ViaVersion-${project.version}:%s</format>
</configuration>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>describe</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<!--suppress MavenModelInspection -->
<Implementation-Version>${describe}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<!--Relocate all lib we use in order to fix class loading errors if we use different versions
than already loaded libs (i.e. by Mojang -> gson)-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<version>3.2.2</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar>