JAL-3594 Default values for channel properties defined in code as fallback
[jalview.git] / build.gradle
index bdc50d0..1b55708 100644 (file)
@@ -57,12 +57,13 @@ def string(Object o) {
   return o == null ? "" : o.toString()
 }
 
-def overrideProperties(def propsFileName) {
+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}'")
     try {
       def p = new Properties()
       def localPropsFIS = new FileInputStream(propsFile)
@@ -74,12 +75,15 @@ def overrideProperties(def propsFileName) {
           if (project.hasProperty(key)) {
             oldval = project.findProperty(key)
             project.setProperty(key, val)
-            println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
+            if (output) {
+              println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
+            }
           } else {
             ext.setProperty(key, val)
-            println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'")
+            if (output) {
+              println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'")
+            }
           }
-          //true
       }
     } catch (Exception e) {
       println("Exception reading local.properties")
@@ -98,12 +102,12 @@ ext {
   // Import channel_properties
   channelDir = string("${jalviewDir}/${channel_properties_dir}/${propertiesChannelName}")
   channelGradleProperties = string("${channelDir}/channel_gradle.properties")
-  overrideProperties(channelGradleProperties)
+  overrideProperties(channelGradleProperties, false)
   // local build environment properties
   // can be "projectDir/local.properties"
-  overrideProperties("${projectDir}/local.properties")
+  overrideProperties("${projectDir}/local.properties", true)
   // or "../projectDir_local.properties"
-  overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties")
+  overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties", true)
 
   ////  
   // Import releaseProps from the RELEASE file