Merge pull request #1733 from KennyTV/abstraction

Add git commit hash to dumps
This commit is contained in:
Myles 2020-04-16 23:21:30 +01:00 committed by GitHub
commit e3821e1741
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.common.io.CharStreams;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import us.myles.ViaVersion.ViaManager;
import us.myles.ViaVersion.api.Via; import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.command.ViaCommandSender; import us.myles.ViaVersion.api.command.ViaCommandSender;
import us.myles.ViaVersion.api.command.ViaSubCommand; import us.myles.ViaVersion.api.command.ViaSubCommand;
@ -43,7 +44,8 @@ public class DumpSubCmd extends ViaSubCommand {
ProtocolRegistry.getSupportedVersions(), ProtocolRegistry.getSupportedVersions(),
Via.getPlatform().getPlatformName(), Via.getPlatform().getPlatformName(),
Via.getPlatform().getPlatformVersion(), Via.getPlatform().getPlatformVersion(),
Via.getPlatform().getPluginVersion() Via.getPlatform().getPluginVersion(),
ViaManager.class.getPackage().getImplementationVersion()
); );
Map<String, Object> configuration = Via.getPlatform().getConfigurationProvider().getValues(); Map<String, Object> configuration = Via.getPlatform().getConfigurationProvider().getValues();

View File

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

View File

@ -34,13 +34,42 @@
</resources> </resources>
<plugins> <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.parent.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> <plugin>
<!--Relocate all lib we use in order to fix class loading errors if we use different versions <!--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)--> than already loaded libs (i.e. by Mojang -> gson)-->
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version> <version>3.2.2</version>
<configuration> <configuration>
<createDependencyReducedPom>false</createDependencyReducedPom> <createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar> <minimizeJar>false</minimizeJar>