Mercurial > public > develkit
comparison init.gradle @ 124:81a8ecfbc8fa
update init script to support groovy indy builds
author | smith@nwoca.org |
---|---|
date | Sat, 16 Feb 2013 17:37:43 +0000 |
parents | 6f1918544f7f |
children | b2532280341e |
comparison
equal
deleted
inserted
replaced
123:6f1918544f7f | 124:81a8ecfbc8fa |
---|---|
12 def hostname | 12 def hostname |
13 try { hostname = "hostname".execute().text.toLowerCase().readLines().first() } catch (e) { hostname = 'unknown'} | 13 try { hostname = "hostname".execute().text.toLowerCase().readLines().first() } catch (e) { hostname = 'unknown'} |
14 | 14 |
15 gradle.ext.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} || hostname?.startsWith('ssdt-') | 15 gradle.ext.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} || hostname?.startsWith('ssdt-') |
16 | 16 |
17 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild host: $hostname)" | 17 rootProject.ext.indyCapable = { |
18 | 18 boolean capable = true |
19 try { | |
20 Class.forName('java.lang.invoke.MethodHandle') | |
21 } catch (e) { | |
22 capable = false | |
23 } | |
24 capable && !rootProject.hasProperty('skipIndy') | |
25 } | |
26 | |
27 rootProject.ext.useIndy = { | |
28 boolean indy = false | |
29 // first, check if a system property activates indy support | |
30 indy |= System.hasProperty('indy') && Boolean.valueOf(System.getProperty('indy')) | |
31 | |
32 // check ssdt environment for indy property. | |
33 indy |= (gradle.environment.indy) ? gradle.environment.indy.toBoolean() : false | |
34 | |
35 // check if the main project has an extension property setting indy (-Pindy). | |
36 if (rootProject.hasProperty('indy')) { indy = (Boolean.valueOf(rootProject.indy)) } | |
37 | |
38 // set the groovy runtime system property to ensure forked junit test will get the indy flag properly | |
39 if (indy && rootProject.indyCapable()) System.setProperty("groovy.target.indy","true") | |
40 | |
41 indy && rootProject.indyCapable() | |
42 } | |
43 | |
44 println "Indy available: ${rootProject.indyCapable()} enabled: ${rootProject.useIndy()}" | |
45 | |
19 if (gradle.bambooBuild) { | 46 if (gradle.bambooBuild) { |
20 gradle.ext.ssdtGradlekitLocation = gradle.ext.has('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip' | 47 gradle.ext.ssdtGradlekitLocation = gradle.ext.has('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip' |
48 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild host: $hostname)" | |
21 apply from: "${gradle.ssdtGradlekitLocation}/artifactory.gradle" | 49 apply from: "${gradle.ssdtGradlekitLocation}/artifactory.gradle" |
22 } | 50 } |
23 | 51 |
24 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" | 52 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" |
25 | 53 |
119 | 147 |
120 thisProject.tasks.add("publishLocal") { | 148 thisProject.tasks.add("publishLocal") { |
121 description = "Publishes this projects artifacts to developer's local repository" | 149 description = "Publishes this projects artifacts to developer's local repository" |
122 dependsOn = ["uploadArchives"] | 150 dependsOn = ["uploadArchives"] |
123 } | 151 } |
124 } | 152 } |
153 | |
154 } | |
155 | |
156 root.subprojects { p -> | |
157 if (root.useIndy()) { | |
158 def groovyIndy = p.configurations.compile.files.find { f -> f.name.startsWith('groovy-all') && f.name.contains('-indy') } | |
159 if (groovyIndy) { | |
160 logger.info "enabling indy on $p" | |
161 [compileGroovy.groovyOptions,compileTestGroovy.groovyOptions]*.with { | |
162 optimizationOptions = [ indy: true ] | |
163 } | |
164 } | |
165 } | |
125 } | 166 } |
126 } | 167 } |
127 } | 168 } |
128 | 169 |
129 | 170 |