diff init20.gradle @ 214:0ca4f3c952b7

DEP-11: add depency-lock plugin and a resolver to supply dynamic version based on branch. Cleanup metrics includes
author smith@nwoca.org
date Mon, 27 Jun 2016 19:50:00 +0100
parents 908950abd490
children 5bebb590b30e
line wrap: on
line diff
--- a/init20.gradle	Thu Apr 28 19:27:29 2016 +0100
+++ b/init20.gradle	Mon Jun 27 19:50:00 2016 +0100
@@ -1,6 +1,17 @@
 import groovy.sql.Sql
 import groovy.transform.ToString
 
+buildscript {
+    repositories {
+		maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
+        maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' }
+    }
+	dependencies {
+		classpath 'postgresql:postgresql:9.1-901.jdbc4'
+		classpath  'com.netflix.nebula:gradle-dependency-lock-plugin:4.3.0'
+	}
+}
+
 final GradleVersion gradleCurrent = GradleVersion.current()
 final GradleVersion gradleV20 = GradleVersion.version('2.0')
 println "Gradle Version: $gradleCurrent"
@@ -62,11 +73,8 @@
 gradle.ext.branchName = gradle.branch.name
 gradle.ext.branchStream = gradle.branch.stream
 gradle.ext.branchHash = gradle.branch.hash
-println "${gradle.hgRepositoryUrl} ${gradle.branch}"
+println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.imageId} ${gradle.branch.deployName}" 
 println "$gradle.runtimeInfo"
-println gradle.branch
-println gradle.branch.imageId
-println gradle.branch.deployName
 
 loadEnvironments()
 
@@ -121,21 +129,10 @@
     apply from: "${gradle.ssdtGradlekitLocation}/artifactory20.gradle"
 }
 
-
-buildscript {
-    repositories {
-        maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' }
-    }
-	dependencies {
-		classpath 'postgresql:postgresql:9.1-901.jdbc4'
-	}
-}
-
 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle"
 
 rootProject.afterEvaluate { r ->
 
-
 	if (gradle.bambooBuild && r.hasProperty('requireJavaVersion')) {
 		gradle.runtimeInfo.requireJava( r.getProperty('requireJavaVersion') )
 	}
@@ -228,6 +225,19 @@
 
 allprojects {
 
+	apply plugin: nebula.plugin.dependencylock.DependencyLockPlugin
+	
+    configurations.all {
+        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
+            if (details.requested.group == 'org.ssdt_ohio' && !details.requested.version ) {
+				details.useVersion( "latest.${gradle.branch.defaultDependencyStatus}" )
+            }
+            if (details.requested.version == 'default') {
+				details.useVersion("latest.${gradle.branch.defaultDependencyStatus}" )
+            }
+        }
+    }
+
     task cleanLocal(description: "removes all artifacts from developer's local repository") << {
 
         def local = project.repositories.find { it.name == 'local' }
@@ -336,7 +346,6 @@
         Project root = gradle.getRootProject()
         root.allprojects {
 
-
             def thisProject = delegate
             thisProject.status = 'integration'
             if (gradle.branchStream) {
@@ -573,7 +582,6 @@
 }
 
 
-
 @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true)
 class BranchInfo {
     def name
@@ -593,6 +601,10 @@
 
 	}
 	
+	String getDefaultDependencyStatus() {
+		return stream in ['release','hotfix'] ? 'release' : 'integration'
+	}
+	
 	def getShortName() {
 		def result = name.contains('/') ? name.split('/')[1] : name 
 	}