My gradle task looks like this
task xml_file_to_vs_build(type: Copy) {
outputs.upToDateWhen { false }
doLast {
outputs.upToDateWhen { false }
println("copying strings.xml");
from 'src/main/res/values'
into '../vso_build'
include 'strings.xml'
}
}
The task is always up to date . If I put the block in the configuration phase i.e. out of doLast, everything works fine. But then the code executed even if I execute gradlew Tasks which I do not want. What am I doing wrong ?
You should define the task in the following way:
task xml_file_to_vs_build(type: Copy) {
println("copying strings.xml")
from 'src/main/res/values'
into '../vso_build'
include 'strings.xml'
}