What are the Best Practices for switching to configuration on demand?

Our multi-project build has over 175 projects in it. We immediately had to switch from idiomatic Gradle (allprojects, subprojects in our root project) to a more configuration-on-demand (COD) friendly approach because a simple compile of one project would routinely take 30+ seconds.

As seen in similar posts, the first thing we did was move most common configuration into a gradle/allprojects.gradle scripts and we explicitly apply that scripts in all our projects using “apply from”. It has been pointed out in another post that using beforeProject() would be a better approach for centralizing common build configuration for each project. We will try this and see how it works.

But I was wondering if there was any other advice or best practices for converting an idiomatic multi-project build to play well with COD? More examples and explanation in the user guide would be very helpful. Any insight from the experts would be most appreciated.

COD is a killer feature and we want to make sure we are using it properly so we have a maintainable build for the future. Thanks!

There’s nothing else I can think of that you haven’t already mentioned.

We could definitely use more information in the userguide on this. If you’re up for it, it would be a great contribution if you could get this started by contributing your take on best practices to the user guide based on your experience.

Sure, I am trying to gather something for our org. As soon as I gather more experiences from different folks, I will try to contribute here. I will keep things posted here.