Add automatic VERSION file generation
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
build
|
build
|
||||||
out
|
out
|
||||||
exe-wrapper/sheepit-wrapper.exe
|
exe-wrapper/sheepit-wrapper.exe
|
||||||
|
src/main/resources/VERSION
|
||||||
|
|||||||
15
build.gradle
15
build.gradle
@@ -13,9 +13,24 @@ compileJava {
|
|||||||
options.compilerArgs << '-XDignore.symbol.file'
|
options.compilerArgs << '-XDignore.symbol.file'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task generateVersionFile {
|
||||||
|
def stdout = new ByteArrayOutputStream()
|
||||||
|
def result = exec {
|
||||||
|
ignoreExitValue true
|
||||||
|
commandLine "git", "describe", "--tags", "--always"
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
if(result.getExitValue() == 0) {
|
||||||
|
new File(projectDir, "src/main/resources/VERSION").text = stdout.toString() - "v"
|
||||||
|
} else {
|
||||||
|
logger.warn("Warning: automatic version detection failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
exclude 'OSGI-OPT/' // args4j garbage
|
exclude 'OSGI-OPT/' // args4j garbage
|
||||||
}
|
}
|
||||||
|
tasks.shadowJar.dependsOn(generateVersionFile)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
Reference in New Issue
Block a user