From 129e10c9205c95fbe3e10da9426a78013c0c9b14 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Mon, 4 May 2020 20:17:25 +0100 Subject: [PATCH] Added automatic git version infomation to startup (#327) * Added automatic git version infomation to startup * Moved to compile time replacement * Cleaned up old functions * Removed redundant variable * Added project version to version string --- connector/pom.xml | 79 +++++++++++++++++++ .../geysermc/connector/GeyserConnector.java | 4 +- 2 files changed, 80 insertions(+), 3 deletions(-) diff --git a/connector/pom.xml b/connector/pom.xml index c9740ea44..229761adf 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -164,4 +164,83 @@ compile + + + + + pl.project13.maven + git-commit-id-plugin + 4.0.0 + + + get-the-git-infos + + revision + + + + + true + ${project.build.outputDirectory}/git.properties + properties + false + false + false + true + false + + git.user.* + + flat + + true + + + + + com.google.code.maven-replacer-plugin + replacer + 1.5.3 + + + add-version + process-sources + + replace + + + + ${project.basedir}/src/main/java/org/geysermc/connector/GeyserConnector.java + + + + VERSION = ".*" + VERSION = "${project.version} (git-${git.branch}-${git.commit.id.abbrev})" + + + + + + + remove-version + process-classes + + replace + + + + ${project.basedir}/src/main/java/org/geysermc/connector/GeyserConnector.java + + + + VERSION = ".*" + VERSION = "DEV" + + + + + + + + diff --git a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java index 6c9e8c7db..729952939 100644 --- a/connector/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/connector/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -28,9 +28,7 @@ package org.geysermc.connector; import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.BedrockServer; import com.nukkitx.protocol.bedrock.v390.Bedrock_v390; - import lombok.Getter; - import org.geysermc.common.AuthType; import org.geysermc.common.PlatformType; import org.geysermc.connector.bootstrap.GeyserBootstrap; @@ -59,7 +57,7 @@ public class GeyserConnector { public static final BedrockPacketCodec BEDROCK_PACKET_CODEC = Bedrock_v390.V390_CODEC; public static final String NAME = "Geyser"; - public static final String VERSION = "1.0-SNAPSHOT"; + public static final String VERSION = "DEV"; // A fallback for running in IDEs private final Map players = new HashMap<>();