comparison init.gradle @ 137:cc3cd7da35a7

add projectId to environment based on bamboo id
author smith@nwoca.org
date Fri, 13 Sep 2013 17:09:17 +0100
parents 9ce07c211984
children 23e24ef3cd6b
comparison
equal deleted inserted replaced
136:9ce07c211984 137:cc3cd7da35a7
2 gradle.ext.ssdtDevelkitLocation = gradle.ext.has('ssdtDevelkitLocation') ? gradle.ssdtDevelkitLocation : 'http://hg.ssdt-ohio.org/browse/public/develkit' 2 gradle.ext.ssdtDevelkitLocation = gradle.ext.has('ssdtDevelkitLocation') ? gradle.ssdtDevelkitLocation : 'http://hg.ssdt-ohio.org/browse/public/develkit'
3 3
4 ant.property(file: System.getProperty('user.home') + "/.ssdt/private.properties") 4 ant.property(file: System.getProperty('user.home') + "/.ssdt/private.properties")
5 gradle.ext.ivyUserDir = ant.properties['ivy.default.ivy.user.dir'] ?: System.getProperty('user.home') + "/.ivy2" 5 gradle.ext.ivyUserDir = ant.properties['ivy.default.ivy.user.dir'] ?: System.getProperty('user.home') + "/.ivy2"
6 6
7 gradle.ext.ssdtProjectId = System.getenv('bamboo_project_id') ?: 'default'
8
7 loadEnvironments() 9 loadEnvironments()
8
9 10
10 gradle.addListener(new ArtifactoryGradleSettings()) 11 gradle.addListener(new ArtifactoryGradleSettings())
11 12
12 def hostname 13 def hostname
13 try { hostname = "hostname".execute().text.toLowerCase().readLines().first() } catch (e) { hostname = 'unknown'} 14 try { hostname = "hostname".execute().text.toLowerCase().readLines().first() } catch (e) { hostname = 'unknown'}
14 15
15 gradle.ext.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} || hostname?.startsWith('ssdt-') 16 gradle.ext.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} || hostname?.startsWith('ssdt-')
16 17
17 gradle.ext.bambooPlan = (System.getenv('BAMBOO_PLAN') ?: 'UNKNOWN-UNKNOWN-JOB1').split('-')[0..1].join('-') 18 gradle.ext.bambooPlan = (System.getenv('BAMBOO_PLAN') ?: 'UNKNOWN-UNKNOWN-JOB1').split('-')[0..1].join('-')
18 logger.info "Bamboo plan: ${gradle.bambooPlan}" 19 logger.info "Bamboo plan: ${gradle.bambooPlan}"
20
19 21
20 gradle.ext.hgRepositoryUrl = "" 22 gradle.ext.hgRepositoryUrl = ""
21 try { 23 try {
22 gradle.ext.hgRepositoryUrl = "hg path".execute().text.split('=')[1].trim() 24 gradle.ext.hgRepositoryUrl = "hg path".execute().text.split('=')[1].trim()
23 } catch (e) {} 25 } catch (e) {}
65 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' } 67 maven { url 'http://repos.ssdt.nwoca.org/artifactory/libs-snapshots' }
66 } 68 }
67 } 69 }
68 70
69 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" 71 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle"
72
73 task wrapper(type: Wrapper) {}
70 74
71 rootProject.afterEvaluate { r -> 75 rootProject.afterEvaluate { r ->
72 76
73 if (r.plugins.hasPlugin(org.gradle.plugins.ide.idea.IdeaPlugin)) { 77 if (r.plugins.hasPlugin(org.gradle.plugins.ide.idea.IdeaPlugin)) {
74 78
306 def privateFile = file("private" + envName - "environment" + ".groovy") 310 def privateFile = file("private" + envName - "environment" + ".groovy")
307 logger.info("loading environment $envFile.name") 311 logger.info("loading environment $envFile.name")
308 312
309 def envCfg = slurper.parse(envFile.toURL()) 313 def envCfg = slurper.parse(envFile.toURL())
310 envCfg.merge(slurper.parse(developerPrivate)) 314 envCfg.merge(slurper.parse(developerPrivate))
315 envCfg.put('ssdt.projectid',gradle.ssdtProjectId)
311 if (privateFile.exists()) { 316 if (privateFile.exists()) {
312 logger.info("loading private environment $privateFile") 317 logger.info("loading private environment $privateFile")
313 envCfg.merge(slurper.parse(privateFile.toURL())) 318 envCfg.merge(slurper.parse(privateFile.toURL()))
314 } 319 }
315 320