palantir / gradle-processors

Gradle plugin for integrating Java annotation processors
Apache License 2.0
62 stars 23 forks source link

Processors 2.0.0 do not work well with immutables #92

Open maciekf opened 5 years ago

maciekf commented 5 years ago

To upgrade gradle-processors to 2.0.0 I had to add a compile dependency on immutables, otherwise the compilation would fail with warning:

warning: unknown enum constant ImplementationVisibility.PACKAGE reason: class file for org.immutables.value.Value$Style$ImplementationVisibility not found error: warnings found and -Werror specified

Another issue is that after upgrading to 2.0.0 immutable classes which depend on conjure generated classes do not rebuild properly when conjure changes.

j-baker commented 5 years ago

This is the Gradle annotation processors approach. They would have you add the immutables annotations to your classpath (it can/should be compileOnly)

dansanduleac commented 5 years ago

Here's where they introduced this feature: https://docs.gradle.org/4.6/release-notes.html#convenient-declaration-of-annotation-processor-dependencies

They go into it a bit more in the blog post linked there, but the gist is that only annotations (e.g. Value.Immutable) need to be on the compile classpath (and even these can mostly be on compileOnly if they're just @Retention(RetentionPolicy.SOURCE) annotations)

alicederyn commented 5 years ago

Immutables says its annotations are needed in jar files for incremental compilation, but I'm uncertain what issue they're specifically working around or if it's actually necessary. Perhaps file a bug on them to have it looked at again?