JAL-3210 Changed eclipse workspace dir to be a system temp dir [held in build/jalview...
authorsoares <bsoares@dundee.ac.uk>
Mon, 21 Oct 2019 18:51:32 +0000 (19:51 +0100)
committersoares <bsoares@dundee.ac.uk>
Mon, 21 Oct 2019 18:51:32 +0000 (19:51 +0100)
build.gradle
gradle.properties
utils/jalviewjs/eclipse/dropins/net.sf.j2s.core_3.2.4-FOR_4.13.jar [moved from utils/jalviewjs/eclipse/dropins/net.sf.j2s.core_3.2.4.jar with 100% similarity]

index 314306f..03dacfb 100644 (file)
@@ -1262,17 +1262,6 @@ task helppages  {
   outputs.dir("$helpOutputDir")
 }
 
-def eclipseWorkspace
-task jalviewjsSetEclipseWorkspace {
-  def eclipseWsDir = jalviewjs_eclipse_workspace
-  eclipseWorkspace = file(eclipseWsDir)
-  if (!eclipseWorkspace.exists()) {
-    eclipseWorkspace = file("${buildDir}/../tmp/eclipse-workspace")
-    //eclipseWorkspace.deleteOnExit()
-  }
-  println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
-}
-
 def jalviewjsBuildDir
 def jalviewjsSiteDir
 def jalviewjsTransferSiteDir
@@ -1287,6 +1276,39 @@ task jalviewjsSitePath {
   jalviewjsTransferSiteDir = jalviewjsBuildDir + "/tmp/site"
 }
 
+def eclipseWorkspace
+task jalviewjsSetEclipseWorkspace {
+  def propKey = "jalviewjs_eclipse_workspace"
+  def propsFile = "${jalviewjsBuildDir}/${jalviewjs_eclipse_workspace_location_file}"
+  def props = new Properties()
+  def eclipseWsDir
+  def propVal = null
+  if (project.hasProperty(propKey)) {
+    propVal = project.getProperty(propKey)
+    eclipseWsDir = propVal
+  }
+  if ((eclipseWsDir == null || !file(eclipseWsDir).exists()) && file(propsFile).exists()) {
+    def ins = new FileInputStream(propsFile)
+    props.load(ins)
+    ins.close()
+    eclipseWsDir = props.getProperty(propKey)
+  }
+  if (eclipseWsDir == null || !file(eclipseWsDir).exists()) {
+    def tempDir = File.createTempDir()
+    eclipseWsDir = tempDir.getAbsolutePath()
+    props.setProperty(propKey, eclipseWsDir)
+    def outs = new FileOutputStream(propsFile)
+    props.store(outs, null)
+    outs.close()
+  }
+
+  eclipseWorkspace = file(eclipseWsDir)
+    
+  println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
+
+  inputs.property(propKey, propVal)
+  outputs.file(propsFile)
+}
 
 
 task jalviewjsUnzipFiles {
index 168de04..85ee158 100644 (file)
@@ -142,7 +142,7 @@ eclipse_extra_jdt_prefs_file = .settings/org.eclipse.jdt.core.jalview.prefs
 eclipse_project_name = jalview
 eclipse_bin_dir = bin
 
-jalviewjs_eclipse_root = ~/buildtools/eclipse/eclipse-jee-2019-09
+jalviewjs_eclipse_root = ~/buildtools/eclipse/eclipse-jee-2019-09/eclipse
 
 jalviewjs_utils_dir = utils/jalviewjs
 jalviewjs_eclipse_dropins_dir = eclipse/dropins
@@ -154,7 +154,8 @@ jalviewjs_site_dir = site
 jalviewjs_j2s_subdir = swingjs/j2s
 jalviewjs_j2s_settings_file = dot_j2s
 jalviewjs_j2s_settings = .j2s
-jalviewjs_eclipse_workspace = ../tmp/eclipse-workspace
+#jalviewjs_eclipse_workspace = ../tmp/eclipse-workspace
+jalviewjs_eclipse_workspace_location_file = eclipse_workspace_location
 #jalviewjs_eclipseBuildArg = build
 jalviewjs_eclipseBuildArg = cleanBuild
 jalviewjs_server_port = 9001