Bernhard Posselt
07/08/2026, 8:29 AMinputs.file(tasks.named<SimplePrintingTask>("helloWorld").map { messageFile })
do you need that in addition to configuring the inputs of the new task or does gradle figure that out automatically if you use an input file with the same path as the other task's output file?Jendrik Johannes
07/08/2026, 8:37 AMtasks.register("translateGood", SimpleTranslationTask) {
messageFile.set(tasks.named("helloWorld", SimplePrintingTask).flatMap { it.messageFile })
}
Explanation:
• First messageFile is the one from SimpleTranslationTask
• You set that to the messageFile output of SimplePrintingTask, preserving both the information which file you want and which task produces it.
It's also an unfortunate choice to call it messageFile in both example tasks.Bernhard Posselt
07/08/2026, 8:38 AMBernhard Posselt
07/08/2026, 8:40 AMJendrik Johannes
07/08/2026, 8:43 AMflatMap gives you a Provider<RegularFile> that not only points at the path, but also has the information which task produces the file.Vampire
07/08/2026, 8:43 AMVampire
07/08/2026, 8:43 AMVampire
07/08/2026, 8:44 AMThomas Broyer
07/08/2026, 8:44 AMinputs.file() is finer-grained than `dependsOn()`; but this is a bad example anyway. What you should do is indeed configure the input property to the output property of the other task, with a provider value that carries the task dependency.Vampire
07/08/2026, 8:45 AM