id 'com.github.johnrengelman.shadow' version '4.0.3'
id 'com.install4j.gradle' version '8.0.4'
id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
+ id 'com.palantir.git-version' version '0.12.3'
}
repositories {
modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"])
modules_runtimeClasspath = modules_compileClasspath
*/
- gitHash = string("")
- gitBranch = string("")
+ def details = versionDetails()
+ gitHash = details.gitHash
+ gitBranch = details.branchName
println("Using a ${CHANNEL} profile.")
}
-task setGitVals {
-
- doFirst {
- def hashStdOut = new ByteArrayOutputStream()
- def resultHash = exec {
- commandLine "git", "rev-parse", "--short", "HEAD"
- standardOutput = hashStdOut
- ignoreExitValue true
- }
-
- def branchStdOut = new ByteArrayOutputStream()
- def resultBranch = exec {
- commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
- standardOutput = branchStdOut
- ignoreExitValue true
- }
-
- gitHash = resultHash.getExitValue() == 0 ? hashStdOut.toString().trim() : "NO_GIT_COMMITID_FOUND"
- gitBranch = resultBranch.getExitValue() == 0 ? branchStdOut.toString().trim() : "NO_GIT_BRANCH_FOUND"
- }
-
- outputs.upToDateWhen { false }
-}
-
-
task createBuildProperties(type: WriteProperties) {
group = "build"
description = "Create the ${buildProperties} file"
- dependsOn setGitVals
inputs.dir(sourceDir)
inputs.dir(resourceDir)
file(buildProperties).getParentFile().mkdirs()
task installers(type: com.install4j.gradle.Install4jTask) {
group = "distribution"
description = "Create the install4j installers"
- dependsOn setGitVals
dependsOn getdown
dependsOn copyInstall4jTemplate