Skip to content
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

Add support for incremental annotation processing with Gradle 4.7+ #620

Closed
lucamtudor opened this issue Dec 4, 2018 · 16 comments
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@lucamtudor
Copy link

Gradle 4.7 added support for incremental annotation processing, docs here.

For additional help, follow up with the gradle dedicated issue.

@greenrobot-team
Copy link
Member

greenrobot-team commented Dec 4, 2018

Thanks. Already looked into this a while ago and the issue is that our processor does not really fit either mode. @Entity classes cause generation of multiple files (Entity Info, Cursors), but all entity classes are also aggregated in a single class (MyObjectBox).

In addition, for relations multiple @Entity classes may influence the contents of a generated class. This does not seem to fit "isolating" mode.

The ObjectBox processor also can't use "aggregating" mode because it needs access to parameter names (would require a compiler flag with that mode).

Side note: when using the Android Plugin it is still unclear (last time I checked) how to do incremental annotation processing anyhow.
-ut

@greenrobot-team greenrobot-team added the more info required Further information is requested label Dec 4, 2018
@lucamtudor
Copy link
Author

I'm afraid I can't help, I'm no gradle wizard.

@greenrobot greenrobot added the enhancement New feature or request label Dec 30, 2018
@greenrobot-team
Copy link
Member

News: with Android Gradle Plugin 3.3.0 incremental annotation processor support is available for Java-only projects. But not for Kotlin or mixed Kotlin+Java projects.

Also, there is a note that it does not work with Gradle 5.1 and higher.
https://developer.android.com/studio/releases/gradle-plugin

So: nothing to do here for now.
-ut

@dbriggsDFleet
Copy link

Can this be unblocked with the release of Android Gradle Plugin 3.5.0? "Additionally, KAPT 1.3.30 and higher also support incremental annotation processors, which you can enable by including kapt.incremental.apt=true in your gradle.properties file."
https://developer.android.com/studio/releases/gradle-plugin#3-5-0

@greenrobot-team
Copy link
Member

@dbriggsDFleet Sure, but the biggest, unresolved issues are still those described in #620 (comment).

@jrcacd
Copy link

jrcacd commented Oct 8, 2019

This is a must.
With incremental annotation processing we could do really fast unit testing with objectBox, as we would have to wait a lot less for the project to compile

@greenrobot-team greenrobot-team self-assigned this Nov 19, 2019
@greenrobot-team greenrobot-team removed the more info required Further information is requested label Jan 28, 2020
@greenrobot-team greenrobot-team modified the milestone: 2.5.1 Jan 28, 2020
@greenrobot-team greenrobot-team added this to the 2.5.1 milestone Feb 11, 2020
@greenrobot-team
Copy link
Member

greenrobot-team commented Feb 11, 2020

We just released 2.5.1 which supports incremental annotation processing. It is turned off by default.

To turn it on set objectbox.incremental to true in build.gradle:

android {
    defaultConfig {
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [ "objectbox.incremental" : "true" ]
            }
        }
    }
}

This configuration works for both Android Java and Android Kotlin projects.

We appreciate your feedback on this feature.

If all goes well, incremental annotation processing will be on by default in a future release.

@sebastianharder
Copy link

Great, will try it out asap!

@greenrobot
Copy link
Member

If you see improved build times, we'd be very happy if you could share some numbers from your project (e.g. build times before and after).

@greenrobot-team
Copy link
Member

3.0.0-alpha1 has incremental annotation processing enabled by default.
https://docs.objectbox.io/#v-3-0-0-alpha1-2020-03-09

@greenrobot-team greenrobot-team modified the milestones: 2.5.1, 2.6.0 Apr 28, 2020
@greenrobot-team
Copy link
Member

greenrobot-team commented May 4, 2020

2.6.0-RC has incremental annotation processing enabled by default as well.
https://docs.objectbox.io/#v-2-6-0-rc-2020-04-28

@greenrobot-team
Copy link
Member

With 2.6.0 incremental annotation processing is now enabled by default.
https://docs.objectbox.io/#v-2-6-0-2020-06-09

@emartynov
Copy link

Hi people,

can we make other task incremental?

Screenshot 2020-07-08 at 15 44 48

Sure it is matter of 0 seconds to run. But this always distracting attention when you checking issues with the build.

@greenrobot
Copy link
Member

@emartynov can you please open a new issue for this? Thanks

@greenrobot-team
Copy link
Member

@emartynov Thanks! I guess you did not get around creating an issue for this (couldn't find one)? Anyhow, this is already fixed internally and will ship with the next update.

@emartynov
Copy link

Hi people, you're early starters. You're right I didn't. Thank you for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants