diff 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
line wrap: on
line diff
--- a/init.gradle	Thu Jan 16 20:07:52 2014 +0000
+++ b/init.gradle	Thu Jan 16 21:05:34 2014 +0000
@@ -44,11 +44,13 @@
 }
 
 gradle.branchName = gradle.branchName.replace('@','-')
+gradle.ext.branchHash = generateMD5(gradle.branchName)
 loadEnvironments()
 
 gradle.environment.put('hgRepositoryUrl',gradle.hgRepositoryUrl)
 gradle.environment.put('branchName',gradle.branchName)
 gradle.environment.put('branchStream',gradle.branchStream)
+gradle.environment.put('branchHash',gradle.branchHash)
 
 	
 rootProject.ext.indyCapable = {
@@ -239,7 +241,7 @@
 				thisProject.status = 'integration'
 				def fixupVersion = thisProject.version - ".SNAPSHOT"
 				if ( gradle.branchStream == 'feature' ) {
-					fixupVersion = fixupVersion + "-" + gradle.buildTimestamp
+					fixupVersion = fixupVersion + ".SNAPSHOT"
 				}
 				if ( gradle.branchStream == 'develop' ) {
 					fixupVersion = fixupVersion + ".SNAPSHOT"
@@ -269,7 +271,6 @@
                     }                       
                 }                   
 				
-				
 				if(gradle.branchStream == 'feature') {
 					add(new org.apache.ivy.plugins.resolver.URLResolver()) {
 						name = 'ssdt-branches'
@@ -277,11 +278,11 @@
 						def url = "${ssdtArtifactory}/ssdt-branches"
 						def filter1 = ";ssdt-branch.branchName+=${gradle.branchName.replaceAll('/','-')}"
 						def filter2 = ";ssdt-branch.branchName=${gradle.branchName.replaceAll('/','-')}"
-						addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]${filter1}")
-						addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml")
-						checkmodified = true
-						changingMatcher = 'regexp'
-						changingPattern = /\d{14}/
+						addArtifactPattern("${url}/${gradle.branchHash}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
+						addIvyPattern("${url}/${gradle.branchHash}/[organization]/[module]/ivy-[revision].xml")
+                        checkmodified = true
+                        changingMatcher = 'regexp'
+                        changingPattern = '.*SNAPSHOT'
 					}
 				}
 
@@ -432,3 +433,9 @@
     gradle.ext.environments = environments
 
 }
+
+def generateMD5(String s) {
+    def digest = java.security.MessageDigest.getInstance("MD5")
+    digest.update(s.bytes);
+    new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
+ } 
\ No newline at end of file