'Gradle aggregate task outputs
How do I pass a task's outputs forward as the outputs of a subsequent task?
I want to dynamically register subtasks in a loop and aggregate them. For example, I want the "assemble" task to include both .tar archives created by "assemble_test" and "assemble_prod".
This works but definitely feels wrong. What am I missing?
plugins {
id "base"
}
["test", "prod"].each { env ->
def task = tasks.register("assemble_${env}", Tar) {
archiveFileName = "output-${env}.tar"
from env
}
assemble.outputs.files(task.get().outputs.files)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
