Include git revision and build number

This commit is contained in:
Andrew Steinborn
2018-09-03 21:02:11 -04:00
parent 01be081bda
commit 3b5d20e62d
2 changed files with 15 additions and 1 deletions

View File

@@ -27,6 +27,17 @@ allprojects {
return os.toString().trim() return os.toString().trim()
} }
} }
getCurrentShortRevision = {
new ByteArrayOutputStream().withStream { os ->
exec {
executable = "git"
args = ["rev-parse", "HEAD"]
standardOutput = os
}
return os.toString().trim().substring(0, 8)
}
}
} }
repositories { repositories {

View File

@@ -14,8 +14,11 @@ compileTestJava {
jar { jar {
manifest { manifest {
def buildNumber = System.getenv("BUILD_NUMBER") ?: "unknown"
def version = "${project.version} (git-${project.ext.getCurrentShortRevision()}, build ${buildNumber})"
attributes 'Main-Class': 'com.velocitypowered.proxy.Velocity' attributes 'Main-Class': 'com.velocitypowered.proxy.Velocity'
attributes 'Implementation-Version': project.version attributes 'Implementation-Version': version
} }
} }