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 {
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
jalviewjsJ2sPlugin = jalviewjs_j2s_plugin
jalviewjsStderrLaunchFilename = "${jalviewjsSiteDir}/"+(file(jalviewjs_stderr_launch).getName())
+ closureCompilerJar = "${jalviewDir}/${jalviewjs_closure_compiler}"
+
eclipseWorkspace = null
eclipseBinary = string("")
eclipseVersion = string("")
}
}
}
+ // 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}'")
+ }
}
}
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 ]
}
}
+ inputs.file(closureCompilerJar)
}