gradleBuild method

Is there a gradleBuild method to match the GradleBuild task? I have a multi-project build A that needs to check for the existence of another multi-project build B. If B exists, go build it and pull in its artifacts.

What I’m trying to do is taskGraph.whenReady and check if we’re calling any compileJava tasks. If so, then we need to build B before any of A’s tasks run.

There’s not a method called ‘gradleBuild’. What specifically are you trying to achieve? When you say “check existence” what does that mean from your perspective? That the ‘build.gradle’ can found? Is the reason that B is not part of A because it “lives” in a different VCS repository?

Thanks for your reply. Yes, these are two large projects in different repositories. A has a copy of the compiled artifacts from B, which is fine for most build tasks. But if a developer were working on code in both projects at the same time, he’d want A’s build to automatically run B’s build and pull in the resulting artifacts.

I have some Gradle code written which checks for the existence of B’s top-level directory. If it exists, and A’s taskGraph includes a compileJava task, then we should go build B as soon as A’s task graph is ready, before any tasks in A are executed. Then it copies build artifacts from B to A. There’s also some logic to clean B if A is being cleaned. The only piece I’m missing is the ability to run another Gradle build without defining a task to do so.

Is there a way to add new tasks onto the beginning of the task graph, from a taskGraph.whenReady closure?

‘taskGraph.whenReady’ is too late to add new tasks or task dependencies.