annotate init50.gradle @ 360:8238fff451c9

Cygwin has an ENV that container 'CI'. Causing build issues. Just check for 'github' to determine if it is a local build
author davis@ssdt-ohio.org
date Wed, 15 Nov 2023 14:48:56 -0500
parents 8adc604ccdc3
children de8c350c511a
rev   line source
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
1 import groovy.transform.Sortable
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
2 import groovy.transform.ToString
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
3 import groovy.transform.TupleConstructor
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
4 import org.gradle.util.GradleVersion
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
5
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
6 buildscript {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
7 repositories {
278
2f6d25a71778 DEP-19: update maven repo urls
Marc Davis <davis@ssdt-ohio.org>
parents: 277
diff changeset
8 maven { url 'https://docker.ssdt.io/artifactory/ssdt-repo' }
2f6d25a71778 DEP-19: update maven repo urls
Marc Davis <davis@ssdt-ohio.org>
parents: 277
diff changeset
9 maven { url 'https://docker.ssdt.io/artifactory/gradle-plugins' }
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
10 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
11 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
12
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
13 // buildScan { termsOfServiceUrl = 'https://gradle.com/terms-of-service'; termsOfServiceAgree = 'yes' }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
14
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
15 final GradleVersion gradleCurrent = GradleVersion.current()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
16 final GradleVersion gradleV50 = GradleVersion.version('5.0')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
17
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
18 if (gradleCurrent < gradleV50) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
19 throw new RuntimeException("this init script requires Gradle version 5.0 or higher")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
20 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
21
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
22 gradle.ext.ssdtDevelkitLocation = gradle.ext.has('ssdtDevelkitLocation') ? gradle.ssdtDevelkitLocation : 'http://hg.ssdt-ohio.org/browse/public/develkit'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
23
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
24 ant.property(file: System.getProperty('user.home') + "/.ssdt/private.properties")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
25 gradle.ext.ivyUserDir = ant.properties['ivy.default.ivy.user.dir'] ?: System.getProperty('user.home') + "/.ivy2"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
26
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
27 gradle.ext.ssdtProjectId = System.getenv('bamboo_project_id') ?: rootProject.name
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
28
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
29 gradle.addListener(new ArtifactoryGradleSettings())
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
30
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
31 def hostname
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
32 try {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
33 hostname = "hostname".execute().text.toLowerCase().readLines().first()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
34 } catch (e) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
35 hostname = 'unknown'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
36 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
37
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
38 gradle.ext.bambooBuild = System.getenv().any {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
39 it.key.toLowerCase().contains('bamboo')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
40 } || hostname?.startsWith('ssdt-ba')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
41
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
42 if (!rootProject.hasProperty("bambooLocalBuild")) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
43 gradle.ext.bambooLocalBuild = false
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
44 } else {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
45 gradle.ext.bambooLocalBuild = rootProject.bambooLocalBuild.toBoolean()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
46 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
47
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
48 if (gradle.bambooLocalBuild) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
49 println "Bamboo local build active"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
50 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
51
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
52 gradle.ext.bambooPlan = (System.getenv('BAMBOO_PLAN') ?: 'UNKNOWN-UNKNOWN-JOB1').split('-')[0..1].join('-')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
53 logger.info "Bamboo plan: ${gradle.bambooPlan}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
54
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
55 gradle.ext.buildTimestamp = System.currentTimeMillis().toString().padLeft(14, '0')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
56
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
57 gradle.ext.hgRepositoryUrl = ""
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
58
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
59 try {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
60 gradle.ext.hgRepositoryUrl = ("hg path".execute().text.split('=') ?: ['', ''])[1].trim()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
61 } catch (e) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
62 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
63
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
64 def springModuleTranslator = [
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
65 'spring-transaction': 'spring-tx',
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
66 'spring-web-servlet': 'spring-webmvc',
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
67 ].withDefault { it }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
68
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
69 gradle.ext.normalizeSpring = { DependencyResolveDetails details ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
70 if (details.requested.group == 'org.springframework' && details.requested.name.startsWith('org.springframework.')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
71 def shortName = springModuleTranslator[details.requested.name.replace('org.springframework.', 'spring-').replace('.', '-')]
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
72 details.useTarget(group: 'org.springframework', name: shortName, version: details.requested.version)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
73 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
74 if (details.requested.group == 'org.springframework.security' && details.requested.name.startsWith('org.springframework.')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
75 def shortName = springModuleTranslator[details.requested.name.replace('org.springframework.', 'spring-').replace('.', '-')]
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
76 details.useTarget("${details.requested.group}:$shortName:${details.requested.version}")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
77 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
78 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
79
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
80 gradle.ext.runtimeInfo = new RuntimeInfo()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
81
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
82
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
83 if (System.env.DOCKER_HOST ) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
84 if (System.env.DOCKER_HOST.contains('tcp:')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
85 gradle.ext.dockerEngineUrl = "https:${System.env.DOCKER_HOST?.minus('tcp:')}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
86 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
87 gradle.ext.dockerEngineUrl = System.env.DOCKER_HOST
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
88 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
89
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
90 setBranchInfo()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
91
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
92 loadEnvironments()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
93
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
94 gradle.environment.put('hgRepositoryUrl', gradle.hgRepositoryUrl)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
95 gradle.environment.put('branchName', gradle.branch.name)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
96 gradle.environment.put('branchStream', gradle.branch.stream)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
97 gradle.environment.put('branchHash', gradle.branch.hash)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
98
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
99
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
100 def cacheTimeout = 60 * 60 * 8
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
101 if (gradle.environment['dependencyTimeout']) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
102 cacheTimeout = gradle.environment['dependencyTimeout'] as Integer
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
103 println "setting changing dependency timeout to $cacheTimeout seconds"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
104 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
105
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
106 gradle.ext.cacheTimeout = cacheTimeout
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
107
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
108 rootProject.ext.indyCapable = {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
109 boolean capable = true
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
110 try {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
111 Class.forName('java.lang.invoke.MethodHandle')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
112 } catch (e) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
113 capable = false
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
114 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
115 capable && !rootProject.hasProperty('skipIndy')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
116 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
117
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
118 rootProject.ext.useIndy = {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
119 boolean indy = false
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
120 // first, check if a system property activates indy support
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
121 indy |= System.hasProperty('indy') && Boolean.valueOf(System.getProperty('indy'))
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
122
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
123 // check ssdt environment for indy property.
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
124 indy |= (gradle.environment.indy) ? gradle.environment.indy.toBoolean() : false
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
125
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
126 // check if the main project has an extension property setting indy (-Pindy).
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
127 if (rootProject.hasProperty('indy')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
128 indy = (Boolean.valueOf(rootProject.indy))
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
129 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
130
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
131 // set the groovy runtime system property to ensure forked junit test will get the indy flag properly
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
132 if (indy && rootProject.indyCapable()) System.setProperty("groovy.target.indy", "true")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
133
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
134 indy && rootProject.indyCapable()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
135 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
136
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
137 println "Indy available: ${rootProject.indyCapable()} enabled: ${rootProject.useIndy()}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
138
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
139 if (gradle.bambooBuild) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
140
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
141 file('build-number.txt').text = "build.number=${gradle.branch.buildNumber ?: -1 }\n"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
142 gradle.ext.ssdtGradlekitLocation = gradle.ext.has('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
143 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild host: $hostname)"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
144 apply from: "${gradle.ssdtGradlekitLocation}/artifactory40.gradle"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
145 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
146
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
147 if (!rootProject.hasProperty('disableMetrics')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
148 apply from: "${gradle.ssdtDevelkitLocation}/metrics50.gradle"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
149 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
150
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
151 rootProject.afterEvaluate { r ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
152 if (gradle.bambooBuild && r.hasProperty('requireJavaVersion')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
153 gradle.runtimeInfo.requireJava( r.getProperty('requireJavaVersion') )
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
154 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
155 if (!gradle.bambooBuild && !r.file('.idea/copyright/ODE.xml').exists() ) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
156 updateCopyrightProfile(r)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
157 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
158 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
159
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
160 def findComponent(project, name) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
161 project.component.find { it.@name == name }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
162 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
163
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
164 wrapper {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
165 distributionType = org.gradle.api.tasks.wrapper.Wrapper.DistributionType.ALL
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
166 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
167
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
168 allprojects {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
169
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
170 configurations.all {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
171 resolutionStrategy.cacheChangingModulesFor gradle.cacheTimeout, 'seconds'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
172 resolutionStrategy.cacheDynamicVersionsFor gradle.cacheTimeout, 'seconds'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
173 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
174 configurations.all {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
175 resolutionStrategy.eachDependency { DependencyResolveDetails details ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
176 if (details.requested.group == 'org.ssdt_ohio' && !details.requested.version ) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
177 details.useVersion( "latest.${gradle.branch.defaultDependencyStatus}" )
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
178 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
179 if (details.requested.version == 'default') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
180 details.useVersion("latest.${gradle.branch.defaultDependencyStatus}" )
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
181 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
182 if (project.hasProperty("overrideCommon")) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
183 if (details.requested.group == 'org.ssdt_ohio' && details.requested.name.contains('ssdt.common.')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
184 details.useVersion(project.overrideCommon)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
185 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
186 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
187 if (project.hasProperty("overrideVui")) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
188 if (details.requested.group == 'org.ssdt_ohio' && details.requested.name.startsWith('vui.')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
189 details.useVersion(project.overrideVui)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
190 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
191 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
192 if (project.hasProperty("overrideUsasCore")) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
193 if (details.requested.group == 'org.ssdt_ohio' && details.requested.name.startsWith('usas.') && !details.requested.name.startsWith('usas.vui')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
194 details.useVersion(project.overrideUsasCore)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
195 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
196 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
197 if (project.hasProperty("overrideUspsCore")) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
198 if (details.requested.group == 'org.ssdt_ohio' && details.requested.name.startsWith('usps.') && !details.requested.name.startsWith('usps.vui')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
199 details.useVersion(project.overrideUspsCore)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
200 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
201 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
202
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
203 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
204 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
205
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
206 task cleanLocal(description: "removes all artifacts from developer's local repository") {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
207
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
208 doLast {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
209 def local = project.repositories.find { it.name == 'local' }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
210 if (local) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
211 logger.info "removing local repo: $it"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
212 new File(System.properties['user.home'] + "/.ssdt/local-repo").deleteDir()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
213 def localDir = new File(gradle.ivyUserDir + "/local")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
214 localDir.deleteDir()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
215 logger.info "verifying removal of local repo"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
216 if (localDir.exists()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
217 throw new org.gradle.api.GradleException("Unable to clean ${localDir}. Files may be locked by another process.")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
218 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
219 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
220 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
221 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
222
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
223 cleanLocal.onlyIf {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
224 project.repositories.any { it.name == 'local' }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
225 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
226
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
227 project.ext.previousBuildenv = project.file('build/buildenv.txt').exists() ? project.file('build/buildenv.txt').text : 'none'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
228
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
229 tasks.addRule("Pattern: <environment>As[Test]Properties: Generates <environment>.properties as resource or Test resource") { String taskName ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
230 if ((taskName - 'Test').endsWith("AsProperties") && !taskName.startsWith('clean')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
231 // def t = taskName.contains('Test') ? processTestResources.destinationDir : processResources.destinationDir
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
232 def t = taskName.contains('Test') ? sourceSets.test.output.resourcesDir : sourceSets.main.output.resourcesDir
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
233 def e = (taskName - 'Test' - 'AsProperties').capitalize()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
234 task(taskName) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
235 ext.outputDir = t
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
236 ext.propertyFile = "${e.toLowerCase()}.properties"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
237 ext.buildenv = project.file('build/buildenv.txt')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
238 inputs.files project.file("../environment${e}.groovy"), project.file("../private${e}.groovy"), project.file('../private.properties')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
239 outputs.files new File(outputDir,propertyFile), buildenv
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
240 outputs.upToDateWhen {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
241 gradle.env == project.previousBuildenv && outputs.getFiles().every { it.exists() }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
242 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
243 doLast {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
244 t.mkdirs()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
245 outputDir.mkdirs()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
246 buildenv.text = gradle.env
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
247 def ps = gradle."environment${e}".toProperties()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
248 ps['ssdt.project'] = project.name
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
249 def pf = new File(outputDir,propertyFile)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
250 ext.outputPropertyFile = pf
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
251 ps.store(pf.newOutputStream(), "by $taskName of $this")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
252 def l = pf.readLines().sort()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
253 pf.text = l.join('\n').replaceAll("\\.PARENT","")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
254 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
255 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
256 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
257 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
258
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
259 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
260
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
261 subprojects {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
262
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
263 it.ext.environment = gradle.environment
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
264
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
265 dependencyLocking {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
266 if (gradle.branch.isRelease()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
267 lockAllConfigurations()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
268 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
269 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
270
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
271 task("releaseLock" ) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
272 description = "Create release dependencies Lock files"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
273 doFirst {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
274 assert gradle.startParameter.writeDependencyLocks : "must include --write-locks or --update-locks option when locking dependencies"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
275 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
276 doLast {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
278 if (!gradle.branch.isRelease()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
279 throw new BuildCancelledException("releaseLock is only valid on release or hotfix branch.")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
280 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
281
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
282 configurations.findAll {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
283 it.canBeResolved
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
284 }.findAll { c ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
285 def n = c.name.toLowerCase()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
286 ['compile','runtime','provided'].any { n.contains(it) }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
287 }.each {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
288 it.resolve()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
289 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
290 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
291 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
292
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
293 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
294
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
295 rootProject.afterEvaluate {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
296
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
297 tasks.addRule("release{Major|Minor|Patch|n.n.n}: create release branch or update release Lock file") { String taskName ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
298
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
299 def matcher = (taskName =~ /^release(Major|Minor|Patch|\d{1,3}\.\d{1,3}\.\d{1,3})$/)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
300 if (matcher.matches()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
301
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
302 task('doReleaseBranch') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
303 ext.requested = matcher[0][1].toLowerCase()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
304 doLast {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
305 def releaseVersion = determineReleaseVersion(requested)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
306 def releaseStream = releaseVersion.isHotfix() ? 'hotfix' : 'release'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
307
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
308 println "-" * 60
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
309 println "Preparing to create branch\n"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
310 println "\tproject:\t${gradle.rootProject.name}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
311 println "\tcurrent:\t${gradle.branch} ($gradle.branch.version)"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
312 println()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
313 println "\ttype :\t${releaseStream.toUpperCase()}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
314 println "\tversion:\t${releaseVersion}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
315 println "\ttarget :\t${releaseStream}/v${releaseVersion}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
316 println()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
317 println("-" * 60)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
318 println "DRY RUN".center(60)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
319 println("-" * 60)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
320
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
321 println "hg flow ${releaseStream} start v${releaseVersion} --dirty --dry-run".execute().text
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
322
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
323 println "-" * 60
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
324
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
325 if (!confirmPrompt("Continue?")) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
326 throw new BuildCancelledException("release branching canceled by user request")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
327 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
328
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
329 println "hg flow ${releaseStream} start v${releaseVersion} --dirty".execute().text
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
330 println "hg update ${releaseStream}/v${releaseVersion}".execute().text
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
331
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
332 setBranchInfo()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
333
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
334 println "-" * 60
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
335 println " Be sure to execute 'releaseLock' task to update the release.lock file before proceeding."
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
336 println "-" * 60
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
337
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
338 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
339 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
340
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
341
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
342 def branchTasks = ['doReleaseBranch']
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
343
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
344 task(taskName) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
345 dependsOn branchTasks
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
346 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
347
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
348 branchTasks.tail().inject(branchTasks.head()) { a, b ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
349 tasks[b].mustRunAfter a
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
350 b
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
351 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
352
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
353 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
354 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
355
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
356 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
357
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
358 private static String readLine(String message, String defaultValue = null) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
359 String _message = "> $message" + (defaultValue ? " [$defaultValue] " : "")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
360 if (System.console()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
361 return System.console().readLine(_message) ?: defaultValue
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
362 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
363 println "$_message "
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
364
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
365 System.in.newReader().readLine() ?: defaultValue
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
366 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
367
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
368 private static boolean confirmPrompt(String message, boolean defaultValue = false) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
369 String defaultStr = defaultValue ? 'Y' : 'n'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
370 String consoleVal = readLine("${message} (Y|n)", defaultStr)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
371 if (consoleVal) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
372 return consoleVal.toLowerCase().startsWith('y')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
373 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
374
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
375 defaultValue
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
376 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
377
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
378 private Version determineReleaseVersion(String requested) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
379 if (requested == 'major') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
380 return gradle.branch.version.nextMajor()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
381 } else if (requested == 'minor') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
382 return gradle.branch.version.nextMinor()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
383 } else if (requested == 'patch') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
384 return gradle.branch.version.nextPatch()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
385 } else {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
386 return new Version(*requested.split(/\./)*.toInteger(), false)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
387 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
388 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
389
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
390 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
391
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
392 def void projectsEvaluated(Gradle gradle) {
278
2f6d25a71778 DEP-19: update maven repo urls
Marc Davis <davis@ssdt-ohio.org>
parents: 277
diff changeset
393 def ssdtArtifactory = 'https://docker.ssdt.io/artifactory'
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
394 Project root = gradle.getRootProject()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
395
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
396
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
397 def branchVersioning = gradle.rootProject.version == 'unspecified'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
398
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
399 root.allprojects {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
400
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
401 def thisProject = delegate
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
402 thisProject.status = 'integration'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
403 if (gradle.branchStream) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
404 if (branchVersioning) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
405 thisProject.version = gradle.branch.version
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
406 thisProject.status = gradle.branch.defaultDependencyStatus
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
407 } else {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
408
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
409 thisProject.status = 'integration'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
410 def fixupVersion = thisProject.version - ".SNAPSHOT"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
411 if (gradle.branchStream == 'feature') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
412 fixupVersion = fixupVersion + ".SNAPSHOT"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
413 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
414 if (gradle.branchStream == 'develop') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
415 fixupVersion = fixupVersion + ".SNAPSHOT"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
416 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
417 if (gradle.branchStream in ['production', 'release', 'hotfix']) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
418 thisProject.status = 'release'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
419 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
420 thisProject.version = fixupVersion
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
421 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
422 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
423
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
424 repositories {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
425
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
426 if (!gradle.bambooBuild || gradle.bambooLocalBuild) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
427 ivy {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
428 name = 'local'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
429 artifactPattern gradle.ivyUserDir + '/local/[artifact]-[revision](-[classifier]).[ext]'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
430 ivyPattern gradle.ivyUserDir + "/local/[module]-ivy-[revision].xml"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
431 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
432 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
433
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
434 if (!gradle.bambooBuild) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
435 mavenLocal()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
436 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
437
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
438 if (gradle.branchStream == 'feature') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
439 ivy {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
440 name = 'ssdt-branches'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
441 url = "${ssdtArtifactory}/ssdt-branches/${gradle.branchHash}/"
282
8adc604ccdc3 SSED-1600: Updated deprecated methods in init50.gradle
Christian Inman <inman@ssdt-ohio.org>
parents: 278
diff changeset
442 patternLayout() {
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
443 artifact "[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
444 ivy "[organization]/[module]/ivy-[revision].xml"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
445 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
446 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
447 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
448
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
449 ivy {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
450 name = 'ssdt-releases'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
451 url = "${ssdtArtifactory}/ssdt-releases"
282
8adc604ccdc3 SSED-1600: Updated deprecated methods in init50.gradle
Christian Inman <inman@ssdt-ohio.org>
parents: 278
diff changeset
452 patternLayout() {
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
453 artifact "[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
454 artifact "[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
455 ivy "[organization]/[module]/ivy-[revision].xml"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
456 m2compatible = true
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
457 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
458 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
459
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
460 ivy {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
461 name = 'ssdt-snapshots'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
462 url = "${ssdtArtifactory}/ssdt-snapshots"
282
8adc604ccdc3 SSED-1600: Updated deprecated methods in init50.gradle
Christian Inman <inman@ssdt-ohio.org>
parents: 278
diff changeset
463 patternLayout() {
277
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
464 artifact "[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
465 artifact "[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
466 ivy "[organization]/[module]/ivy-[revision].xml"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
467 m2compatible = true
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
468 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
469 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
470
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
471 maven {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
472 name = 'ssdt-repository'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
473 url = "${ssdtArtifactory}/repository"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
474 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
475
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
476 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
477
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
478 def remoteRepos = thisProject.repositories.findAll { it.hasProperty('url') && !(it.name.toLowerCase().contains('local') || it.url.toString().contains('ssdt')) }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
479 if (remoteRepos) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
480 logger.warn "WARNING: Remote repositories configured for $thisProject:\n" + remoteRepos.collect { "\t$it.name $it.url " }.join('\n') + "\n Moved to lowest priority..."
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
481 remoteRepos.each {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
482 thisProject.repositories.remove(it)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
483 thisProject.repositories.addLast(it)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
484 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
485 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
486 logger.info "$thisProject configured repositories:\n" + thisProject.repositories.collect {"\t$it.name ${it.hasProperty('url') ? it.url : '' }" }.join('\n')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
487
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
488 if (thisProject.repositories.find { it.name == 'local' } && thisProject.getTasksByName('uploadArchives', false)) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
489 uploadArchives {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
490 repositories {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
491 add thisProject.repositories.local
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
492 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
493 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
494
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
495 thisProject.tasks.create("publishLocal") {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
496 description = "Publishes this projects artifacts to developer's local repository"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
497 dependsOn = ["uploadArchives"]
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
498 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
499 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
500
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
501 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
502
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
503 root.subprojects { p ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
504 if (root.useIndy()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
505 println "enabling indy compilation on $p"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
506 [compileGroovy.groovyOptions, compileTestGroovy.groovyOptions]*.with {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
507 optimizationOptions = [indy: true]
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
508 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
509 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
510 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
511 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
512 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
513
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
514
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
515 task showEnvironments {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
516
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
517 doLast {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
518 println "Defined environments: $gradle.environments"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
519 gradle.environments.each { e ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
520 println "\n $e:"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
521 gradle.getProperty(e).flatten().sort { it.key }.each { k, v ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
522 println String.format(' %25s = %s', k, k.contains('password') ? "********" : v)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
523 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
524 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
525 if (logger.isInfoEnabled()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
526 println "System properties:"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
527 System.properties.each { println " $it" }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
528 println "env variables:"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
529 System.getenv().each { println " $it" }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
530 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
531 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
532 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
533
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
534 def loadEnvironments() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
535 def developerPrivate = new Properties()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
536 if (file('private.properties').exists()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
537 developerPrivate.load(file('private.properties').newReader())
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
538 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
539 def envOverrides = [:]
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
540
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
541 if (!hasProperty('env')) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
542 gradle.ext.env = developerPrivate.env ?: 'dev'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
543 } else {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
544 def values = getProperty('env').split(',')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
545 gradle.ext.env = values.first()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
546 values.tail().each {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
547 def (k, v) = it.split('=')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
548 envOverrides.put(k, v)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
549 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
550 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
551
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
552 println "Environment is: $gradle.env ($envOverrides)"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
553 def slurper = new ConfigSlurper(gradle.env)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
554 slurper.setBinding(['gradle': gradle])
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
555
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
556 def environment = slurper.parse(
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
557 '''deploy.mode="production"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
558 environments {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
559 test { deploy.mode="test" }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
560 dev { deploy.mode="development"}
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
561 }''')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
562 if (developerPrivate['deploy.mode']) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
563 environment.put('deploy.mode', developerPrivate['deploy.mode'])
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
564 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
565
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
566 environment.put('branchInfo',gradle.branch)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
567 environment.put('branchVersion',gradle.branch.version.toString())
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
568 def environments = []
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
569 gradle.ext.environment = environment
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
570 file('.').listFiles().findAll { it.name ==~ /^environment.*\.groovy$/ }.sort { it.name }.each { envFile ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
571 def envName = envFile.name - '.groovy'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
572 def privateFile = file("private" + envName - "environment" + ".groovy")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
573 logger.info("loading environment $envFile.name")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
574
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
575 def envCfg = slurper.parse(envFile.toURL())
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
576 envCfg.merge(slurper.parse(developerPrivate))
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
577 envCfg.put('ssdt.projectid', gradle.ssdtProjectId)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
578 envCfg.put('ssdt.environment', gradle.env)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
579 if (privateFile.exists()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
580 logger.info("loading private environment $privateFile")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
581 envCfg.merge(slurper.parse(privateFile.toURL()))
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
582 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
583
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
584 gradle.rootProject.getProperties().find { it.key.startsWith('environment') }.each {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
585 it.value.split(',').each { p ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
586 def (k, v) = p.split('=')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
587 logger.info("$envName: overriding " + k + "=" + v + " in $it")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
588 envCfg.put(k, v)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
589 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
590 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
591
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
592 envOverrides.each { k, v ->
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
593 logger.info("$envName: overriding " + k + "=" + v)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
594 envCfg.put(k, v)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
595 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
596 environment.merge(envCfg)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
597 if (envName != 'environment') {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
598 gradle.ext[envName] = envCfg
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
599 environments << envName
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
600 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
601 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
602 environment.merge(slurper.parse(developerPrivate))
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
603 def deployMode = environment.deploy.mode ?: 'development'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
604 environments.each { gradle.ext[it].put('ssdt.deployment.mode', deployMode) }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
605 environments << 'environment'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
606 gradle.ext.environments = environments
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
607
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
608 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
609
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
610 def updateCopyrightProfile(Project r) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
611 r.file('.idea/copyright').mkdirs()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
612 r.file('.idea/copyright/ODE.xml').text =
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
613 '''<component name="CopyrightManager">
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
614 <copyright>
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
615 <option name="notice" value="Copyright (c) &amp;#36;today.year. Ohio Department of Education. - All Rights Reserved.&#10;Unauthorized copying of this file, in any medium, is strictly prohibited.&#10;Written by the State Software Development Team (http://ssdt.oecn.k12.oh.us/)&#10;" />
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
616 <option name="myName" value="ODE" />
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
617 </copyright>
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
618 </component>'''
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
619
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
620 r.file('.idea/copyright/profiles_settings.xml').text =
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
621 '''<component name="CopyrightManager">
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
622 <settings default="ODE" />
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
623 </component>'''
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
624
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
625 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
626
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
627 @ToString(includeNames=true)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
628 class RuntimeInfo {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
629 // OS memory in megabytes, zero if unknown
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
630 int systemMemory = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
631 int systemFreeMemory = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
632 String javaVersion = System.getProperty('java.version')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
633
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
634 RuntimeInfo() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
635 try {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
636 new File('/proc/meminfo').readLines().findAll { it.startsWith 'Mem' }.collect { it.split(/\s+/) }.each {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
637 int value = (it[1] as Long) / 1024
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
638 if (it[0].startsWith('MemTotal')) { systemMemory = value }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
639 if (it[0].startsWith('MemFree')) { systemFreeMemory = value }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
640 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
641
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
642 } catch (e) { }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
643
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
644 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
645
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
646 void requireMemory(int megabytes) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
647 if (systemFreeMemory > 0 && systemFreeMemory < megabytes) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
648 println "WARNING: potentially insufficent OS memory for this build"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
649 // throw new GradleException("insufficent free OS memory for this build (available: ${systemFreeMemory}m, required: ${megabytes}m)")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
650 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
651 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
652 /**
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
653 * Returns maximum memory available upto the value specified.
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
654 */
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
655 int maxMemory(int megabytes) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
656 if (systemFreeMemory) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
657 [systemFreeMemory,megabytes].min()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
658 } else { megabytes }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
659
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
660 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
661
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
662 void requireJava(String version) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
663
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
664 if ( version && !javaVersion.startsWith(version)) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
665 throw new GradleException("Requires java version $version but running under $javaVersion")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
666 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
667 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
668
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
669 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
670
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
671
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
672 @TupleConstructor
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
673 @Sortable
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
674 class Version {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
675
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
676 Integer major = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
677 Integer minor = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
678 Integer patch = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
679 Boolean snapshot = true
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
680
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
681 Integer previousMinor = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
682 Integer previousPatch = 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
683
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
684 Version nextMajor() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
685 new Version(major + 1, 0, 0, false)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
686 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
687
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
688 Version nextMinor() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
689 if (snapshot) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
690 new Version(major, minor , 0,false)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
691 } else {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
692 new Version(major, minor + 1, 0,false)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
693 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
694 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
695
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
696 Version nextPatch() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
697 if (snapshot) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
698 new Version(major, previousMinor, previousPatch + 1,false)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
699 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
700 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
701
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
702 Version nextSnapshot() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
703 new Version(major, minor + 1, 0,true,minor,patch)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
704 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
705
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
706 boolean isHotfix() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
707 !snapshot && patch > 0
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
708 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
709
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
710 String toString() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
711 "${major}.${minor}.${patch}${snapshot ? '.SNAPSHOT' : ''}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
712 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
713
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
714 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
715
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
716 void setBranchInfo() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
717 gradle.ext.branch = new BranchInfo(System.getenv('bamboo_planRepository_branch'))
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
718 gradle.ext.branchName = gradle.branch.name
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
719 gradle.ext.branchStream = gradle.branch.stream
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
720 gradle.ext.branchHash = gradle.branch.hash
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
721 println "${gradle.hgRepositoryUrl} ${gradle.branch} ${gradle.branch.version}"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
722 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
723
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
724
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
725 @ToString(includes=['name','shortName','buildVersion','imageId','deployName'],includeNames= true)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
726 class BranchInfo {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
727 def name
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
728 def stream = "none"
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
729 def buildNumber = ""
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
730 def changeset = ""
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
731 def version
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
732
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
733 BranchInfo(name) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
734 this.name = name
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
735 if (!name) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
736 this.name = determineName() ?: ''
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
737 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
738 this.name = this.name.replace('@', '-')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
739 determineStream()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
740 buildNumber = System.getenv('bamboo_buildNumber') ?: ""
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
741 changeset = System.getenv('bamboo_planRepository_revision') ?: ""
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
742 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
743
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
744 String getDefaultDependencyStatus() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
745 return isRelease() ? 'release' : 'integration'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
746 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
747
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
748 private boolean isRelease() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
749 return stream in ['release', 'hotfix']
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
750 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
751
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
752 def getShortName() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
753 def result = name.contains('/') ? name.split('/')[1] : name
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
754 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
755
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
756 String getBuildVersion() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
757 def v = isRelease() ? shortName - "v": ""
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
758 return v
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
759 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
760
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
761 def Version getVersion() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
762 if (!version) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
763 if (isRelease()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
764 version = new Version(*getBuildVersion().split('\\.')*.toInteger(), false)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
765 } else {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
766 version = findSnapshotVersion()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
767 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
768 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
769 return version
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
770 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
771
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
772 def getImageId() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
773 (buildVersion ?: shortName.take(25)) + (buildNumber ? "-${buildNumber}" : "-0")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
774 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
775
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
776 def getDeployName() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
777 (buildVersion ?: shortName.take(25)).toLowerCase().collectReplacements {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
778 ('a'..'z').contains(it) || ('0'..'9').contains(it) || it == "-" ? null : '-'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
779 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
780 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
781
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
782 def getHash() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
783 generateMD5(name)
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
784 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
785 def generateMD5(String s) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
786 def digest = java.security.MessageDigest.getInstance("MD5")
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
787 digest.update(s.bytes);
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
788 new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
789 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
790
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
791 private findSnapshotVersion() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
792
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
793 try {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
794 def repositoryUrl = System.getenv('bamboo_planRepository_repositoryUrl')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
795 if (repositoryUrl) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
796 println "hg pull $repositoryUrl".execute().text
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
797 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
798 def versions = "hg branches --closed".execute().text.split('\n').findAll {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
799 it.startsWith( 'release') || it.startsWith( 'hotfix')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
800 }.collect {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
801 it.replaceAll('\\s+',' ').split(' ')[0].split('/')[1] - 'v'
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
802 }.collect {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
803 new Version(*it.split('\\.')*.toInteger())
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
804 }.sort { v1, v2 -> v2 <=> v1 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
805
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
806 return versions ? versions.first().nextSnapshot() : new Version().nextSnapshot()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
807
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
808 } catch (e) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
809 return new Version().nextSnapshot()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
810 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
811
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
812 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
813
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
814 def determineName() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
815 try {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
816 def branch = "hg branch".execute().text.trim()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
817 def rawParents = 'hg parents'.execute().text
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
818 def parent = rawParents.split('\n').find { it.startsWith("branch") }?.split(":")?.getAt(1)?.trim()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
819 return parent ?: branch
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
820 } catch (e) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
821 ['.hg/branch', '../.hg/branch'].findResult {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
822 new File(it).exists() ? new File(it).text : null
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
823 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
824 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
825 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
826
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
827 void determineStream() {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
828 def flowConfig = new File('.hgflow').exists() ? new File('.hgflow') : new File('../.hgflow')
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
829 if (flowConfig.exists()) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
830 def flows = new Properties()
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
831 flows.load(flowConfig.newReader())
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
832 flows.stringPropertyNames().each {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
833 if (!it.startsWith("[") && name.startsWith(flows.getProperty(it))) {
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
834 stream = it
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
835 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
836 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
837 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
838 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
839
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
840 }
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
841
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
842
7352aab6847e SC-181 Add new init50 and metrics50 gradle files for compatibility with gradle 5.0
Greg Shepherd <shepherd@ssdt-ohio.org>
parents:
diff changeset
843