Mercurial > public > develkit
comparison init20.gradle @ 180:1bdb6e1f2fdb
handle outputs update handling including env changes
author | smith@nwoca.org |
---|---|
date | Fri, 19 Dec 2014 04:27:16 +0000 |
parents | f9087f939b0a |
children | d90208c97ec5 |
comparison
equal
deleted
inserted
replaced
179:f9087f939b0a | 180:1bdb6e1f2fdb |
---|---|
113 maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } | 113 maven { url 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" | 117 apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" |
118 | |
119 task wrapper(type: Wrapper) {} | |
120 | 118 |
121 rootProject.afterEvaluate { r -> | 119 rootProject.afterEvaluate { r -> |
122 | 120 |
123 if (r.plugins.hasPlugin(org.gradle.plugins.ide.idea.IdeaPlugin)) { | 121 if (r.plugins.hasPlugin(org.gradle.plugins.ide.idea.IdeaPlugin)) { |
124 | 122 |
225 | 223 |
226 cleanLocal.onlyIf { | 224 cleanLocal.onlyIf { |
227 project.repositories.any { it.name == 'local' } | 225 project.repositories.any { it.name == 'local' } |
228 } | 226 } |
229 | 227 |
228 project.ext.previousBuildenv = project.file('build/buildenv.txt').exists() ? project.file('build/buildenv.txt').text : 'none' | |
229 | |
230 tasks.addRule("Pattern: <environment>As[Test]Properties: Generates <environment>.properties as resource or Test resource") { String taskName -> | 230 tasks.addRule("Pattern: <environment>As[Test]Properties: Generates <environment>.properties as resource or Test resource") { String taskName -> |
231 if ((taskName - 'Test').endsWith("AsProperties") && !taskName.startsWith('clean')) { | 231 if ((taskName - 'Test').endsWith("AsProperties") && !taskName.startsWith('clean')) { |
232 def t = taskName.contains('Test') ? processTestResources.destinationDir : processResources.destinationDir | 232 def t = taskName.contains('Test') ? processTestResources.destinationDir : processResources.destinationDir |
233 def e = (taskName - 'Test' - 'AsProperties').capitalize() | 233 def e = (taskName - 'Test' - 'AsProperties').capitalize() |
234 task(taskName) { | 234 task(taskName) { |
235 ext.propertyFile = new File(t, "${e.toLowerCase()}.properties") | 235 ext.propertyFile = new File(t, "${e.toLowerCase()}.properties") |
236 ext.buildenv = project.file('build/buildenv.txt') | |
236 inputs.files "../environment${e}.groovy", "../private${e}.groovy", '../private.properties' | 237 inputs.files "../environment${e}.groovy", "../private${e}.groovy", '../private.properties' |
238 outputs.files propertyFile, buildenv | |
239 outputs.upToDateWhen { | |
240 gradle.env == project.previousBuildenv | |
241 } | |
237 doLast { | 242 doLast { |
238 t.mkdirs() | 243 t.mkdirs() |
244 buildenv.text = gradle.env | |
239 def ps = gradle."environment${e}".toProperties() | 245 def ps = gradle."environment${e}".toProperties() |
240 ps['ssdt.project'] = project.name | 246 ps['ssdt.project'] = project.name |
241 ps.store(propertyFile.newOutputStream(), "by $taskName of $this") | 247 ps.store(propertyFile.newOutputStream(), "by $taskName of $this") |
242 def l = propertyFile.readLines().sort() | 248 def l = propertyFile.readLines().sort() |
243 propertyFile.text = l.join('\n') | 249 propertyFile.text = l.join('\n') |