On 25/03/10 7:52 AM, Adam Murdoch wrote:
On 24/03/10 11:28 PM, Jesse Eichar wrote:
Hi,
I am copying some files and applying a filter to them. I want the
task to depend on the file that contains the ReplaceTokens so I added
an upToDateWhen closure. But it is ignored. Here is my tasks in my
build.gradle file:
task filtering(type:Copy) {
from file('src/main/filtered-webapp')
into "$buildDir/webapp"
inputs.dir('filters')
def properties = new Properties()
file('filters/global-resource.filter').withReader {
properties.load(it)
}
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens:
properties)
outputs.upToDateWhen { task ->
false
}
}
Is this a bug?
Probably a bug. I'll have a look into it.
Definitely a bug. Could you add a JIRA issue for it?
What's you intention here? Do you really want the copy task to run
regardless of what's changed? Or do you want it to run only when the
source files in 'src/main/filtered-webapp' change or the properties in
'filters/global-resource.filters' change?
You should be able to do this:
task filtering(type:Copy) {
from file('src/main/filtered-webapp')
into "$buildDir/webapp"
def properties = new Properties()
file('filters/global-resource.filter').withReader {
properties.load(it)
}
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens:
properties)
}
And it should just work. However, I haven't quite gotten around to
wiring up the filter() stuff into the up-to-date checking, so Gradle
will currently will ignore changes in the properties when deciding if
the task is up-to-date or not. In the meantime, you can add to the
task { } closure
inputs.properties properties
Actually, this won't work either. It will trigger the same bug as the
upToDateWhen stuff.
--
Adam Murdoch
Gradle Developer
http://www.gradle.org
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email