JAL-3754 fixed a problem with jar task creating a stray dir when building
[jalview.git] / build.gradle
index 072a7b4..07c9476 100644 (file)
@@ -111,7 +111,7 @@ ext {
   }
   ////
   // Set JALVIEW_VERSION if it is not already set
-  if (findProperty(JALVIEW_VERSION)==null || "".equals(JALVIEW_VERSION)) {
+  if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) {
     JALVIEW_VERSION = releaseProps.get("jalview.version")
   }
   
@@ -1084,6 +1084,7 @@ def convertMdToHtml (FileTree mdFiles, File cssFile) {
 
     def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html")
     def htmlFile = file(htmlFilePath)
+    println("Creating ${htmlFilePath}")
     htmlFile.text = htmlText
   }
 }
@@ -1121,7 +1122,7 @@ task copyDocs(type: Copy) {
 
 task convertMdFiles {
   dependsOn copyDocs
-  def mdFiles = fileTree(dir: docBuildDir, include: "*.md")
+  def mdFiles = fileTree(dir: docBuildDir, include: "**/*.md")
   def cssFile = file("${jalviewDir}/${flexmark_css}")
 
   doLast {
@@ -1223,12 +1224,33 @@ task createBuildProperties(type: WriteProperties) {
 }
 
 
+task buildIndices(type: JavaExec) {
+  dependsOn copyHelp
+  classpath = sourceSets.main.compileClasspath
+  main = "com.sun.java.help.search.Indexer"
+  workingDir = "${helpBuildDir}/${help_dir}"
+  def argDir = "html"
+  args = [ argDir ]
+  inputs.dir("${workingDir}/${argDir}")
+
+  outputs.dir("${classesDir}/doc")
+  outputs.dir("${classesDir}/help")
+  outputs.file("${workingDir}/JavaHelpSearch/DOCS")
+  outputs.file("${workingDir}/JavaHelpSearch/DOCS.TAB")
+  outputs.file("${workingDir}/JavaHelpSearch/OFFSETS")
+  outputs.file("${workingDir}/JavaHelpSearch/POSITIONS")
+  outputs.file("${workingDir}/JavaHelpSearch/SCHEMA")
+  outputs.file("${workingDir}/JavaHelpSearch/TMAP")
+}
+
+
 task prepare {
   dependsOn copyResources
   dependsOn copyDocs
   dependsOn copyHelp
   dependsOn createBuildProperties
   dependsOn convertMdFiles
+  dependsOn buildIndices
 }
 
 
@@ -1262,6 +1284,11 @@ test {
     println("Setting Test LaF to '${testLaf}'")
     systemProperty "laf", testLaf
   }
+  def testHiDPIScale = project.findProperty("test_HiDPIScale")
+  if (testHiDPIScale != null) {
+    println("Setting Test HiDPI Scale to '${testHiDPIScale}'")
+    systemProperty "sun.java2d.uiScale", testHiDPIScale
+  }
   sourceCompatibility = compile_source_compatibility
   targetCompatibility = compile_target_compatibility
   jvmArgs += additional_compiler_args
@@ -1274,26 +1301,6 @@ test {
 }
 
 
-task buildIndices(type: JavaExec) {
-  dependsOn copyHelp
-  classpath = sourceSets.main.compileClasspath
-  main = "com.sun.java.help.search.Indexer"
-  workingDir = "${helpBuildDir}/${help_dir}"
-  def argDir = "html"
-  args = [ argDir ]
-  inputs.dir("${workingDir}/${argDir}")
-
-  outputs.dir("${classesDir}/doc")
-  outputs.dir("${classesDir}/help")
-  outputs.file("${workingDir}/JavaHelpSearch/DOCS")
-  outputs.file("${workingDir}/JavaHelpSearch/DOCS.TAB")
-  outputs.file("${workingDir}/JavaHelpSearch/OFFSETS")
-  outputs.file("${workingDir}/JavaHelpSearch/POSITIONS")
-  outputs.file("${workingDir}/JavaHelpSearch/SCHEMA")
-  outputs.file("${workingDir}/JavaHelpSearch/TMAP")
-}
-
-
 task compileLinkCheck(type: JavaCompile) {
   options.fork = true
   classpath = files("${jalviewDir}/${utils_dir}")
@@ -1308,7 +1315,8 @@ task compileLinkCheck(type: JavaCompile) {
 
 
 task linkCheck(type: JavaExec) {
-  dependsOn prepare, compileLinkCheck
+  dependsOn prepare
+  dependsOn compileLinkCheck
 
   def helpLinksCheckerOutFile = file("${jalviewDir}/${utils_dir}/HelpLinksChecker.out")
   classpath = files("${jalviewDir}/${utils_dir}")
@@ -1344,10 +1352,8 @@ task cleanPackageDir(type: Delete) {
 
 
 jar {
-  dependsOn linkCheck
-  dependsOn buildIndices
-  dependsOn createBuildProperties
   dependsOn prepare
+  dependsOn linkCheck
 
   manifest {
     attributes "Main-Class": main_class,
@@ -1357,7 +1363,8 @@ jar {
     "Implementation-Version": JALVIEW_VERSION
   }
 
-  destinationDirectory = file("${jalviewDir}/${package_dir}")
+  def distDir = "${jalviewDir}/${package_dir}"
+  destinationDirectory = file(distDir)
   archiveFileName = rootProject.name+".jar"
 
   exclude "cache*/**"
@@ -1370,7 +1377,7 @@ jar {
   sourceSets.main.resources.srcDirs.each{ dir ->
     inputs.dir(dir)
   }
-  outputs.file("${destinationDirectory}/${archiveFileName}")
+  outputs.file("${distDir}/${archiveFileName}")
 }