diff init.gradle @ 160:6af68acaf9b2

modify to use bamboo env varible to override branchName
author Dave Smith <smith@nwoca.org>
date Wed, 06 Nov 2013 16:36:31 +0000
parents 0c48cfd1938b
children 8dd6adab9388
line wrap: on
line diff
--- a/init.gradle	Wed Nov 06 02:13:31 2013 +0000
+++ b/init.gradle	Wed Nov 06 16:36:31 2013 +0000
@@ -23,26 +23,24 @@
 	gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
 } catch (e) {  }
 
-if (!gradle.hasProperty('branchName') ){
-	println "init: determining branch properties"
-	gradle.ext.branchName = ""
-	gradle.ext.branchStream = ""
+gradle.ext.branchName = System.getenv('bamboo_planRepository_branch')
+gradle.ext.branchStream = ""
 
+if (!gradle.branchName ) {
 	gradle.ext.branchName = "hg branch".execute().text.trim()
 	def rawParents = 'hg parents'.execute().text
 	def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim()	
-	gradle.ext.branchName = parent ?: gradle.branchName
-		
+	gradle.ext.branchName = parent ?: gradle.branchName		
+}
 
-	if (file('.hgflow').exists()) {
-		def flows = new Properties()
-		flows.load(file('.hgflow').newReader())
-		flows.stringPropertyNames().each {
-			if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) {
-				gradle.ext.branchStream = it
-			}	
+if (file('.hgflow').exists()) {
+	def flows = new Properties()
+	flows.load(file('.hgflow').newReader())
+	flows.stringPropertyNames().each {
+		if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) {
+			gradle.ext.branchStream = it
 		}	
-	}
+	}	
 }
 
 loadEnvironments()
@@ -50,6 +48,7 @@
 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl)
 gradle.environment.put('branchName',gradle.branchName)
 gradle.environment.put('branchStream',gradle.branchStream)
+
 	
 rootProject.ext.indyCapable = {
     boolean capable = true