Skip to content

Support for incremental compilation #10

@pbzdyl

Description

@pbzdyl

Currently Clojure compile and test compile tasks don't support incremental compilation.

We run builds in separated steps (e.g. gradle -x check build followed by gradle check in the same directory) and Clojure source files are recompiled unnecessarily.

It would be great if they at least supported a simple mode: no recompilation when no source files have been changed otherwise perform full compilation.

I tried to create a following method in ClojureCompiler class (and remove @TaskAction from the existing one):

@TaskAction
fun compile(inputs: IncrementalTaskInputs) {
  compile()
}

When there are no input files changed, Gradle won't call compile(IncrementalTaskInputs) at all (and will print UP-TO-DATE after the task name in the console; I have verified it with a simple task written in Groovy). Unfortunately, the way Clojure compile and test compile tasks are constructed and configured makes Gradle to treat files in build/classes/main as input files and as they are always newer than the last build Gradle invokes compile(IncrementalTasksInputs) with those files reported as outdated. (Source files were correctly detected as unmodified.) I was unable to find a way to fix this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions