diff init.gradle @ 155:6389a03379a6

CM-135: allow environment* scripts to access gradle project
author Dave Smith <smith@nwoca.org>
date Mon, 28 Oct 2013 16:00:23 +0100
parents 6666e1cd8bae
children 465c6cf6dff3
line wrap: on
line diff
--- a/init.gradle	Fri Oct 25 21:59:01 2013 +0100
+++ b/init.gradle	Mon Oct 28 16:00:23 2013 +0100
@@ -6,8 +6,6 @@
 
 gradle.ext.ssdtProjectId = System.getenv('bamboo_project_id') ?: rootProject.name
 
-loadEnvironments()
-
 gradle.addListener(new ArtifactoryGradleSettings())
 
 def hostname 
@@ -18,7 +16,6 @@
 gradle.ext.bambooPlan = (System.getenv('BAMBOO_PLAN') ?: 'UNKNOWN-UNKNOWN-JOB1').split('-')[0..1].join('-')
 logger.info "Bamboo plan: ${gradle.bambooPlan}"
 
-
 gradle.ext.buildTimestamp = System.currentTimeMillis().toString().padLeft(14,'0')
 
 gradle.ext.hgRepositoryUrl = ""
@@ -45,6 +42,8 @@
 	}	
 }
 
+loadEnvironments()
+
 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl)
 gradle.environment.put('branchName',gradle.branchName)
 gradle.environment.put('branchStream',gradle.branchStream)
@@ -361,7 +360,9 @@
     
     println "Environment is: $gradle.env ($envOverrides)"
     def slurper = new ConfigSlurper(gradle.env)
-    def environment = new ConfigObject()
+	slurper.setBinding(['gradle': gradle ])
+	
+    def environment = new ConfigObject()	
     def environments = []
     
     file('.').eachFileMatch(~/^environment.*\.groovy$/) { envFile ->