2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

include branch / commit hash in the constants

This commit is contained in:
mohammed jasem alaajel 2023-03-23 14:55:08 +04:00
parent a8bd655ef5
commit 693b7e6d71
No known key found for this signature in database
2 changed files with 20 additions and 8 deletions

View File

@ -1,7 +1,10 @@
import java.io.ByteArrayOutputStream
plugins { plugins {
`java-library` `java-library`
`maven-publish` `maven-publish`
id("net.kyori.blossom") version "1.2.0" id("net.kyori.blossom") version "1.2.0"
} }
repositories { repositories {
@ -28,8 +31,21 @@ description = "RedisBungee interafaces"
blossom { blossom {
replaceToken("@version@", "$version") replaceToken("@version@", "$version")
// replaceToken("@git_branch@", "") // GIT
// replaceToken("@git_commit@", "") val branchStdout = ByteArrayOutputStream()
rootProject.exec {
standardOutput = branchStdout
commandLine("git", "branch", "--show-current")
}
val commitStdout = ByteArrayOutputStream()
rootProject.exec {
standardOutput = commitStdout
commandLine("git", "rev-parse", "HEAD")
}
replaceToken("@git_branch@", "$branchStdout".replace("\n", ""))
replaceToken("@git_commit@", "$commitStdout".replace("\n", ""))
branchStdout.close()
commitStdout.close()
} }
java { java {

View File

@ -3,11 +3,7 @@ package com.imaginarycode.minecraft.redisbungee;
public class Constants { public class Constants {
public final static String VERSION = "@version@"; public final static String VERSION = "@version@";
public final static String GIT_BRANCH = "@git_branch@";
// public final static String GIT_BRANCH = "@git_branch@"; public final static String GIT_COMMIT = "@git_commit@";
// public final static String GIT_COMMIT = "@git_commit@";
} }