Mercurial > public > develkit
comparison 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 |
comparison
equal
deleted
inserted
replaced
159:0c48cfd1938b | 160:6af68acaf9b2 |
---|---|
21 gradle.ext.hgRepositoryUrl = "" | 21 gradle.ext.hgRepositoryUrl = "" |
22 try { | 22 try { |
23 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim() | 23 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim() |
24 } catch (e) { } | 24 } catch (e) { } |
25 | 25 |
26 if (!gradle.hasProperty('branchName') ){ | 26 gradle.ext.branchName = System.getenv('bamboo_planRepository_branch') |
27 println "init: determining branch properties" | 27 gradle.ext.branchStream = "" |
28 gradle.ext.branchName = "" | 28 |
29 gradle.ext.branchStream = "" | 29 if (!gradle.branchName ) { |
30 | |
31 gradle.ext.branchName = "hg branch".execute().text.trim() | 30 gradle.ext.branchName = "hg branch".execute().text.trim() |
32 def rawParents = 'hg parents'.execute().text | 31 def rawParents = 'hg parents'.execute().text |
33 def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim() | 32 def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim() |
34 gradle.ext.branchName = parent ?: gradle.branchName | 33 gradle.ext.branchName = parent ?: gradle.branchName |
35 | 34 } |
36 | 35 |
37 if (file('.hgflow').exists()) { | 36 if (file('.hgflow').exists()) { |
38 def flows = new Properties() | 37 def flows = new Properties() |
39 flows.load(file('.hgflow').newReader()) | 38 flows.load(file('.hgflow').newReader()) |
40 flows.stringPropertyNames().each { | 39 flows.stringPropertyNames().each { |
41 if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) { | 40 if (!it.startsWith("[") && gradle.branchName.startsWith(flows.getProperty(it))) { |
42 gradle.ext.branchStream = it | 41 gradle.ext.branchStream = it |
43 } | |
44 } | 42 } |
45 } | 43 } |
46 } | 44 } |
47 | 45 |
48 loadEnvironments() | 46 loadEnvironments() |
49 | 47 |
50 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl) | 48 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl) |
51 gradle.environment.put('branchName',gradle.branchName) | 49 gradle.environment.put('branchName',gradle.branchName) |
52 gradle.environment.put('branchStream',gradle.branchStream) | 50 gradle.environment.put('branchStream',gradle.branchStream) |
51 | |
53 | 52 |
54 rootProject.ext.indyCapable = { | 53 rootProject.ext.indyCapable = { |
55 boolean capable = true | 54 boolean capable = true |
56 try { | 55 try { |
57 Class.forName('java.lang.invoke.MethodHandle') | 56 Class.forName('java.lang.invoke.MethodHandle') |