diff init20.gradle @ 247:ecae2b9a41d3

add code to stamp build number into build-number.txt lost in bamboo 5
author smith@nwoca.org
date Fri, 14 Jul 2017 18:21:46 +0100
parents 9884456bea33
children 35c7933572f8
line wrap: on
line diff
--- a/init20.gradle	Thu Jun 15 18:14:03 2017 +0100
+++ b/init20.gradle	Fri Jul 14 18:21:46 2017 +0100
@@ -10,7 +10,7 @@
     }
     dependencies {
         classpath 'postgresql:postgresql:9.1-901.jdbc4'
-        classpath  'com.netflix.nebula:gradle-dependency-lock-plugin:4.3.2'
+        classpath  'com.netflix.nebula:gradle-dependency-lock-plugin:4.9.4'
     }
 }
 
@@ -74,11 +74,7 @@
 
 gradle.ext.runtimeInfo = new RuntimeInfo()
 
-gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch'))
-gradle.ext.branchName = gradle.branch.name
-gradle.ext.branchStream = gradle.branch.stream
-gradle.ext.branchHash = gradle.branch.hash
-println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.version}"
+setBranchInfo()
 
 loadEnvironments()
 
@@ -128,6 +124,8 @@
 println "Indy available: ${rootProject.indyCapable()} enabled: ${rootProject.useIndy()}"
 
 if (gradle.bambooBuild) {
+  
+    file('build-number.txt').text = "build.number=${gradle.branch.buildNumber ?: -1 }\n"
     gradle.ext.ssdtGradlekitLocation = gradle.ext.has('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip'
     logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild host: $hostname)"
     apply from: "${gradle.ssdtGradlekitLocation}/artifactory20.gradle"
@@ -290,10 +288,8 @@
         def matcher = (taskName =~ /^release(Major|Minor|Patch|\d{1,3}\.\d{1,3}\.\d{1,3})$/)
         if (matcher.matches()) {
 
-
             dependencyLock.globalLockFile =  'release.lock' 
 
-
             task('doReleaseBranch') {
                 ext.requested = matcher[0][1].toLowerCase()
 				doLast {
@@ -323,6 +319,9 @@
 
 					println "hg flow ${releaseStream} start v${releaseVersion} --dirty".execute().text
 					println "hg update ${releaseStream}/v${releaseVersion}".execute().text
+                    
+                    setBranchInfo()
+                    
 				}
             } 
 
@@ -674,6 +673,13 @@
 
 }
 
+void setBranchInfo() {
+    gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch'))
+    gradle.ext.branchName = gradle.branch.name
+    gradle.ext.branchStream = gradle.branch.stream
+    gradle.ext.branchHash = gradle.branch.hash
+    println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.version}"
+}
 
 @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true)
 class BranchInfo {