Hi All,
New to Gradle Plugin development, can’t seem to find the right solution here.
Background:
I’m creating a plugin to support building and aggregating projects, including a ‘manifest’ of all jars produced and subprojects they were produced in. I want to define this task in the plugin itself to minimize the need of plugin users to do task configuration in build scripts (most will be coming from Ant and/Maven and I want to them to buy-in to the change minimizing their initial learning curve).
Problem : I don’t know how to configure a plugin TaskX to depend on completion of all subprojects TaskY. Currently my ‘manifest’ is created on completion of each subproject and almost works through hacky use of static variables, but it’s definitely not the right solution.
Goal : Create a TaskX dependency in the Plugin implementation that runs only after TaskY has completed on all subprojects.
I have established some dependencies using dependsOn like this
void apply(Project target){
...
target.tasks.findByName("myTaskName").dependsOn(project.subprojects.jar)
...
}
and
target.tasks.findByName("myTaskName").dependsOn(["earlierTask1", "earlierTask2"])
Which work fine for most of my tasks. But for this specific task, I want to wait until all subprojects are complete and then just run it once.
I want something like this fictional method:
project.tasks.findByName("TaskX").dependsOnCompletionOfAllSubprojects("TaskY")
I am guessing I completely overlooked something, look forward to the likely “Doh!” moment.
Thanks!