Customizing the up-to-date check in gradle

Hello, I have a large legacy code base that I am building using a series of ant tasks. The ant tasks compile a few packages of java classes at a time to avoid taking up a huge amount of memory. I allocate memory to the ant tasks and control the memory/packages so as to get the desired memory/time taken balance.

But the gradle up-to-date check still gets performed and this takes up a huge amount of memory (GRADLE_OPTS=2G).

Since I cannot tackle the ant compile memory settings (requires code refactoring), I am looking to reduce the GRADLE_OPTS at least. And for that I want to use a different up-to-date check since that is taking a lot of memory. How can I rewrite the up-to-date spec so it is similar to the way ant works?

Gradle’s incremental build and Ant’s incremental compilation are very different things. To turn off the former, you can do ‘tasks.withType(Compile) { outputs.upToDateWhen { false } }’. To enable the latter, see CompileOptions, specifically ‘setUseDepend()’ and ‘getDependOptions()’. Note that ‘useDepend’ needs to be used together with ‘useAnt’.