domino-jackson icon indicating copy to clipboard operation
domino-jackson copied to clipboard

Gradle: ObjectMapperProcessor is not incremental, full recompilation is required

Open natros opened this issue 5 years ago • 2 comments
trafficstars

Is it possible to make the annotation processor incremental?

https://docs.gradle.org/current/userguide/java_plugin.html#sec:incremental_annotation_processing

Right now gradle complains that org.dominokit.jacksonapt.processor.ObjectMapperProcessor is not incremental and a full recompilation is required.

 Task :compileJava
Build cache key for task ':compileJava' is 8832ef9fce86b8122d4f38033a68122b
Task ':compileJava' is not up-to-date because:
  Input property 'stableSources' file /Users/fsousa/Projects/demo/gwt-jackson-demo/src/main/java/pt/ipb/demos/gwt/jackson/client/Main.java has changed.
Created classpath snapshot for incremental compilation in 0.001 secs.
Class dependency analysis for incremental compilation took 0.001 secs.
Full recompilation is required because org.dominokit.jacksonapt.processor.ObjectMapperProcessor is not incremental. Analysis took 0.002 secs.
 Task :compileJava
Build cache key for task ':compileJava' is 8832ef9fce86b8122d4f38033a68122b
Task ':compileJava' is not up-to-date because:
  Input property 'stableSources' file /Users/fsousa/Projects/demo/gwt-jackson-demo/src/main/java/pt/ipb/demos/gwt/jackson/client/Main.java has changed.
Created classpath snapshot for incremental compilation in 0.001 secs.
Class dependency analysis for incremental compilation took 0.001 secs.
Full recompilation is required because org.dominokit.jacksonapt.processor.ObjectMapperProcessor is not incremental. Analysis took 0.002 secs.

Thanks.

natros avatar Feb 21 '20 17:02 natros

I believe, but am not certain, that this process cannot qualify for any incremental mode. It might be possible to be marked as aggregating, but even that could depend on whether or not json beans are actually present as sources (and can be used as originating elements in aggregating) or are elsewhere on the classpath (separate modules, which then need to re-trigger building this module and fully running the processor).

That said, if mapstruct (see https://github.com/mapstruct/mapstruct/issues/1420, https://github.com/mapstruct/mapstruct/pull/1971, https://github.com/mapstruct/mapstruct/issues/1414) is able to support this without caveats, it may be possible.

From the link, I don't see what a processor should do to explicitly opt-out - for example if it uses a compiler task/plugin, how would it say "no, I actually need to re-run if my files change in any way, not just their API"?

niloc132 avatar Feb 21 '20 17:02 niloc132

I don't know the internals of domino-jackson, but google dagger is fully incremental.

There is already an incremental gwt module that supports isolation: https://github.com/gwtproject/gwt-places/blob/master/processor/src/main/java/org/gwtproject/place/processor/PlaceHistoryMapperProcessor.java#L15

When the GWT migration is completed, I suppose there will be many modules that uses the annotation processor and that can make the compile task time consuming.

I think gradle is smart enough to know what needs to be compiled.

natros avatar Feb 21 '20 22:02 natros