Mercurial > public > develkit
comparison init.gradle @ 161:8dd6adab9388
add Rule for converting arbitrary environment's to property files
author | Dave Smith <smith@nwoca.org> |
---|---|
date | Fri, 10 Jan 2014 03:41:29 +0000 |
parents | 6af68acaf9b2 |
children | 29c3af8dc031 |
comparison
equal
deleted
inserted
replaced
160:6af68acaf9b2 | 161:8dd6adab9388 |
---|---|
200 } | 200 } |
201 | 201 |
202 cleanLocal.onlyIf { | 202 cleanLocal.onlyIf { |
203 project.repositories.any { it.name == 'local' } | 203 project.repositories.any { it.name == 'local' } |
204 } | 204 } |
205 | |
206 tasks.addRule("Pattern: <environment>As[Test]Properties: Generates <environment>.properties as resource or Test resource") { String taskName -> | |
207 if ((taskName - 'Test').endsWith("AsProperties") && !taskName.startsWith('clean')) { | |
208 def t = taskName.contains('Test') ? processTestResources.destinationDir : processResources.destinationDir | |
209 def e = (taskName - 'Test' - 'AsProperties').capitalize() | |
210 task(taskName) { | |
211 ext.propertyFile = new File(t, "${e.toLowerCase()}.properties") | |
212 inputs.files "../environment${e}.groovy", "../private${e}.groovy", '../private.properties' | |
213 outputs.file propertyFile | |
214 doLast { | |
215 t.mkdirs() | |
216 gradle."environment${e}".toProperties().store(propertyFile.newOutputStream(), "by $taskName of $this") | |
217 } | |
218 } | |
219 } | |
220 } | |
221 | |
205 | 222 |
206 } | 223 } |
207 | 224 |
208 | 225 |
209 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { | 226 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { |
240 | 257 |
241 if (!gradle.bambooBuild) { | 258 if (!gradle.bambooBuild) { |
242 add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { | 259 add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { |
243 name = 'local' | 260 name = 'local' |
244 addIvyPattern gradle.ivyUserDir + "/local/[module]-ivy-[revision].xml" | 261 addIvyPattern gradle.ivyUserDir + "/local/[module]-ivy-[revision].xml" |
245 addArtifactPattern gradle.ivyUserDir + '/local/[module]-[artifact]-[revision](-[classifier]).[ext]' | 262 addArtifactPattern gradle.ivyUserDir + '/local/[artifact]-[revision](-[classifier]).[ext]' |
246 descriptor = 'optional' | 263 descriptor = 'optional' |
247 checkmodified = true | 264 checkmodified = true |
248 changingMatcher = 'regexp' | 265 changingMatcher = 'regexp' |
249 changingPattern = '.*SNAPSHOT' | 266 changingPattern = '.*SNAPSHOT' |
250 force = true | 267 force = true |
251 } | 268 } |
252 } | 269 } |
253 | 270 |
254 | 271 |