X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;fp=build.gradle;h=df1f5cd00d1092ec11c9d438e6fc1e0beac96fbc;hb=9ba4d4c0690650d114a7a772b902596f05daaa46;hp=e5d958491bb6cbedeaba9026c9de31dcd40c1808;hpb=e41cdfd54ec09b75d7e26634c80215f8c7218a4f;p=jalview.git 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) }