# HG changeset patch # User Dave Smith # Date 1389906334 0 # Node ID 9947c2c8ff44716a39fcaa29d37ad59cf5bd7381 # Parent 0975c343fafe06565c7447cf4e3760f1079b46f6 switch to hash for layout of feature branches diff -r 0975c343fafe -r 9947c2c8ff44 init.gradle --- 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