JAL-3274 .build_properties now copied to j2s in jalviewjs site
authorBen Soares <b.soares@dundee.ac.uk>
Tue, 5 Nov 2019 23:50:35 +0000 (23:50 +0000)
committerBen Soares <b.soares@dundee.ac.uk>
Tue, 5 Nov 2019 23:50:35 +0000 (23:50 +0000)
build.gradle
gradle.properties

index 2682208..535f3b9 100644 (file)
@@ -78,7 +78,7 @@ ext {
   getdownDir = ""
   reportRsyncCmd = false
   buildDist = true
-  buildProperties = buildPropertiesFile
+  buildProperties = build_properties_file
   getdownLauncher = "${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}"
   switch (CHANNEL) {
 
@@ -88,7 +88,7 @@ ext {
     getdown_channel_name = "${bamboo_planKey}/${JAVA_VERSION}"
     getdown_app_base = "${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}"
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = "${jalviewDir}/${classesDir}/${buildPropertiesFile}"
+    buildProperties = "${jalviewDir}/${classesDir}/${build_properties_file}"
     break
 
     case "RELEASE":
@@ -96,7 +96,7 @@ ext {
     getdownDir = "${getdown_channel_name}/${JAVA_VERSION}"
     getdown_app_base = "${getdown_channel_base}/${getdownDir}"
     getdown_app_dir = getdown_app_dir_release
-    buildProperties = "${jalviewDir}/${classesDir}/${buildPropertiesFile}"
+    buildProperties = "${jalviewDir}/${classesDir}/${build_properties_file}"
     reportRsyncCommand = true
     break
 
@@ -110,7 +110,7 @@ ext {
       exit
     } else {
       packageDir = "${ARCHIVEDIR}/${packageDir}"
-      buildProperties = "${ARCHIVEDIR}/${classesDir}/${buildPropertiesFile}"
+      buildProperties = "${ARCHIVEDIR}/${classesDir}/${build_properties_file}"
       buildDist = false
     }
     reportRsyncCommand = true
@@ -126,7 +126,7 @@ ext {
       exit
     } else {
       packageDir = "${ARCHIVEDIR}/${packageDir}"
-      buildProperties = "${ARCHIVEDIR}/${classesDir}/${buildPropertiesFile}"
+      buildProperties = "${ARCHIVEDIR}/${classesDir}/${build_properties_file}"
       buildDist = false
     }
     reportRsyncCommand = true
@@ -138,7 +138,7 @@ ext {
     getdownDir = "${getdown_channel_name}/${JAVA_VERSION}"
     getdown_app_base = "${getdown_channel_base}/${getdownDir}"
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = "${jalviewDir}/${classesDir}/${buildPropertiesFile}"
+    buildProperties = "${jalviewDir}/${classesDir}/${build_properties_file}"
     reportRsyncCommand = true
     break
 
@@ -147,7 +147,7 @@ ext {
     getdownDir = "${getdown_channel_name}/${JAVA_VERSION}"
     getdown_app_base = "${getdown_channel_base}/${getdownDir}"
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = "${jalviewDir}/${classesDir}/${buildPropertiesFile}"
+    buildProperties = "${jalviewDir}/${classesDir}/${build_properties_file}"
     reportRsyncCommand = true
     break
 
@@ -156,14 +156,14 @@ ext {
     getdownDir = "${getdown_channel_name}/${JAVA_VERSION}"
     getdown_app_base = "${getdown_channel_base}/${getdownDir}"
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = "${jalviewDir}/${classesDir}/${buildPropertiesFile}"
+    buildProperties = "${jalviewDir}/${classesDir}/${build_properties_file}"
     reportRsyncCommand = true
     break
 
     case "LOCAL":
     getdown_app_base = file(getdownWebsiteDir).toURI().toString()
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = "${jalviewDir}/${classesDir}/${buildPropertiesFile}"
+    buildProperties = "${jalviewDir}/${classesDir}/${build_properties_file}"
     getdownLauncher = "${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}"
     break
 
@@ -575,8 +575,8 @@ task setGitVals {
 task createBuildProperties(type: WriteProperties) {
   dependsOn setGitVals
   inputs.dir("${jalviewDir}/${sourceDir}")
-  inputs.dir("${classes}")
   inputs.dir("${jalviewDir}/${resourceDir}")
+  file(buildProperties).getParentFile().mkdirs()
   outputFile (buildProperties)
   // taking time specific comment out to allow better incremental builds
   comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
@@ -873,7 +873,7 @@ task getdownWebsite() {
 
     copy {
       from buildProperties
-      rename(buildPropertiesFile, getdown_build_properties)
+      rename(build_properties_file, getdown_build_properties)
       into project.ext.getdownAppDir
     }
     getdownWebsiteResourceFilenames += "${getdown_app_dir}/${getdown_build_properties}"
@@ -1572,6 +1572,26 @@ task jalviewjsSyncSiteResources (type: Sync) {
   inputs.files inputFiles
 }
 
+task jalviewjsSyncBuildProperties (type: Sync) {
+  dependsOn jalviewjsSitePath
+  dependsOn createBuildProperties
+  def inputFiles = [file(buildProperties)]
+  def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
+
+  from inputFiles
+  into outputDir
+  def outputFiles = []
+  rename { filename ->
+    outputFiles += "${outputDir}/${filename}"
+    null
+  }
+  preserve {
+    include "**"
+  }
+  outputs.files outputFiles
+  inputs.files inputFiles
+}
+
 task jalviewjsProjectImport(type: Exec) {
   dependsOn eclipseSetup
   dependsOn jalviewjsEclipsePaths
@@ -1658,13 +1678,14 @@ DEBUG: ${eclipseDebug}
   outputs.upToDateWhen( { file("${jalviewDir}/${jalviewjsTransferSiteJSDir}${jalviewjs_server_resource}").exists() } )
 }
 
+// this Copy version of TransferSite will delete anything else in the target dir
 task jalviewjsCopyTransferSite(type: Copy) {
   dependsOn jalviewjsTranspile
   from "${jalviewDir}/${jalviewjsTransferSiteJSDir}"
   into "${jalviewDir}/${jalviewjsSiteDir}"
 }
 
-// this Sync version is used by buildship to keep the website automatically up to date when a file changes
+// this Sync version of TransferSite is used by buildship to keep the website automatically up to date when a file changes
 task jalviewjsSyncTransferSite(type: Sync) {
   from "${jalviewDir}/${jalviewjsTransferSiteJSDir}"
   include "**/*.*"
@@ -1677,10 +1698,12 @@ task jalviewjsSyncTransferSite(type: Sync) {
 jalviewjsSyncLib.mustRunAfter jalviewjsCopyTransferSite
 jalviewjsSyncResources.mustRunAfter jalviewjsCopyTransferSite
 jalviewjsSyncSiteResources.mustRunAfter jalviewjsCopyTransferSite
+jalviewjsSyncBuildProperties.mustRunAfter jalviewjsCopyTransferSite
 
 jalviewjsSyncLib.mustRunAfter jalviewjsSyncTransferSite
 jalviewjsSyncResources.mustRunAfter jalviewjsSyncTransferSite
 jalviewjsSyncSiteResources.mustRunAfter jalviewjsSyncTransferSite
+jalviewjsSyncBuildProperties.mustRunAfter jalviewjsSyncTransferSite
 
 task jalviewjsPrepareSite {
   group "JalviewJS"
@@ -1688,6 +1711,7 @@ task jalviewjsPrepareSite {
   dependsOn jalviewjsSyncLib
   dependsOn jalviewjsSyncResources
   dependsOn jalviewjsSyncSiteResources
+  dependsOn jalviewjsSyncBuildProperties
 }
 
 task jalviewjsBuildSite {
index 7569d00..fe03c9c 100644 (file)
@@ -44,7 +44,7 @@ outputJar = jalview.jar
 testOutputDir = tests
 utilsDir = utils
 
-buildPropertiesFile = .build_properties
+build_properties_file = .build_properties
 application_codebase = *.jalview.org
 mainClass = jalview.bin.Jalview
 shadowJarMainClass = jalview.bin.Launcher