JAL-3679 Added externally specified plugins dir to J2sPlugin check feature/JAL-3615gzipXfam
authorBen Soares <b.soares@dundee.ac.uk>
Fri, 4 Sep 2020 17:29:41 +0000 (18:29 +0100)
committerBen Soares <b.soares@dundee.ac.uk>
Fri, 4 Sep 2020 17:29:41 +0000 (18:29 +0100)
build.gradle

index 0f4ad16..7f19a56 100644 (file)
@@ -2836,10 +2836,25 @@ task jalviewjsIDE_checkJ2sPlugin {
     if (eclipseHome == null || ! IN_ECLIPSE) {
       throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.")
     }
-    def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}"
-    def eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
-    if (!eclipseJ2sPluginFile.exists()) {
-      def msg = "Eclipse J2S Plugin is not installed (could not find '${eclipseJ2sPlugin}')\nTry running task jalviewjsIDE_copyJ2sPlugin"
+    def eclipseJ2sPluginDirs = [ "${eclipseHome}/dropins" ]
+    def altPluginsDir = System.properties["org.eclipse.equinox.p2.reconciler.dropins.directory"]
+    if (altPluginsDir != null && file(altPluginsDir).exists()) {
+      eclipseJ2sPluginDirs += altPluginsDir
+    }
+    def foundPlugin = false
+    def j2sPluginFileName = j2sPluginFile.getName()
+    def eclipseJ2sPlugin
+    def eclipseJ2sPluginFile
+    eclipseJ2sPluginDirs.any { dir ->
+      eclipseJ2sPlugin = "${dir}/${j2sPluginFileName}"
+      eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
+      if (eclipseJ2sPluginFile.exists()) {
+        foundPlugin = true
+        return true
+      }
+    }
+    if (!foundPlugin) {
+      def msg = "Eclipse J2S Plugin is not installed (could not find '${j2sPluginFileName}' in\n"+eclipseJ2sPluginDirs.join("\n")+"\n)\nTry running task jalviewjsIDE_copyJ2sPlugin"
       System.err.println(msg)
       throw new StopExecutionException(msg)
     }
@@ -2857,7 +2872,7 @@ task jalviewjsIDE_checkJ2sPlugin {
       System.err.println(msg)
       throw new StopExecutionException(msg)
     } else {
-      def msg = "Eclipse J2S Plugin is the same as '${j2sPlugin}' (this is good)"
+      def msg = "Eclipse J2S Plugin '${eclipseJ2sPlugin}' is the same as '${j2sPlugin}' (this is good)"
       println(msg)
     }
   }