JAL-3594 Different icon/getdown styling when launching jalview built with -PCHANNEL...
[jalview.git] / build.gradle
index 072a7b4..f9d2974 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")
   }
   
@@ -174,11 +174,17 @@ ext {
   buildDist = true
 
   // the following values might be overridden by the CHANNEL switch
+  channelPropertiesFile = string("${channel_properties_dir}/release_properties")
   getdownChannelName = CHANNEL.toLowerCase()
   getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
   getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
   getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
   getdownAppDistDir = getdown_app_dir_alt
+  buildProperties = string("${resourceDir}/${build_properties_file}")
+  getdownImagesDir = getdown_images_dir
+  getdownBgColour = "FFFFFF"
+  getdownFgColour = "000000"
+  getdownLightFgColour = "000066"
   reportRsyncCommand = false
   jvlChannelName = CHANNEL.toLowerCase()
   install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
@@ -187,6 +193,9 @@ ext {
   install4jInstallerName = "${jalview_name} Non-Release Installer"
   install4jExecutableName = jalview_name.replaceAll("[^\\w]+", "_").toLowerCase()
   install4jExtraScheme = "jalviewx"
+  install4jMacIconsFile = string("${install4j_utils_dir}/${install4j_mac_icons_file}")
+  install4jWindowsIconsFile = string("${install4j_utils_dir}/${install4j_windows_icons_file}")
+  install4jPngIconFile = string("${install4j_utils_dir}/${install4j_png_icon_file}")
   switch (CHANNEL) {
 
     case "BUILD":
@@ -1084,6 +1093,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 +1131,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 {
@@ -1203,7 +1213,12 @@ task copyResources(type: Copy) {
   inputs.dir(inputDir)
   outputs.dir(outputDir)
 }
-
+task copyChannelProperties(type: Copy) {
+  def propsFile = file(channelPropertiesFile)
+  rename(propsFile.getName(), "channel_properties")
+  from channelPropertiesFile
+  into resourceDir
+}
 
 task createBuildProperties(type: WriteProperties) {
   dependsOn copyResources
@@ -1223,12 +1238,32 @@ 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
 }
 
 
@@ -1274,26 +1309,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 +1323,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 +1360,8 @@ task cleanPackageDir(type: Delete) {
 
 
 jar {
-  dependsOn linkCheck
-  dependsOn buildIndices
-  dependsOn createBuildProperties
   dependsOn prepare
+  dependsOn linkCheck
 
   manifest {
     attributes "Main-Class": main_class,
@@ -1466,6 +1480,17 @@ task getdownWebsite() {
     if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) {
       props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
     }
+    if (getdownImagesDir != null && file(getdownImagesDir).exists()) {
+      props.put("getdown_txt_ui.background_image", "${getdownImagesDir}/${getdown_background_image}")
+      props.put("getdown_txt_ui.instant_background_image", "${getdownImagesDir}/${getdown_instant_background_image}")
+      props.put("getdown_txt_ui.error_background", "${getdownImagesDir}/${getdown_error_background}")
+      props.put("getdown_txt_ui.progress_image", "${getdownImagesDir}/${getdown_progress_image}")
+      props.put("getdown_txt_ui.icon", "${getdownImagesDir}/${getdown_icon}")
+      props.put("getdown_txt_ui.mac_dock_icon", "${getdownImagesDir}/${getdown_mac_dock_icon}")
+      props.put("getdown_txt_ui.background", getdownBgColour)
+      props.put("getdown_txt_ui.progress_text", getdownFgColour)
+      props.put("getdown_txt_ui.status_text", getdownLightFgColour)
+    }
 
     props.put("getdown_txt_title", jalview_name)
     props.put("getdown_txt_ui.name", install4jApplicationName)
@@ -1850,6 +1875,10 @@ task installers(type: com.install4j.gradle.Install4jTask) {
     'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
     'EXECUTABLE_NAME': install4jExecutableName,
     'EXTRA_SCHEME': install4jExtraScheme,
+    'MAC_ICONS_FILE': install4jMacIconsFile,
+    'WINDOWS_ICONS_FILE': install4jWindowsIconsFile,
+    'PNG_ICON_FILE': install4jPngIconFile,
+
   ]
 
   //println("INSTALL4J VARIABLES:")