I have a multi module project and I would like to add a task to the root of the project which can be run by the CI but I also would like to specify the order in which tasks are run.
For instance, first I would like to run the tests for every sub project and when the tests are all OK I would like to run the uploadArchives task on all sub projects. The CI can then execute ‘gradle ci’ and have everything build and uploaded.
I tried adding dependencies (uploadArchives dependsOn test), this causes every sub project to first execute test and the uploadArchives tasks. This means if the test of subproject fails, the archives of all previous sub projects are already uploaded.
Is there a way to tell gradle to only execute uploadArchives on all sub projects after all the tests of the sub projects are successful? I would like to have something generic so I can put it in a plugin and use it for multiple projects.