2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-18 16:47:06 +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 {
`java-library`
`maven-publish`
id("net.kyori.blossom") version "1.2.0"
}
repositories {
@ -28,8 +31,21 @@ description = "RedisBungee interafaces"
blossom {
replaceToken("@version@", "$version")
// replaceToken("@git_branch@", "")
// replaceToken("@git_commit@", "")
// GIT
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 {

View File

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