Does the incremental Java compilation in 4.10 mean that we don't need to clean build CI jobs?


(Barry Coughlan) #1

From the 4.10 release notes:

Incremental Java compilation by default

This release fixes all known issues of the incremental compiler. It now

deletes empty package directories when the last class file is removed
recompiles all classes when module-info files change
recompiles all classes in a package when that package's package-info changes

Its memory usage has also been reduced. For the gradle/gradle build, heap usage dropped from 350MB to just 10MB.

We are now confident that the incremental compiler is ready to be used in every build, so it is now the new default setting.

We currently do a clean build in our CI jobs to ensure we never have leftover Java files in our build directory. Outside of potential bugs in other incremental tasks, does the 4.10 release imply that we no longer need to ‘clean’ our build in CI jobs?


(Stefan Oehme) #2

Gradle will behave correctly whether you do clean or not, assuming that all 3rd party plugins are well-behaved too.

However, you might accumulate unnecessary disk usage over time. For instance, old JARs might still be left in the build folders, although Gradle is no longer using them.