JAL-3210 removed 'all' core due to problems
[jalview.git] / build.gradle
index 0117ffc..fc13bff 100644 (file)
@@ -83,6 +83,12 @@ ext {
   } else {
     println("HEADLESS BUILD")
   }
+  
+  J2S_ENABLED = (project.hasProperty('j2s.compiler.status') && project['j2s.compiler.status'] != null && project['j2s.compiler.status'] == "enable")
+  if (J2S_ENABLED) {
+    println("J2S ENABLED")
+  }
+  
   /* *-/
   System.properties.sort { it.key }.each {
     key, val -> println("SYSTEM PROPERTY ${key}='${val}'")
@@ -117,7 +123,7 @@ ext {
   getdownDir = string("")
   reportRsyncCmd = false
   buildDist = true
-  buildProperties = build_properties_file
+  buildProperties = string("${resourceDir}/${build_properties_file}")
   getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
   switch (CHANNEL) {
 
@@ -127,7 +133,7 @@ ext {
     getdown_channel_name = string("${bamboo_planKey}/${JAVA_VERSION}")
     getdown_app_base = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = string("${classesDir}/${build_properties_file}")
+    buildProperties = string("${resourceDir}/${build_properties_file}")
     break
 
     case "RELEASE":
@@ -135,7 +141,7 @@ ext {
     getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
     getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
     getdown_app_dir = getdown_app_dir_release
-    buildProperties = string("${classesDir}/${build_properties_file}")
+    buildProperties = string("${resourceDir}/${build_properties_file}")
     reportRsyncCommand = true
     break
 
@@ -149,7 +155,7 @@ ext {
       exit
     } else {
       packageDir = string("${ARCHIVEDIR}/${packageDir}")
-      buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
+      buildProperties = string("${ARCHIVEDIR}/${resource_dir}/${build_properties_file}")
       buildDist = false
     }
     reportRsyncCommand = true
@@ -165,7 +171,7 @@ ext {
       exit
     } else {
       packageDir = string("${ARCHIVEDIR}/${packageDir}")
-      buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
+      buildProperties = string("${ARCHIVEDIR}/${resource_dir}/${build_properties_file}")
       buildDist = false
     }
     reportRsyncCommand = true
@@ -177,7 +183,7 @@ ext {
     getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
     getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = string("${classesDir}/${build_properties_file}")
+    buildProperties = string("${resourceDir}/${build_properties_file}")
     reportRsyncCommand = true
     break
 
@@ -186,7 +192,7 @@ ext {
     getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
     getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = string("${classesDir}/${build_properties_file}")
+    buildProperties = string("${resourceDir}/${build_properties_file}")
     reportRsyncCommand = true
     break
 
@@ -195,14 +201,14 @@ ext {
     getdownDir = string("${getdown_channel_name}/${JAVA_VERSION}")
     getdown_app_base = string("${getdown_channel_base}/${getdownDir}")
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = string("${classesDir}/${build_properties_file}")
+    buildProperties = string("${resourceDir}/${build_properties_file}")
     reportRsyncCommand = true
     break
 
     case "LOCAL":
     getdown_app_base = file(getdownWebsiteDir).toURI().toString()
     getdown_app_dir = getdown_app_dir_alt
-    buildProperties = string("${classesDir}/${build_properties_file}")
+    buildProperties = string("${resourceDir}/${build_properties_file}")
     getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
     break
 
@@ -445,7 +451,7 @@ eclipse {
         }
         cp.entries.removeAll(removeTheseToo)
 
-        //cp.entries += new Output("${eclipse_bin_dir}/main")
+        cp.entries += new Output("${eclipse_bin_dir}/main")
         if (file(helpSourceDir).isDirectory()) {
           cp.entries += new Library(fileReference(helpSourceDir))
         }
@@ -531,7 +537,7 @@ eclipse {
   if (IN_ECLIPSE) {
     // Don't want these to be activated if in headless build
     synchronizationTasks "eclipseSynchronizationTask"
-    autoBuildTasks "eclipseAutoBuildTask"
+    //autoBuildTasks "eclipseAutoBuildTask"
 
   }
 }
@@ -664,6 +670,8 @@ task setGitVals {
 
 
 task createBuildProperties(type: WriteProperties) {
+  group = "build"
+  description = "Create the ${buildProperties} file"
   dependsOn setGitVals
   inputs.dir(sourceDir)
   inputs.dir(resourceDir)
@@ -679,6 +687,13 @@ task createBuildProperties(type: WriteProperties) {
 }
 
 
+clean {
+  doFirst {
+    delete buildProperties
+  }
+}
+
+
 task cleanBuildingHTML(type: Delete) {
   doFirst {
     delete buildingHTML
@@ -774,6 +789,7 @@ task syncLib(type: Sync) {
 
 
 task syncResources(type: Sync) {
+  dependsOn createBuildProperties
   from resourceDir
   include "**/*.*"
   into "${classesDir}"
@@ -885,6 +901,7 @@ task cleanPackageDir(type: Delete) {
   }
 }
 
+
 jar {
   dependsOn linkCheck
   dependsOn buildIndices
@@ -1955,7 +1972,7 @@ task jalviewjsBuildAllCores {
 
     def file = hash['file']
     if (! file.exists()) {
-      println("...classlist file '"+file.getPath()+"' does not exist, skipping")
+      //println("...classlist file '"+file.getPath()+"' does not exist, skipping")
       return false // this is a "continue" in groovy .each closure
     }
     def name = hash['name']
@@ -2028,7 +2045,8 @@ task jalviewjsBuildAllCores {
     'list': allJsFiles,
     'name': allClasslistName
   ]
-  jalviewjsCoreClasslists += allClasslist
+  // not including this version of "all" core at the moment
+  //jalviewjsCoreClasslists += allClasslist
   inputs.files(allClasslist['list'])
   outputs.file(allClasslist['jsfile'])
   outputs.file(allClasslist['zjsfile'])
@@ -2165,12 +2183,19 @@ task jalviewjsBuildSite {
 }
 
 
-task cleanJalviewjsSite {
+task cleanJalviewjsTransferSite {
   doFirst {
     delete "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
     delete "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
     delete "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
     delete "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
+  }
+}
+
+
+task cleanJalviewjsSite {
+  dependsOn cleanJalviewjsTransferSite
+  doFirst {
     delete "${jalviewDir}/${jalviewjsSiteDir}"
   }
 }
@@ -2270,8 +2295,8 @@ task jalviewjsIDE_checkJ2sPlugin {
   doFirst {
     def j2sPlugin = string("${jalviewDir}/${jalviewjs_j2s_plugin}")
     def j2sPluginFile = file(j2sPlugin)
-    def eclipseHome = System.properties["eclipse.home.location"]
     def copyPlugin = jalviewjs_eclipseIDE_auto_copy_j2s_plugin == "true"
+    def eclipseHome = System.properties["eclipse.home.location"]
     def doCopy = false
     if (eclipseHome == null || ! IN_ECLIPSE) {
       throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.")
@@ -2334,9 +2359,7 @@ task jalviewjsIDE_SyncCore {
 }
 
 
-task jalviewjsIDE_PrepareSite {
-  group "00 JalviewJS in Eclipse"
-  description "Sync libs and resources to site dir, but not closure cores"
+task jalviewjsIDE_SyncSiteAll {
   dependsOn jalviewjsSyncAllLibs
   dependsOn jalviewjsSyncResources
   dependsOn jalviewjsSyncSiteResources
@@ -2344,6 +2367,18 @@ task jalviewjsIDE_PrepareSite {
 }
 
 
+cleanJalviewjsTransferSite.mustRunAfter jalviewjsIDE_SyncSiteAll
+
+
+task jalviewjsIDE_PrepareSite {
+  group "00 JalviewJS in Eclipse"
+  description "Sync libs and resources to site dir, but not closure cores"
+
+  dependsOn jalviewjsIDE_SyncSiteAll
+  dependsOn cleanJalviewjsTransferSite
+}
+
+
 task jalviewjsIDE_AssembleSite {
   group "00 JalviewJS in Eclipse"
   description "Assembles unzipped supporting zipfiles, resources, site resources and closure cores into the Eclipse transpiled site"
@@ -2368,15 +2403,19 @@ task jalviewjsIDE_Server {
 // buildship runs this at import or gradle refresh
 task eclipseSynchronizationTask {
   //dependsOn eclipseSetup
-  dependsOn jalviewjsIDE_j2sFile
-  dependsOn jalviewjsIDE_checkJ2sPlugin
+  dependsOn createBuildProperties
+  if (J2S_ENABLED) {
+    dependsOn jalviewjsIDE_j2sFile
+    dependsOn jalviewjsIDE_checkJ2sPlugin
+    dependsOn jalviewjsIDE_PrepareSite
+  }
 }
 
 
 // buildship runs this at build time or project refresh
 task eclipseAutoBuildTask {
   //dependsOn jalviewjsIDE_checkJ2sPlugin
-  dependsOn jalviewjsIDE_PrepareSite
+  //dependsOn jalviewjsIDE_PrepareSite
 }