comparison init.gradle @ 141:d3c09b4e3332

modify for hgflow. for feature branches, use timestamp for snapshots and resolve branch from ssdt-branches
author Dave Smith <smith@nwoca.org>
date Fri, 25 Oct 2013 17:31:10 +0100
parents 615ef3a8f0b8
children 1963264c39c4
comparison
equal deleted inserted replaced
140:615ef3a8f0b8 141:d3c09b4e3332
17 17
18 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('-')
19 logger.info "Bamboo plan: ${gradle.bambooPlan}" 19 logger.info "Bamboo plan: ${gradle.bambooPlan}"
20 20
21 21
22 gradle.ext.buildTimestamp = System.currentTimeMillis().toString().padLeft(14,'0')
23
22 gradle.ext.hgRepositoryUrl = "" 24 gradle.ext.hgRepositoryUrl = ""
25 gradle.ext.branchName = ""
26 gradle.ext.branchStream = ""
23 try { 27 try {
24 gradle.ext.hgRepositoryUrl = "hg path".execute().text.split('=')[1].trim() 28 gradle.ext.branchName = "hg branch".execute().text.trim()
25 } catch (e) {} 29 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['',''] )[1].trim()
26 30 } catch (e) { }
31
32
33 if (file('.hgflow').exists()) {
34 def flows = new Properties()
35 flows.load(file('.hgflow').newReader())
36 flows.stringPropertyNames().each {
37 if (!it.startsWith("[") && gradle.ext.branchName.startsWith(flows.getProperty(it))) {
38 gradle.ext.branchStream = it
39 }
40
41 }
42 }
43 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl)
44 gradle.environment.put('branchName',gradle.branchName)
45 gradle.environment.put('branchStream',gradle.branchStream)
46
27 rootProject.ext.indyCapable = { 47 rootProject.ext.indyCapable = {
28 boolean capable = true 48 boolean capable = true
29 try { 49 try {
30 Class.forName('java.lang.invoke.MethodHandle') 50 Class.forName('java.lang.invoke.MethodHandle')
31 } catch (e) { 51 } catch (e) {
184 204
185 def void projectsEvaluated(Gradle gradle) { 205 def void projectsEvaluated(Gradle gradle) {
186 def ssdtArtifactory = 'http://repos.ssdt.nwoca.org/artifactory' 206 def ssdtArtifactory = 'http://repos.ssdt.nwoca.org/artifactory'
187 Project root = gradle.getRootProject() 207 Project root = gradle.getRootProject()
188 root.allprojects { 208 root.allprojects {
209
210
189 211
190 def thisProject = delegate 212 def thisProject = delegate
213 thisProject.status = 'integration'
214 if (gradle.branchStream) {
215 thisProject.status = 'integration'
216 def fixupVersion = thisProject.version - ".SNAPSHOT"
217 if ( gradle.branchStream == 'feature' ) {
218 fixupVersion = fixupVersion + "-" + gradle.buildTimestamp
219 }
220 if ( gradle.branchStream == 'develop' ) {
221 fixupVersion = fixupVersion + ".SNAPSHOT"
222 }
223 if ( gradle.branchStream in ['production','release'] ) {
224 thisProject.status = 'release'
225 }
226 thisProject.version = fixupVersion
227 }
228
191 configurations.all { 229 configurations.all {
192 resolutionStrategy.cacheChangingModulesFor 60 * 60 * 8, 'seconds' 230 resolutionStrategy.cacheChangingModulesFor 60 * 60 * 8, 'seconds'
193 resolutionStrategy.cacheDynamicVersionsFor 60 * 60 * 8, 'seconds' 231 resolutionStrategy.cacheDynamicVersionsFor 60 * 60 * 8, 'seconds'
194 } 232 }
195 repositories { 233 repositories {
234
196 if (!gradle.bambooBuild) { 235 if (!gradle.bambooBuild) {
197 add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { 236 add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
198 name = 'local' 237 name = 'local'
199 addIvyPattern gradle.ivyUserDir + "/local/[module]-ivy-[revision].xml" 238 addIvyPattern gradle.ivyUserDir + "/local/[module]-ivy-[revision].xml"
200 addArtifactPattern gradle.ivyUserDir + '/local/[module]-[artifact]-[revision](-[classifier]).[ext]' 239 addArtifactPattern gradle.ivyUserDir + '/local/[module]-[artifact]-[revision](-[classifier]).[ext]'
203 changingMatcher = 'regexp' 242 changingMatcher = 'regexp'
204 changingPattern = '.*SNAPSHOT' 243 changingPattern = '.*SNAPSHOT'
205 force = true 244 force = true
206 } 245 }
207 } 246 }
247
248
249 if(gradle.branchStream == 'feature') {
250 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
251 name = 'ssdt-branches'
252 m2compatible = false
253 def url = "${ssdtArtifactory}/ssdt-branches"
254 def filter = ";ssdt-branch.branchName+=${gradle.branchName}"
255 addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]${filter}")
256 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml;${filter}")
257 checkmodified = true
258 changingMatcher = 'regexp'
259 changingPattern = /\d{14}/
260 }
261 }
208 262
209 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 263 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
210 name = 'ssdt-snapshots' 264 name = 'ssdt-snapshots'
211 m2compatible = true 265 m2compatible = true
212 def url = "${ssdtArtifactory}/ssdt-snapshots" 266 def url = "${ssdtArtifactory}/ssdt-snapshots"
214 addArtifactPattern("${url}/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]") 268 addArtifactPattern("${url}/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]")
215 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml") 269 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml")
216 checkmodified = true 270 checkmodified = true
217 changingMatcher = 'regexp' 271 changingMatcher = 'regexp'
218 changingPattern = '.*SNAPSHOT' 272 changingPattern = '.*SNAPSHOT'
219 } 273 }
220 274
221 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 275 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
222 name = 'ssdt-releases' 276 name = 'ssdt-releases'
223 m2compatible = false 277 m2compatible = false
224 def url = "${ssdtArtifactory}/ssdt-releases" 278 def url = "${ssdtArtifactory}/ssdt-releases"