I have been slowly converting our projects over from ant to gradle and things have been pretty straight forward so far. When I got to one of our bigger projects (~6000 java files), I quickly realized incremental compile was not the default yet. After enabling with options.incremental = true, my build was still taking forever for basic changes. I’d open up a file, add a few newlines to some pojo and rebuild. Running with --info was showing 3000+ files required to recompile. Surely I thought there was a bug in one of the source generation tasks, re-writing files each time, but was not the case. I read several posts about how advanced the incremental detection is, ie changing an internal method of a public api or classes containing constants to build the minimum, so I feel like I’m missing something when I add a new line to a getter method, and rebuilds half my project.
Are the incremental compilation improvements only for dependent projects/3rd party dependencies, not intra project? It seems within a project, if I change a source file, it recompiles all other source files that import that class regardless, and continues to recurse till no more dependents found and that becomes the set to recompile. While I appreciate that is the “correct” way of doing it, the basic timestamp detection like ant/make is much faster for most of our uses cases, and we understand the caveats of a potentially broken build.
Am I understanding the incremental detection in gradle properly? and if so, is there a way to change the detection strategy? ie what you currently do vs basic timestamp?