From 18f5de004a86e5b768a8b50a9a59c2705e766d15 Mon Sep 17 00:00:00 2001 From: soares Date: Wed, 25 Mar 2020 01:57:40 +0000 Subject: [PATCH] JAL-3210 Fixed Eclipse IDE usage --- build.gradle | 47 +++++++++++++++++++++++++++-------------------- gradle.properties | 3 +-- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index d72ff43..fcacba3 100644 --- a/build.gradle +++ b/build.gradle @@ -335,7 +335,7 @@ ext { eclipseJavaVersion = "55" jalviewjsJ2sPlugin = jalviewjs_j2s_plugin if (IN_ECLIPSE) { - def eclipseJavaVersion = System.property["java.class.version"] + //def eclipseJavaVersion = System.property["java.class.version"] if (Float.parseFloat(eclipseJavaVersion) >= 55 && file(jalviewjs_j2s_plugin_j11).exists()) { // 55 is Java 11 jalviewjsJ2sPlugin = jalviewjs_j2s_plugin_j11 } @@ -2340,26 +2340,21 @@ task cleanJalviewjsAll { task jalviewjsIDE_checkJ2sPlugin { group "00 JalviewJS in Eclipse" - description "Compare the swingjs/net.sf.j2s.core.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)" + description "Compare the swingjs/net.sf.j2s.core(-j11)?.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)" doFirst { def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}") def j2sPluginFile = file(j2sPlugin) - 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.") } 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}')" + def msg = "Eclipse J2S Plugin is not installed (could not find '${eclipseJ2sPlugin}')\nTry running task jalviewjsIDE_copyJ2sPlugin" System.err.println(msg) - if (! copyPlugin) { - throw new GradleException(msg) - } - doCopy = true + throw new StopExecutionException(msg) } def digest = MessageDigest.getInstance("MD5") @@ -2376,17 +2371,6 @@ task jalviewjsIDE_checkJ2sPlugin { if (! copyPlugin) { throw new StopExecutionException(msg) } - doCopy = true - } - - if (doCopy) { - def msg = "WARNING! Auto-copying this commit's j2s plugin version '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n May require an Eclipse restart" - println(msg) - copy { - from j2sPlugin - eclipseJ2sPluginFile.getParentFile().mkdirs() - into eclipseJ2sPluginFile.getParent() - } } else { def msg = "Eclipse J2S Plugin is the same as '${j2sPlugin}' (this is good)" println(msg) @@ -2394,6 +2378,29 @@ task jalviewjsIDE_checkJ2sPlugin { } } +task jalviewjsIDE_copyJ2sPlugin { + group "00 JalviewJS in Eclipse" + description "Copy the swingjs/net.sf.j2s.core(-j11)?.jar file into the Eclipse IDE's 'dropins' dir" + + doFirst { + def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}") + def j2sPluginFile = file(j2sPlugin) + def eclipseHome = System.properties["eclipse.home.location"] + if (eclipseHome == null || ! IN_ECLIPSE) { + throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. NOT copying J2S Plugin.") + } + def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}" + def eclipseJ2sPluginFile = file(eclipseJ2sPlugin) + def msg = "WARNING! Copying this commit's j2s plugin '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n May require an Eclipse restart" + println(msg) + copy { + from j2sPlugin + eclipseJ2sPluginFile.getParentFile().mkdirs() + into eclipseJ2sPluginFile.getParent() + } + } +} + task jalviewjsIDE_j2sFile { group "00 JalviewJS in Eclipse" diff --git a/gradle.properties b/gradle.properties index 5f57910..24b90c2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -148,8 +148,6 @@ eclipse_project_name = jalview eclipse_bin_dir = bin eclipse_debug = false -# for developing in Eclipse as IDE, set this to automatically copy current swingjs/net.sf.j2s.core.jar to your dropins dir -jalviewjs_eclipseIDE_auto_copy_j2s_plugin = false # Override this in a local.properties file jalviewjs_eclipse_root = ~/buildtools/eclipse/jee-2019-09 @@ -183,6 +181,7 @@ jalviewjs_core_key = core jalviewjs_ignore_transpile_errors = true j2s.compiler.status = enable +j2s.compiler.java.version = 11 #j2s.site.directory = null ## site defined from buildDir+'/jalviewjs/'+jalviewjs_site_dir #j2s.log.methods.declared = j2s_methods_declared.log #j2s.log.methods.called = j2s_methods_called.log -- 1.7.10.2