Gradle: Help popular annotation processors adopt incremental processing

Created on 5 May 2018  Â·  70Comments  Â·  Source: gradle/gradle

Please submit PRs to update the list of annotation processors that support incremental annotation processing:

https://github.com/gradle/gradle/blob/master/subprojects/docs/src/docs/userguide/java_plugin.adoc#state-of-support-in-popular-annotation-processors

chore member jvm-ecosystem

Most helpful comment

Kotlin 1.3.30 will support incremental annotation processing with kapt! https://youtrack.jetbrains.com/issue/KT-23880

It requires opting in with kapt.incremental.apt=true in gradle.properties.

All 70 comments

Toothpick: Open issue

Realm: Open issue

Glide: Open issue

In addition to Room's compiler, mentioned by @TWiStErRob, Lifecycle has a compiler too
https://developer.android.com/topic/libraries/architecture/lifecycle (android.arch.lifecycle:compiler)

LoganSquare: https://github.com/bluelinelabs/LoganSquare
AutoValue extensions: rharter/auto-value-gson#179, rharter/auto-value-parcel#131

Requery: Open issue
Parceler: Open issue

Butterknife is already implemented but we need some feedback for the implementation ;-)

GreenRobot's EventBus: Open issue

@oehme Re Glide:
Linked ticked is Closed
please use https://github.com/bumptech/glide/issues/2983

@oehme Hi -- I am currently having this issue where I want to enabling compile avoidance for my project, but I am using the gradle hibernate ORM plugin with annotations, and it recompiles my entire project everytime (takes 15+ minutes to build) .. wondering if anyone could help me out. I am unsure if the hibernate ORM plugin supports compile avoidance or not, as I couldn't find it in their documentation
found here ... http://docs.jboss.org/hibernate/orm/5.1/userguide/html_single/Hibernate_User_Guide.html#BytecodeEnhancement-enhancement-gradle

Thanks!

I am also interested in where Hibernate is with moving over to an annotation processor jar that will inform the gradle incremental compilation process. I haven't found them on any list of projects that are in the works for patching.

Think they'll accept a community-driven PR over at https://github.com/hibernate/hibernate-orm/pulls
?

@jjlueck-tock @ngattusohw As far as I can see, Hibernate doesn't do annotation processing, but post-processes the classes after compilation. I don't know why that would cause compilation to rerun. A reproducible example project would probably help them. How about you open an issue for them and ask them to improve the situation?

A terminology sidenote: Compile avoidance is a different feature from incremental compilation. Compile avoidance is always on and means that only API changes will lead to recompilation of downstream projects.

I asked Google team about DataBinding support
https://issuetracker.google.com/issues/110061530
Sadly it is planned for 3.3

@tprochazka it can be mitigated by using instant run, except if you <include> more than one databinding layout, then it's triggering https://issuetracker.google.com/issues/79362720

I just noticed this in my build.gradle output... "All input files are considered out-of-date for incremental task ':Web:compileJava'." .. where my build.gradle compileJava looks like this
compileJava {
doFirst {
apply plugin: 'org.hibernate.orm'

    hibernate {
        enhance {
            enableLazyInitialization= true
            enableDirtyTracking = true
            enableAssociationManagement = true
        }
    }
}

}

@oehme Any direction appreciated, thanks

As mentioned before, this is not annotation processing related. Hibernate uses bytecode enhancement. Please file a bug for their plugin.

@oehme okay thank you. Sorry for bothering and thank you for your responsiveness!

EclipseLink: Open Issue

Hi @oehme,
FYI : Lombok 1.16.22 and 1.8.0 fail with Gradle 4.8 in incremental mode : see https://github.com/rzwitserloot/lombok/issues/1716

It seems to be corrected but not released yet.

I see, they were a little too closely coupled to the Filer class hierarchy. The change looks good, much more robust. I pinged them for a release.

@khaidinh Can you please open an issue for immutables that I can reference here?

PermissionsDispatcher: Open issue

@oehme created a second issue for EclipseLink as they are now also on Github.

https://github.com/eclipse-ee4j/eclipselink/issues/211

Should we add Android Room Persistence Library here?

Does kapt support annotation processors that are incremental, or would adding an incremental processor via kapt still result in a full compile?

@simtel12 I don't think KAPT supports it yet, check out this issue, which has been upvoted by the likes of Jake Wharton (or some user with his name):
https://youtrack.jetbrains.com/issue/KT-23880

@matejdro that seems correct, but they haven't had a release since August 7. Maybe we can encourage them to release sooner than later? cc @oehme

Created an issue for auto value extensions: Open issue

What is going on with the Room? I know it says that it is unlikely to get incremental, but unlike every single other item on the list, it does not have an issue open on their issue tracker (at least there is no link in the first post). Instead it just links to the Room docs page.

On Android Developers "What's New With The Android Gradle Plugin" talk, Googlers said they are working on making both Room and Databinding incremental.

https://youtu.be/GlwvVJNWlWg?t=1226

Created an issue for querydsl

com.google.auto.factory.processor.AutoFactoryProcessor in com.google.auto.factory:auto-factory:1.0-beta6 also seems to be non-incremental.

Regarding Hibernate, there are two annotation processors:

  • The Hibernate ORM AP for generating type-safe meta-models (this is unrelated to entity enhancement as dicussed above, but creates literal types for referencing entity properties in a safe way when using the Criteria API)
  • The Hibernate Validator API for checking correct placement of Bean Validation constraints (filed HV-1665 for this)

As for PermissionsDispatcher PR is already merged and ~we're gonna release next week~ is already released(thank you so much for listing!):D
https://github.com/permissions-dispatcher/PermissionsDispatcher/issues/473

@oehme can you please add:

we just released it and we are very proud to have added incremental annotation support. Thx for all your work on this.

@oehme i opened a ticket in AndroidAnnotations.

https://github.com/androidannotations/androidannotations/issues/2193

Can you add it to the list?

@oehme I also opened a ticket in DBFlow

https://github.com/agrosner/DBFlow/issues/1648

Can you add it to the list as well? :)

It looks like the youtrack issue for kapt is actually not in progress at all. @oehme is there any way to make this happen on their side too ?

Can you replace Dart by Dart and Henson in the list above please ?
And the list would be more readable if it would be sorted lexicographically, if I may.

Kapt is in progress, I know because I'm getting plenty of questions about it. Please stay tuned.

Thx @oehme for the answer and the change to Dart and Henson.

I got another question for you:
The release of android gradle plugin 3.3.0 states that incremental annotation processing is not compatible with gradle 5.1 and higher:
https://developer.android.com/studio/releases/gradle-plugin#new_features
(The first note with a blue star)

What does it mean ? That the support for incremental annotation processing is discontinued from gradle after gradle 5.1 ? Or that the android plugin has to catchup because things changed or that the support will be restored from Gradle. This sentence is a bit scary..

@stephanenicolas they fixed it, if you open #8194, my reading is this:

  • 5.0 incremental
  • 5.1 non-incremental (#8194)
  • 5.1.1 incremental

Hopefully someone from Google can make the note more clear.

Thx !

On Sun., Jan. 20, 2019, 09:12 Róbert Papp (TWiStErRob) <
[email protected] wrote:

@stephanenicolas https://github.com/stephanenicolas they fixed it, if
you open #8194 https://github.com/gradle/gradle/issues/8194, my reading
is this:

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gradle/gradle/issues/5277#issuecomment-455884071, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABv33Yy_ypmzdXv0aB_va0_b75_arlnRks5vFKNygaJpZM4TzwTL
.

AndServer: Open issue

Litho: Open issue

Moxy: Open issue

@oehme we're glad to announce that ToothPick 2 is released with incap support !
https://github.com/stephanenicolas/toothpick/pull/320

@oehme the butterknife PR will probably never get merged. The main author is not very supportive of the idea. So, we had to fork it to enable incremental annotation processing.

We're happy to release butterfork : https://github.com/stephanenicolas/butterknife
Hopefully we can maintain the fork working as new versions of butterknife are released.

@oehme Could you add Auto Service to the list of supported incremental APs (https://github.com/google/auto/pull/667)? And update the status of Data Binding also (https://issuetracker.google.com/110061530#comment28)? :) Thanks!

@oehme Looks like Glide has just become incremental too: https://github.com/bumptech/glide/issues/2983

Let me know when there is a release, so I can link that above :)

Databinding has already a version with experimental support of the incremental compilation
https://issuetracker.google.com/issues/110061530#comment28

Databinding is already checked off above.

Do you have anybody some new information about Room incremental support? It is still valid this ' Unlikely to be incremental in its default mode, as it generates files using java.io'? And it is an explanation from somebody from google team? There is no public issue for it?

Glide 4.9.0 was released with support for incremental AP https://github.com/bumptech/glide/releases/tag/v4.9.0

Kotlin 1.3.30 will support incremental annotation processing with kapt! https://youtrack.jetbrains.com/issue/KT-23880

It requires opting in with kapt.incremental.apt=true in gradle.properties.

Epoxy: Open issue

@oehme, @big-guy: We are working on making Room and Lifecycle incremental. Could you please update the list above and the user guide with links to track this work:

We've moved the table of annotation processors that support incremental annotation processing to our user manual. This'll show up in 5.4 or you can check a nightly.

If you have an update about an annotation processor and want it included in our docs, please submit a PR to update the table found here:
https://github.com/gradle/gradle/blob/master/subprojects/docs/src/docs/userguide/java_plugin.adoc#state-of-support-in-popular-annotation-processors

Please take a look at our contribution guidelines.

Thanks!

@big-guy some of the links in that table 404. For example: https://developer.android.com/topic/libraries/architecture/room)

Thanks @isker - I've fixed it for the next nightly build

@oehme

Hi Stephen, the engineers at airBnb don't use gradle and they have mentioned this is not a priority for them however they have 2 very popular android frameworks that don't support incremental annotation processing. Judging by the comment in epoxy issue its sounds like epoxy could involve a bit of work to support incremental annotation processing however on the other hand the airbnb engineer also mentions that deeplinkDispatch framework might not need any code changes at all. Are you are able to look at the deeplinkDispatch framework and possibly do a PR if it is a very easy fix.

airbnb deeplinkDispatch - https://github.com/airbnb/DeepLinkDispatch/issues/247
airbnb epoxy - https://github.com/airbnb/epoxy/issues/423

Sorry, I won't have time to look into that. Maybe someone else following this thread would be interested in doing so.

@oehme I have started a PR for Micronaut with some changes to support this https://github.com/micronaut-projects/micronaut-core/pull/2071

However I could do with some help to verify the correctness of this change and how it relates to what Micronaut does.

@oehme Just FYI, it looks like Room has added support in version 2.2.0 - hidden behind a flag. The issuetracker ticket has more info.

Room 2.2.0 will be an incremental annotation processing when enabled via the option 'room.incremental = true'

Similar with Lifecycle.

Please submit PRs to update the list of annotation processors that support incremental annotation processing:

https://github.com/gradle/gradle/blob/master/subprojects/docs/src/docs/userguide/java_plugin.adoc#state-of-support-in-popular-annotation-processors

Updated url: https://docs.gradle.org/current/userguide/java_plugin.html#state_of_support_in_popular_annotation_processors

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gocursor picture gocursor  Â·  38Comments

bsideup picture bsideup  Â·  115Comments

lacasseio picture lacasseio  Â·  102Comments

p- picture p-  Â·  36Comments

bmuschko picture bmuschko  Â·  38Comments