From: Ben Soares Date: Tue, 16 Apr 2024 20:10:10 +0000 (+0100) Subject: JAL-4059 JAL-4395 Updated closure-compiler. Added local_eclipse.properties for buildship X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9ba4d4c0690650d114a7a772b902596f05daaa46;p=jalview.git JAL-4059 JAL-4395 Updated closure-compiler. Added local_eclipse.properties for buildship --- diff --git a/.gitignore b/.gitignore index 59c4a99..8567ed7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ /.classpath /.settings/* !/.settings/org.eclipse.buildship.core.prefs +/local.properties +/local_eclipse.properties /dist /clover /classes diff --git a/build.gradle b/build.gradle index e5d9584..df1f5cd 100644 --- a/build.gradle +++ b/build.gradle @@ -72,39 +72,48 @@ def string(Object o) { return o == null ? "" : o.toString() } -def overrideProperties(String propsFileName, boolean output = false) { - if (propsFileName == null) { - return - } +def Properties readPropertiesFile(String propsFileName) { + def p = null def propsFile = file(propsFileName) if (propsFile != null && propsFile.exists()) { println("Using properties from file '${propsFileName}'") try { - def p = new Properties() + p = new Properties() def localPropsFIS = new FileInputStream(propsFile) p.load(localPropsFIS) localPropsFIS.close() - p.each { - key, val -> - def oldval - if (project.hasProperty(key)) { - oldval = project.findProperty(key) - project.setProperty(key, val) - if (output) { - println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'") - } - } else { - ext.setProperty(key, val) - if (output) { - println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'") - } - } - } } catch (Exception e) { - println("Exception reading local.properties") + println("Exception reading properties file '${propsFileName}'") e.printStackTrace() } } + return p +} + +def overrideProperties(String propsFileName, boolean output = false) { + if (propsFileName == null) { + return + } + def propsFile = file(propsFileName) + if (propsFile != null && propsFile.exists()) { + println("Using properties from file '${propsFileName}'") + def p = readPropertiesFile(propsFileName) + p.each { key, val -> + def oldval + if (project.hasProperty(key)) { + oldval = project.findProperty(key) + project.setProperty(key, val) + if (output) { + println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'") + } + } else { + ext.setProperty(key, val) + if (output) { + println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'") + } + } + } + } } ext { @@ -123,12 +132,14 @@ ext { channelDir = string("${jalviewDir}/${channel_properties_dir}/${channelDirName}") channelGradleProperties = string("${channelDir}/channel_gradle.properties") channelPropsFile = string("${channelDir}/${resource_dir}/${channel_props}") + localProperties = "local.properties" + localEclipseProperties = "local_eclipse.properties" overrideProperties(channelGradleProperties, false) // local build environment properties // can be "projectDir/local.properties" - overrideProperties("${projectDir}/local.properties", true) + overrideProperties("${projectDir}/${localProperties}", true) // or "../projectDir_local.properties" - overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties", true) + overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_${localProperties}", true) //// // Import releaseProps from the RELEASE file @@ -576,6 +587,8 @@ ext { jalviewjsJ2sPlugin = jalviewjs_j2s_plugin jalviewjsStderrLaunchFilename = "${jalviewjsSiteDir}/"+(file(jalviewjs_stderr_launch).getName()) + closureCompilerJar = "${jalviewDir}/${jalviewjs_closure_compiler}" + eclipseWorkspace = null eclipseBinary = string("") eclipseVersion = string("") @@ -782,6 +795,20 @@ eclipse { } } } + // local eclipse settings + def localEclipsePropertiesFile = file("${jalviewDirAbsolutePath}/${localEclipseProperties}") + if (localEclipsePropertiesFile.exists()) { + def eclipse_prefs = new Properties() + def ins2 = new FileInputStream(localEclipsePropertiesFile) + println("Loading Eclipse Preferences from '${localEclipsePropertiesFile}'") + eclipse_prefs.load(ins2) + ins2.close() + eclipse_prefs.forEach { t, v -> + props.putAt(t, v) + } + } else { + println("No local Eclipse Preferences file '${localEclipsePropertiesFile}'") + } } } @@ -3972,7 +3999,7 @@ def jalviewjsCallCore(String name, FileCollection list, String prefixFile, Strin def logErrFOS = logOutFOS javaexec { - classpath = files(["${jalviewDir}/${jalviewjs_closure_compiler}"]) + classpath = files([closureCompilerJar]) main = "com.google.javascript.jscomp.CommandLineRunner" jvmArgs = [ "-Dfile.encoding=UTF-8" ] args = [ "--compilation_level", jalviewjs_closure_compiler_optimization_level, "--warning_level", "QUIET", "--charset", "UTF-8", "--js", jsfile, "--js_output_file", zjsfile ] @@ -4092,6 +4119,7 @@ task jalviewjsBuildCore { } } + inputs.file(closureCompilerJar) } diff --git a/gradle.properties b/gradle.properties index cae63c8..7666836 100644 --- a/gradle.properties +++ b/gradle.properties @@ -259,7 +259,7 @@ j2s_coretemplate_html = utils/jalviewjs/coretemplate.html jalviewjs_j2s_transpile_stdout = j2s-transpile.out #jalviewjs_j2s_stderr = j2s-transpile.err # all going into out jalviewjs_j2s_to_console = true -jalviewjs_closure_compiler = tools/closure-compiler-v20230802.jar +jalviewjs_closure_compiler = tools/closure-compiler-v20240317.jar jalviewjs_closure_compiler_optimization_level = SIMPLE_OPTIMIZATIONS jalviewjs_j2s_closure_stdout = j2s-closure.out diff --git a/tools/closure-compiler-v20230802.jar b/tools/closure-compiler-v20240317.jar similarity index 67% rename from tools/closure-compiler-v20230802.jar rename to tools/closure-compiler-v20240317.jar index 2a0cba4..1025f31 100644 Binary files a/tools/closure-compiler-v20230802.jar and b/tools/closure-compiler-v20240317.jar differ