Add git version
This commit is contained in:
+13
-1
@@ -1,3 +1,5 @@
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
plugins {
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow")
|
||||
@@ -12,7 +14,7 @@ dependencies {
|
||||
tasks {
|
||||
|
||||
shadowJar {
|
||||
archiveFileName.set("${rootProject.name}-${project.version}.jar")
|
||||
archiveFileName.set("${rootProject.name}.jar")
|
||||
}
|
||||
|
||||
build {
|
||||
@@ -20,3 +22,13 @@ tasks {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun gitCommit(): String {
|
||||
val os = ByteArrayOutputStream()
|
||||
project.exec {
|
||||
isIgnoreExitValue = true
|
||||
commandLine = "git rev-parse --short HEAD".split(" ")
|
||||
standardOutput = os
|
||||
}
|
||||
return String(os.toByteArray()).trim()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user