-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support incremental annotation processing #615
Comments
We'd be happy to receive a PR from someone who has tested that this works. Just a couple of cautionary notes:
|
Hi @eamonnmcmanus , you're right
They are different approaches to resolve the second point. A naive approach is simply to crawl up the hierarchy again and re process all annotations in super classes. That would work wonderfully here. |
The supertype processing is just used to determine what methods are inherited by the |
I created a PR ^. It needs a little more testing before merging. Is there a sample somewhere using gradle that we can use to test this? Do you have any edge cases you would like to test? I don't think it's possible to unit / integration (well, gradle uses spock for integration testing of this kind of features. But I am not sure we want to introduce this in auto...) test the incremental compilation due to the current state of incremental compilation in |
I think manual testing would be fine. If you have a project using AutoValue where Gradle always recompiles it before the It should be straightforward to make a simple project using the instructions here. |
I will make one to make sure, but I would be much more confident after that to also add a unit test, just to make sure we still pass the right information to gradle. |
I have released AutoValue 1.6.3rc1 which includes the code from @tbroyer for incremental support. I would appreciate it if someone with more Gradle experience than me could test it. I would also be very happy if someone could add a unit test, as @stephanenicolas suggests. |
Hello - found this issue when looking for incremental support for |
I've tested 1.6.3rc1 and gradle 4.10.2 reports |
@tbroyer ^ |
That actually seems to be a separate bug - though I'm not even sure what those are for. But inspecting the file, I see:
Looks like we need a |
While it might be better to use lowercase, this wouldn't change Gradle behavior, as it But yes, the dynamic value (for Will fix and release v0.2 asap (and will try to add an integration test) |
Version 0.2 published to a staging Maven repository: https://oss.sonatype.org/content/repositories/netltgt-1037, will add the test later. @friedroman if you could test it to make sure it fixes the issue, then I'll release it to Maven Central:
BTW @ronshapiro / @eamonnmcmanus, the dependency is bundled into the auto-value JAR but not shaded:
|
I have tested it and incremental compilation does indeed work correctly. Only I had to change |
I released 0.2 to Central (please note that it's different from the previous 0.2 in staging) and created #678 to update the dependency and correctly shade it. |
…t.ltgt.gradle.incap Related to #615 Closes #678 RELNOTES=Fix incremental annotation processing of `@AutoValue` ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=221799723
…t.ltgt.gradle.incap Related to #615 Closes #678 RELNOTES=Fix incremental annotation processing of `@AutoValue` ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=221799723
Hi everybody. I am using auto-value in Android with Gradle 4.7. After editing an auto-value class and compiling the sources, the incremental build does not fire up I get this message in the info log:
my app module auto dependencies are as follows:
I also use gson auto-value adapter and glide too. |
@bardyamomeni "Dynamic" incremental processors was added in Gradle 4.8: https://docs.gradle.org/4.8/release-notes.html#improved-incremental-annotation-processing Also, auto-value-gson is ready for incremental processing but this hasn't been released yet. And finally, glide is not incremental yet (bumptech/glide#2983), so it wouldn't really help your build to have auto-value be incremental. |
Any updates on this? |
@ReginFell What kind of update are you looking for? AutoValue 1.6.4 (but you'll probably want to use 1.6.5) supports incremental annotation processing (1.6.3 should have, but had a bug). AutoService 1.0-rc5 is said to have support, but actually has a bug (see comment below) AutoFactory will soon have support too (see #708 (comment)) |
@tbroyer I feel like I'm going crazy, but I can't see the incremental.annotation.processors file in the AutoService 1.0-rc5 jar, which correlates with the fact that Gradle reports it as not incremental. |
Oh you're right, AutoService 1.0-rc5 has a bug, already fixed on master but not released yet: cf61cff @ronshapiro Could you maybe do a new release of AutoService? (also possibly update the release notes for AutoService 1.0-rc5 to remove Gradle's incremental processing) |
Done @tbroyer! |
@ronshapiro Could you please make a new AutoFactory release too? |
Guys, what about auto factory? |
AutoFactory 1.0-beta7 was released 24 days ago, presumably with incremental support: https://github.com/google/auto/releases/tag/auto-factory-1.0-beta7. Have you tried that? |
I just tried auto service rc6 and got the following error
|
I also found this comment on the gradle project that seems related: gradle/gradle#9946 (comment) |
Can this issue be closed as complete now? |
verify failed: I just tried auto service rc6 and got the following error Full recompilation is required because '@autoservice' has source retention. Aggregating annotation processors require class or runtime retention. |
Gradle incremental aggregating processors require all processed annotations to have CLASS retention so that the incremental compiler can substitute a class file for a source file if the file is unchanged. With SOURCE retention, Gradle requires a full rebuild. See: #615 https://docs.gradle.org/6.0.1/userguide/java_plugin.html#aggregating_annotation_processors https://github.com/gradle/gradle/blob/v6.0.1/subprojects/language-java/src/main/java/org/gradle/api/internal/tasks/compile/processing/AggregatingProcessingStrategy.java#L49-L56 RELNOTES=`AutoService`: Use `CLASS` retention to support Gradle aggregating incremental annotation processors ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=282380619
Gradle incremental aggregating processors require all processed annotations to have CLASS retention so that the incremental compiler can substitute a class file for a source file if the file is unchanged. With SOURCE retention, Gradle requires a full rebuild. See: #615 https://docs.gradle.org/6.0.1/userguide/java_plugin.html#aggregating_annotation_processors https://github.com/gradle/gradle/blob/v6.0.1/subprojects/language-java/src/main/java/org/gradle/api/internal/tasks/compile/processing/AggregatingProcessingStrategy.java#L49-L56 RELNOTES=`AutoService`: Use `CLASS` retention to support Gradle aggregating incremental annotation processors ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=282380619
*** Reason for rollback *** breaks internal test *** Original change description *** Use CLASS retention for @autoservice Gradle incremental aggregating processors require all processed annotations to have CLASS retention so that the incremental compiler can substitute a class file for a source file if the file is unchanged. With SOURCE retention, Gradle requires a full rebuild. See: #615 https://docs.gradle.org/6.0.1/userguide/java_plugin.html#aggregating_annotation_processors https://github.com/gradle/gradle/blob/v6.0.1/subprojects/langua... *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=282462095
*** Reason for rollback *** breaks internal test *** Original change description *** Use CLASS retention for @autoservice Gradle incremental aggregating processors require all processed annotations to have CLASS retention so that the incremental compiler can substitute a class file for a source file if the file is unchanged. With SOURCE retention, Gradle requires a full rebuild. See: #615 https://docs.gradle.org/6.0.1/userguide/java_plugin.html#aggregating_annotation_processors https://github.com/gradle/gradle/blob/v6.0.1/subprojects/langua... *** ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=282462095
Gradle 4.7 provides support for incremental annotation processing.
https://docs.gradle.org/nightly/userguide/java_plugin.html#sec:incremental_annotation_processing
It would be nice to see auto (at least auto-value) supporting it. The change is not that big as auto value is an isolating AP, and even simpler as it doesn't handle inheritance.
The text was updated successfully, but these errors were encountered: