gradle-release icon indicating copy to clipboard operation
gradle-release copied to clipboard

Some task dependencies are missing

Open Vampire opened this issue 6 years ago • 0 comments

You solely use mustRunAfter between your lifecycle tasks like checkCommitNeeded and so on. The only reason to use mustRunAfter instead of dependsOn is, if the "depending" task is actually independently runnable without needing work the other task did first.

This is nice e. g. to be able to just run the unSnapshotVersion task or just the createReleaseTag task, without needing to disable or exclude the other tasks downward.

Unfortunately it is not correct to only use the ordering constraint, for some tasks you really want a hard dependency.

For example if you try to only run createReleaseTag, you get the error Cannot invoke method createReleaseTag() on null object, as scmAdapter is not initialized, so here you miss a project.tasks.createReleaseTag.dependsOn project.tasks.initScmAdapter.

If you then try to run initScmAdapter createReleaseTag, you get the error Cannot invoke method init() on null object, as still the scmAdapter is not initialized (actually not set), so additionally you miss project.tasks.initScmAdapter.dependsOn project.tasks.createScmAdapter.

createScmAdapter initScmAdapter createReleaseTag finally works, but shouldn't be necessary. And if the tasks are not meant to be run stand-alone, they should all use dependsOn instead of mustRunAfter, but actually I like that you can use the higher-level tasks (createScmAdapter vs. initScmAdapter or createReleaseTag) stand-alone.

Vampire avatar May 02 '18 17:05 Vampire