Merge branch 'feature/automatic_version_generation' into 'master'

Automatic VERSION file generation

See merge request sheepitrenderfarm/client!108
This commit is contained in:
Sheepit Renderfarm
2023-01-04 16:50:21 +00:00
2 changed files with 16 additions and 0 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
build
out
exe-wrapper/sheepit-wrapper.exe
src/main/resources/VERSION

View File

@@ -13,9 +13,24 @@ compileJava {
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 {
exclude 'OSGI-OPT/' // args4j garbage
}
tasks.shadowJar.dependsOn(generateVersionFile)
repositories {
mavenCentral()