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