comparison init.gradle @ 166:9947c2c8ff44

switch to hash for layout of feature branches
author Dave Smith <smith@nwoca.org>
date Thu, 16 Jan 2014 21:05:34 +0000
parents 0975c343fafe
children 7f023317034b
comparison
equal deleted inserted replaced
165:0975c343fafe 166:9947c2c8ff44
42 } 42 }
43 } 43 }
44 } 44 }
45 45
46 gradle.branchName = gradle.branchName.replace('@','-') 46 gradle.branchName = gradle.branchName.replace('@','-')
47 gradle.ext.branchHash = generateMD5(gradle.branchName)
47 loadEnvironments() 48 loadEnvironments()
48 49
49 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl) 50 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl)
50 gradle.environment.put('branchName',gradle.branchName) 51 gradle.environment.put('branchName',gradle.branchName)
51 gradle.environment.put('branchStream',gradle.branchStream) 52 gradle.environment.put('branchStream',gradle.branchStream)
53 gradle.environment.put('branchHash',gradle.branchHash)
52 54
53 55
54 rootProject.ext.indyCapable = { 56 rootProject.ext.indyCapable = {
55 boolean capable = true 57 boolean capable = true
56 try { 58 try {
237 thisProject.status = 'integration' 239 thisProject.status = 'integration'
238 if (gradle.branchStream) { 240 if (gradle.branchStream) {
239 thisProject.status = 'integration' 241 thisProject.status = 'integration'
240 def fixupVersion = thisProject.version - ".SNAPSHOT" 242 def fixupVersion = thisProject.version - ".SNAPSHOT"
241 if ( gradle.branchStream == 'feature' ) { 243 if ( gradle.branchStream == 'feature' ) {
242 fixupVersion = fixupVersion + "-" + gradle.buildTimestamp 244 fixupVersion = fixupVersion + ".SNAPSHOT"
243 } 245 }
244 if ( gradle.branchStream == 'develop' ) { 246 if ( gradle.branchStream == 'develop' ) {
245 fixupVersion = fixupVersion + ".SNAPSHOT" 247 fixupVersion = fixupVersion + ".SNAPSHOT"
246 } 248 }
247 if ( gradle.branchStream in ['production','release'] ) { 249 if ( gradle.branchStream in ['production','release'] ) {
267 changingPattern = '.*SNAPSHOT' 269 changingPattern = '.*SNAPSHOT'
268 force = true 270 force = true
269 } 271 }
270 } 272 }
271 273
272
273 if(gradle.branchStream == 'feature') { 274 if(gradle.branchStream == 'feature') {
274 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 275 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
275 name = 'ssdt-branches' 276 name = 'ssdt-branches'
276 m2compatible = false 277 m2compatible = false
277 def url = "${ssdtArtifactory}/ssdt-branches" 278 def url = "${ssdtArtifactory}/ssdt-branches"
278 def filter1 = ";ssdt-branch.branchName+=${gradle.branchName.replaceAll('/','-')}" 279 def filter1 = ";ssdt-branch.branchName+=${gradle.branchName.replaceAll('/','-')}"
279 def filter2 = ";ssdt-branch.branchName=${gradle.branchName.replaceAll('/','-')}" 280 def filter2 = ";ssdt-branch.branchName=${gradle.branchName.replaceAll('/','-')}"
280 addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]${filter1}") 281 addArtifactPattern("${url}/${gradle.branchHash}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
281 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml") 282 addIvyPattern("${url}/${gradle.branchHash}/[organization]/[module]/ivy-[revision].xml")
282 checkmodified = true 283 checkmodified = true
283 changingMatcher = 'regexp' 284 changingMatcher = 'regexp'
284 changingPattern = /\d{14}/ 285 changingPattern = '.*SNAPSHOT'
285 } 286 }
286 } 287 }
287 288
288 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 289 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
289 name = 'ssdt-snapshots' 290 name = 'ssdt-snapshots'
430 environments.each { gradle.ext[it].put('ssdt.deployment.mode',deployMode) } 431 environments.each { gradle.ext[it].put('ssdt.deployment.mode',deployMode) }
431 environments << 'environment' 432 environments << 'environment'
432 gradle.ext.environments = environments 433 gradle.ext.environments = environments
433 434
434 } 435 }
436
437 def generateMD5(String s) {
438 def digest = java.security.MessageDigest.getInstance("MD5")
439 digest.update(s.bytes);
440 new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
441 }