If a plugin defines a series of tasks, is it possible to inject a dependency into these, such that the dependency is called before the plugin-defined task is executed?
The native-artifacts plugin defines buildNar (and buildNarxxx, where xxx is the platform config) tasks. It also defines extractNarDepsxxx (where xxx is the platform config for the Nar to be built). extractNarDeps is not called before builder, so the build fails as required dependencies are not downloaded prior to the attempted build.
How do I inject extractNarDepsxxx as a dependency into buildNarxxx?
Ok. Consider the following example:
There's a single plugin applied
java
and two custom taskssomeTask
andanotherTask
.Task
build
(taken fromjava
plugin)dependsOn
someTask
. It means that when You rungradle build
this task will be executed.Task
classes
mustRunAfter
anotherTask
. So when You typegradle build anotherTask
,anotherTask
will run beforebuild
.Try it. An ask further questions when needed.