JAL-3446 post-merge unit test fixes, formatting
[jalview.git] / build.gradle
index bd0ae20..39c8261 100644 (file)
@@ -148,7 +148,7 @@ ext {
   cloverBuildDir = "${buildDir}/clover"
   cloverInstrDir = file("${cloverBuildDir}/clover-instr")
   cloverClassesDir = file("${cloverBuildDir}/clover-classes")
-  cloverReportDir = file("${buildDir}/reports")
+  cloverReportDir = file("${buildDir}/reports/clover")
   cloverTestInstrDir = file("${cloverBuildDir}/clover-test-instr")
   cloverTestClassesDir = file("${cloverBuildDir}/clover-test-classes")
   //cloverTestClassesDir = cloverClassesDir
@@ -733,6 +733,7 @@ eclipseGroovyCorePreferences.mustRunAfter eclipseJdt
 task cleanClover {
   doFirst {
     delete cloverBuildDir
+    delete cloverReportDir
   }
 }
 
@@ -855,7 +856,7 @@ task cloverHtmlReport(type: JavaExec) {
     file(cloverDb).exists()
   }
 
-  def cloverHtmlDir = "${cloverReportDir}/clover"
+  def cloverHtmlDir = cloverReportDir
   inputs.dir cloverClassesDir
   outputs.dir cloverHtmlDir
 
@@ -893,7 +894,7 @@ task cloverXmlReport(type: JavaExec) {
     file(cloverDb).exists()
   }
 
-  def cloverXmlFile = "${cloverReportDir}/clover/clover.xml"
+  def cloverXmlFile = "${cloverReportDir}/clover.xml"
   inputs.dir cloverClassesDir
   outputs.file cloverXmlFile
 
@@ -991,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
+    }
 
-  gitHash = hashStdOut.toString().trim()
-  gitBranch = branchStdOut.toString().trim()
+    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 }
 }
@@ -1081,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
@@ -1308,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
   }
@@ -1782,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]
@@ -2858,7 +2867,7 @@ task jalviewjsIDE_PrepareSite {
   description "Sync libs and resources to site dir, but not closure cores"
 
   dependsOn jalviewjsIDE_SyncSiteAll
-  dependsOn cleanJalviewjsTransferSite
+  //dependsOn cleanJalviewjsTransferSite // not sure why this clean is here -- will slow down a re-run of this task
 }