Hi all,
I’m having a bit of a problem.
In my gradle script, I have some global variables.
One of these variables is used to set the ‘from’ parameter of the copy task,
yet, that parameter is a derived parameter, which is itself set within a task.
The problem seems to be because the copy task is all setup during the configuration phase (including setting the from parameter) before the variable itself is set.
And so, the copy task always reports ‘UP-TO-DATE’ … because there is no valid ‘from’ parameter.
I am probably not thinking about this in the right way, hence the problem in the first place…
I’ll paste my example below… How best to re-write this?
thanks in advance for any help!
sean
Run the script via :
gradle testFinalize -Prelease_output=C:/MyCopyToPath
def testBuildHome
task testCheckArgs() << {
testBuildHome = 'C:/MyWouldBeDerivedFromPath'
}
tasks.add(name: 'testPublishDBUpdate', type: Copy, dependsOn: [testCheckArgs]) {
println "in the creation of the task"
from "${testBuildHome}"
into "${release_output}"
include 'update.jar'
include 'update_*.jar'
}
testPublishDBUpdate.doFirst{
println "attempting to publish db update files...."
}
testPublishDBUpdate.doLast{
println "finished db file update"
}
task testFinalize(dependsOn: [testPublishDBUpdate]) << {
println "in testFinalize"
}