comparison init20.gradle @ 241:1c91b76fd9a3

USASR-2436: Remove usages of leftShift in favor of doLast
author Christopher Springer <springer@nwoca.org>
date Wed, 21 Dec 2016 13:22:44 +0000
parents 05a1bbd319bc
children df4f5bad8782
comparison
equal deleted inserted replaced
240:05a1bbd319bc 241:1c91b76fd9a3
177 } 177 }
178 } 178 }
179 } 179 }
180 } 180 }
181 181
182 task cleanLocal(description: "removes all artifacts from developer's local repository") << { 182 task cleanLocal(description: "removes all artifacts from developer's local repository") {
183 183
184 def local = project.repositories.find { it.name == 'local' } 184 doLast {
185 if (local) { 185 def local = project.repositories.find { it.name == 'local' }
186 logger.info "removing local repo: $it" 186 if (local) {
187 new File(System.properties['user.home'] + "/.ssdt/local-repo").deleteDir() 187 logger.info "removing local repo: $it"
188 def localDir = new File(gradle.ivyUserDir + "/local") 188 new File(System.properties['user.home'] + "/.ssdt/local-repo").deleteDir()
189 localDir.deleteDir() 189 def localDir = new File(gradle.ivyUserDir + "/local")
190 logger.info "verifying removal of local repo" 190 localDir.deleteDir()
191 if (localDir.exists()) { 191 logger.info "verifying removal of local repo"
192 throw new org.gradle.api.GradleException("Unable to clean ${localDir}. Files may be locked by another process.") 192 if (localDir.exists()) {
193 } 193 throw new org.gradle.api.GradleException("Unable to clean ${localDir}. Files may be locked by another process.")
194 } 194 }
195 }
196 }
195 } 197 }
196 198
197 cleanLocal.onlyIf { 199 cleanLocal.onlyIf {
198 project.repositories.any { it.name == 'local' } 200 project.repositories.any { it.name == 'local' }
199 } 201 }
290 dependencyLock.globalLockFile = 'release.lock' 292 dependencyLock.globalLockFile = 'release.lock'
291 293
292 294
293 task('doReleaseBranch') { 295 task('doReleaseBranch') {
294 ext.requested = matcher[0][1].toLowerCase() 296 ext.requested = matcher[0][1].toLowerCase()
295 } << { 297 doLast {
296 def releaseVersion = determineReleaseVersion(requested) 298 def releaseVersion = determineReleaseVersion(requested)
297 def releaseStream = releaseVersion.isHotfix() ? 'hotfix' : 'release' 299 def releaseStream = releaseVersion.isHotfix() ? 'hotfix' : 'release'
298 300
299 println "-" * 60 301 println "-" * 60
300 println "Preparing to create branch\n" 302 println "Preparing to create branch\n"
301 println "\tproject:\t${gradle.rootProject.name}" 303 println "\tproject:\t${gradle.rootProject.name}"
302 println "\tcurrent:\t${gradle.branch} ($gradle.branch.version)" 304 println "\tcurrent:\t${gradle.branch} ($gradle.branch.version)"
303 println() 305 println()
304 println "\ttype :\t${releaseStream.toUpperCase()}" 306 println "\ttype :\t${releaseStream.toUpperCase()}"
305 println "\tversion:\t${releaseVersion}" 307 println "\tversion:\t${releaseVersion}"
306 println "\ttarget :\t${releaseStream}/v${releaseVersion}" 308 println "\ttarget :\t${releaseStream}/v${releaseVersion}"
307 println() 309 println()
308 println("-" * 60) 310 println("-" * 60)
309 println "DRY RUN".center(60) 311 println "DRY RUN".center(60)
310 println("-" * 60) 312 println("-" * 60)
311 313
312 println "hg flow ${releaseStream} start v${releaseVersion} --dirty --dry-run".execute().text 314 println "hg flow ${releaseStream} start v${releaseVersion} --dirty --dry-run".execute().text
313 315
314 println "-" * 60 316 println "-" * 60
315 317
316 if (!confirmPrompt("Continue?")) { 318 if (!confirmPrompt("Continue?")) {
317 throw new BuildCancelledException("release branching canceled by user request") 319 throw new BuildCancelledException("release branching canceled by user request")
318 } 320 }
319 321
320 println "hg flow ${releaseStream} start v${releaseVersion} --dirty".execute().text 322 println "hg flow ${releaseStream} start v${releaseVersion} --dirty".execute().text
321 println "hg update ${releaseStream}/v${releaseVersion}".execute().text 323 println "hg update ${releaseStream}/v${releaseVersion}".execute().text
322 324 }
323 } 325 }
324 326
325 task('doCommitLock') << { 327 task('doCommitLock') {
326 println 'hg status'.execute().text 328 doLast {
327 println 'hg commit release.lock -A -m "lock dynamic dependencies for release"'.execute().text 329 println 'hg status'.execute().text
330 println 'hg commit release.lock -A -m "lock dynamic dependencies for release"'.execute().text
331 }
328 } 332 }
329 333
330 def branchTasks = ['doReleaseBranch', 'deleteGlobalLock', 'generateGlobalLock', 'saveGlobalLock', 'doCommitLock'] 334 def branchTasks = ['doReleaseBranch', 'deleteGlobalLock', 'generateGlobalLock', 'saveGlobalLock', 'doCommitLock']
331 335
332 task(taskName) { 336 task(taskName) {
487 } 491 }
488 } 492 }
489 } 493 }
490 494
491 495
492 task showEnvironments << { 496 task showEnvironments {
493 println "Defined environments: $gradle.environments" 497
494 gradle.environments.each { e -> 498 doLast {
495 println "\n $e:" 499 println "Defined environments: $gradle.environments"
496 gradle.getProperty(e).flatten().sort { it.key }.each { k, v -> 500 gradle.environments.each { e ->
497 println String.format(' %25s = %s', k, k.contains('password') ? "********" : v) 501 println "\n $e:"
498 } 502 gradle.getProperty(e).flatten().sort { it.key }.each { k, v ->
499 } 503 println String.format(' %25s = %s', k, k.contains('password') ? "********" : v)
500 if (logger.isInfoEnabled()) { 504 }
501 println "System properties:" 505 }
502 System.properties.each { println " $it" } 506 if (logger.isInfoEnabled()) {
503 println "env variables:" 507 println "System properties:"
504 System.getenv().each { println " $it" } 508 System.properties.each { println " $it" }
505 } 509 println "env variables:"
510 System.getenv().each { println " $it" }
511 }
512 }
506 } 513 }
507 514
508 def loadEnvironments() { 515 def loadEnvironments() {
509 def developerPrivate = new Properties() 516 def developerPrivate = new Properties()
510 if (file('private.properties').exists()) { 517 if (file('private.properties').exists()) {