# HG changeset patch # User smith@nwoca.org # Date 1418963236 0 # Node ID 1bdb6e1f2fdb521762f172f33d373bf68cc9864b # Parent f9087f939b0a33b51ce2d9192a053cdbfac8e69f handle outputs update handling including env changes diff -r f9087f939b0a -r 1bdb6e1f2fdb init20.gradle --- a/init20.gradle Sat Dec 13 22:44:49 2014 +0000 +++ b/init20.gradle Fri Dec 19 04:27:16 2014 +0000 @@ -116,8 +116,6 @@ apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle" -task wrapper(type: Wrapper) {} - rootProject.afterEvaluate { r -> if (r.plugins.hasPlugin(org.gradle.plugins.ide.idea.IdeaPlugin)) { @@ -227,15 +225,23 @@ project.repositories.any { it.name == 'local' } } + project.ext.previousBuildenv = project.file('build/buildenv.txt').exists() ? project.file('build/buildenv.txt').text : 'none' + 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 e = (taskName - 'Test' - 'AsProperties').capitalize() task(taskName) { ext.propertyFile = new File(t, "${e.toLowerCase()}.properties") + ext.buildenv = project.file('build/buildenv.txt') inputs.files "../environment${e}.groovy", "../private${e}.groovy", '../private.properties' + outputs.files propertyFile, buildenv + outputs.upToDateWhen { + gradle.env == project.previousBuildenv + } doLast { t.mkdirs() + buildenv.text = gradle.env def ps = gradle."environment${e}".toProperties() ps['ssdt.project'] = project.name ps.store(propertyFile.newOutputStream(), "by $taskName of $this")