From a41ec37ec3b4c09409391fb02524db1f07b82030 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 2 Jun 2020 17:30:51 +0100 Subject: [PATCH] JAL-3225 some fixes to build.gradle for working in Eclipse and not always changing doc/building.html --- build.gradle | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 51deb4c..236f9ca 100644 --- a/build.gradle +++ b/build.gradle @@ -992,22 +992,25 @@ def getDate(format) { task setGitVals { - def hashStdOut = new ByteArrayOutputStream() - exec { - commandLine "git", "rev-parse", "--short", "HEAD" - standardOutput = hashStdOut - ignoreExitValue true - } - def branchStdOut = new ByteArrayOutputStream() - exec { - commandLine "git", "rev-parse", "--abbrev-ref", "HEAD" - standardOutput = branchStdOut - ignoreExitValue true - } + 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 = hashStdOut.toString().trim() - gitBranch = branchStdOut.toString().trim() + 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 } } @@ -1082,7 +1085,7 @@ task convertBuildingMD(type: Exec) { task syncDocs(type: Sync) { - dependsOn convertBuildingMD + //dependsOn convertBuildingMD def syncDir = "${classesDir}/${doc_dir}" from fileTree("${jalviewDir}/${doc_dir}") into syncDir @@ -1309,6 +1312,7 @@ task cleanDist { shadowJar { group = "distribution" + description = "Create a single jar file with all dependency libraries merged. Can be run with java -jar" if (buildDist) { dependsOn makeDist } @@ -1783,7 +1787,11 @@ spotless { task sourceDist(type: Tar) { + group "distribution" + description "Create a source .tar.gz file for distribution" + dependsOn convertBuildingMD + def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_") def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz" // cater for buildship < 3.1 [3.0.1 is max version in eclipse 2018-09] -- 1.7.10.2