Configure Slow on 400+ Module Project

(gilbode) #1

We’re working on a large multi-module project (400+ modules). Configure takes nearly a minute. This makes doing any short running tasks very painful. We’ve done quite a bit of analysis but still have not fully figured out why configure takes so long. Project has a root project that does a fair amount of configuration injection / apply plugin in subprojects closure, we’ve ensured there is no dependency resolution happening during configure. When running gradle --profile there’s nothing obvious, lion’s share of the time is spent configuring the root project.

The use case that is especially annoying is running gradle build from a submodule that nothing depends on. If we use configuration injection, even configure-on-demand doesn’t do anything for us b/c the root project still takes so long to configure. Only if I take the entire subprojects closure & put it in a separate file and do apply from: ‘subpojects.gradle’ does configure-on-demand make any difference. But that’s unfortunate because configuration injection is quite handy from a coding style perspective.

So a few questions - how can I figure out why configure takes so long? What are the recommended best practices around making configure time tolerable in large multi-module projects?