Evaluating task inputs after some other task has been executed?


(c2444681) #1
def myInputFilesCollection = files()
task setInputFilesCollection {
    //parse inputfile-paths from some xml file
    //put them into myInputFilesCollection
}
task someOtherTask {
    inputs.files myInputFilesCollection
    outputs.dir someFolder
    //do something
}

I’m trying to write an UP-TO-DATE check for a task, which takes it’s inputs from an .xml file.

I wrote a second task, which parses those inputs from the .xml file and puts their paths into a FileCollection, which I then want to declare as the inputs of my other task.

Problem is, that the inputs are evaluated before the execution phase. This way, my FileCollection is still empty when the inputs for my other task are declared. Is there some workaround for this?


(c2444681) #2

Nevermind, found the solution.

I just had to use the body of setInputFilesCollection on it’s own, without putting it in a task… You can mark this one as answered.