Mercurial > public > develkit
comparison 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 |
comparison
equal
deleted
inserted
replaced
246:9884456bea33 | 247:ecae2b9a41d3 |
---|---|
8 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } | 8 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' } |
9 maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } | 9 maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } |
10 } | 10 } |
11 dependencies { | 11 dependencies { |
12 classpath 'postgresql:postgresql:9.1-901.jdbc4' | 12 classpath 'postgresql:postgresql:9.1-901.jdbc4' |
13 classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:4.3.2' | 13 classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:4.9.4' |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
17 final GradleVersion gradleCurrent = GradleVersion.current() | 17 final GradleVersion gradleCurrent = GradleVersion.current() |
18 final GradleVersion gradleV20 = GradleVersion.version('2.0') | 18 final GradleVersion gradleV20 = GradleVersion.version('2.0') |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 gradle.ext.runtimeInfo = new RuntimeInfo() | 75 gradle.ext.runtimeInfo = new RuntimeInfo() |
76 | 76 |
77 gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch')) | 77 setBranchInfo() |
78 gradle.ext.branchName = gradle.branch.name | |
79 gradle.ext.branchStream = gradle.branch.stream | |
80 gradle.ext.branchHash = gradle.branch.hash | |
81 println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.version}" | |
82 | 78 |
83 loadEnvironments() | 79 loadEnvironments() |
84 | 80 |
85 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl) | 81 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl) |
86 gradle.environment.put('branchName', gradle.branch.name) | 82 gradle.environment.put('branchName', gradle.branch.name) |
126 } | 122 } |
127 | 123 |
128 println "Indy available: ${rootProject.indyCapable()} enabled: ${rootProject.useIndy()}" | 124 println "Indy available: ${rootProject.indyCapable()} enabled: ${rootProject.useIndy()}" |
129 | 125 |
130 if (gradle.bambooBuild) { | 126 if (gradle.bambooBuild) { |
127 | |
128 file('build-number.txt').text = "build.number=${gradle.branch.buildNumber ?: -1 }\n" | |
131 gradle.ext.ssdtGradlekitLocation = gradle.ext.has('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip' | 129 gradle.ext.ssdtGradlekitLocation = gradle.ext.has('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip' |
132 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild host: $hostname)" | 130 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild host: $hostname)" |
133 apply from: "${gradle.ssdtGradlekitLocation}/artifactory20.gradle" | 131 apply from: "${gradle.ssdtGradlekitLocation}/artifactory20.gradle" |
134 } | 132 } |
135 | 133 |
288 tasks.addRule("release{Major|Minor|Patch|n.n.n}: create release branch") { String taskName -> | 286 tasks.addRule("release{Major|Minor|Patch|n.n.n}: create release branch") { String taskName -> |
289 | 287 |
290 def matcher = (taskName =~ /^release(Major|Minor|Patch|\d{1,3}\.\d{1,3}\.\d{1,3})$/) | 288 def matcher = (taskName =~ /^release(Major|Minor|Patch|\d{1,3}\.\d{1,3}\.\d{1,3})$/) |
291 if (matcher.matches()) { | 289 if (matcher.matches()) { |
292 | 290 |
293 | |
294 dependencyLock.globalLockFile = 'release.lock' | 291 dependencyLock.globalLockFile = 'release.lock' |
295 | |
296 | 292 |
297 task('doReleaseBranch') { | 293 task('doReleaseBranch') { |
298 ext.requested = matcher[0][1].toLowerCase() | 294 ext.requested = matcher[0][1].toLowerCase() |
299 doLast { | 295 doLast { |
300 def releaseVersion = determineReleaseVersion(requested) | 296 def releaseVersion = determineReleaseVersion(requested) |
321 throw new BuildCancelledException("release branching canceled by user request") | 317 throw new BuildCancelledException("release branching canceled by user request") |
322 } | 318 } |
323 | 319 |
324 println "hg flow ${releaseStream} start v${releaseVersion} --dirty".execute().text | 320 println "hg flow ${releaseStream} start v${releaseVersion} --dirty".execute().text |
325 println "hg update ${releaseStream}/v${releaseVersion}".execute().text | 321 println "hg update ${releaseStream}/v${releaseVersion}".execute().text |
322 | |
323 setBranchInfo() | |
324 | |
326 } | 325 } |
327 } | 326 } |
328 | 327 |
329 task('doCommitLock') { | 328 task('doCommitLock') { |
330 doLast { | 329 doLast { |
672 "${major}.${minor}.${patch}${snapshot ? '.SNAPSHOT' : ''}" | 671 "${major}.${minor}.${patch}${snapshot ? '.SNAPSHOT' : ''}" |
673 } | 672 } |
674 | 673 |
675 } | 674 } |
676 | 675 |
676 void setBranchInfo() { | |
677 gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch')) | |
678 gradle.ext.branchName = gradle.branch.name | |
679 gradle.ext.branchStream = gradle.branch.stream | |
680 gradle.ext.branchHash = gradle.branch.hash | |
681 println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.version}" | |
682 } | |
677 | 683 |
678 @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true) | 684 @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true) |
679 class BranchInfo { | 685 class BranchInfo { |
680 def name | 686 def name |
681 def stream = "none" | 687 def stream = "none" |