# HG changeset patch # User smith@nwoca.org # Date 1425244639 0 # Node ID e1762e4ad070c22cca58f1e5043772890c908e35 # Parent acd8d3b58440bcaec05e873e11ffc591e1eb3b60 write properties to correct sourceset output. allow property filename to overridden more easily diff -r acd8d3b58440 -r e1762e4ad070 init20.gradle --- a/init20.gradle Mon Dec 22 20:56:20 2014 +0000 +++ b/init20.gradle Sun Mar 01 21:17:19 2015 +0000 @@ -229,13 +229,15 @@ tasks.addRule("Pattern: As[Test]Properties: Generates .properties as resource or Test resource") { String taskName -> if ((taskName - 'Test').endsWith("AsProperties") && !taskName.startsWith('clean')) { - def t = taskName.contains('Test') ? processTestResources.destinationDir : processResources.destinationDir + // def t = taskName.contains('Test') ? processTestResources.destinationDir : processResources.destinationDir + def t = taskName.contains('Test') ? sourceSets.test.output.resourcesDir : sourceSets.main.output.resourcesDir def e = (taskName - 'Test' - 'AsProperties').capitalize() task(taskName) { - ext.propertyFile = new File(t, "${e.toLowerCase()}.properties") + ext.outputDir = t + ext.propertyFile = "${e.toLowerCase()}.properties" ext.buildenv = project.file('build/buildenv.txt') inputs.files project.file("../environment${e}.groovy"), project.file("../private${e}.groovy"), project.file('../private.properties') - outputs.files propertyFile, buildenv + outputs.files new File(outputDir,propertyFile), buildenv outputs.upToDateWhen { gradle.env == project.previousBuildenv } @@ -244,9 +246,10 @@ buildenv.text = gradle.env def ps = gradle."environment${e}".toProperties() ps['ssdt.project'] = project.name - ps.store(propertyFile.newOutputStream(), "by $taskName of $this") - def l = propertyFile.readLines().sort() - propertyFile.text = l.join('\n') + def pf = new File(outputDir,propertyFile) + ps.store(pf.newOutputStream(), "by $taskName of $this") + def l = pf.readLines().sort() + pf.text = l.join('\n') } } }