Multi-project builds with custom subproject build order?

I am a noobie to gradle/groovy so this may be an easy question.

I am porting an existing build system.

I need to create a multi-project gradle build for components consisting of a mixture of technologies and builds (Java, C++ and C#). For example, a component may need to compile a java project before building a C++ JNI component that requires header files produced by the java compiler, or it may consist of a common API/service compiled for each technology.
There are hundreds of components and each is built independently.

I need to create a generic top-level gradle script that drives the build for each component. It will call into existing ant scripts, make and cmake files, or msbuild solutions.

This should be entirely data driven - ideally a configuration file at the root of each component’s repo specifies the subprojects and the dependencies between them. The common gradle script would drive all the subproject builds

A problem I ran into is that by default subprojects are built in alphabetical order - I need to be able to specify the build order.

I prefer to not specify dependencies in each project’s gradle script - this is difficult to manage and maintain across all the components.

What is the best way to do this? Is there any sample code out there that does this?


1 Like

Moved to the Gradle Core forum.


Have you find a way to do custom subproject build with specific order ?