From: Ben Soares Date: Thu, 26 Mar 2020 20:22:52 +0000 (+0000) Subject: JAL-3225 Also look for local.properties in file named ../${projectDir}_local.properti... X-Git-Tag: Develop-2_11_2_0-d20201215~63 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2d80aab16802811c0af5c1c56f9fba641c9ae50d;p=jalview.git JAL-3225 Also look for local.properties in file named ../${projectDir}_local.properties. This allows multiple instances of the same project in Eclipse by changing the eclipse_project_name propert (and other local properties) --- diff --git a/build.gradle b/build.gradle index 2b9cf4e..5d2aba7 100644 --- a/build.gradle +++ b/build.gradle @@ -46,11 +46,21 @@ ext { jalviewDirRelativePath = jalviewDir // local build environment properties - def localProps = "${jalviewDirAbsolutePath}/local.properties" + // can be "projectDir/local.properties" + def localProps = "${projectDir}/local.properties" + def propsFile = null; if (file(localProps).exists()) { + propsFile = localProps + } + // or "../projectDir_local.properties" + def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties" + if (file(dirLocalProps).exists()) { + propsFile = dirLocalProps + } + if (propsFile != null) { try { def p = new Properties() - def localPropsFIS = new FileInputStream(localProps) + def localPropsFIS = new FileInputStream(propsFile) p.load(localPropsFIS) localPropsFIS.close() p.each { @@ -58,9 +68,9 @@ ext { def oldval = findProperty(key) setProperty(key, val) if (oldval != null) { - println("Overriding property '${key}' ('${oldval}') with local.properties value '${val}'") + println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'") } else { - println("Setting unknown property '${key}' with local.properties value '${val}'") + println("Setting unknown property '${key}' with ${file(propsFile).getName()}s value '${val}'") } } } catch (Exception e) {