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

Create standalone annotations artifact for AutoFactory #631

Open
AngusMorton opened this issue Apr 23, 2018 · 6 comments
Open

Create standalone annotations artifact for AutoFactory #631

AngusMorton opened this issue Apr 23, 2018 · 6 comments

Comments

@AngusMorton
Copy link

This was done for AutoValue (#268) and should also be done for AutoFactory.

@dbarwacz
Copy link

dbarwacz commented Aug 9, 2018

This seems like a trivial issue and triggers most of warnings on our builds, can I offer my help?

@dbarwacz
Copy link

dbarwacz commented Aug 9, 2018

Also, it's a dupe of #632

@filipkowicz
Copy link

This was done for AutoValue (#268) and should also be done for AutoFactory.

it was done with https://github.com/JakeWharton/AutoValueAnnotations - it would be cool to have it here in original Api and it's seems to be quite easy as there is no need of change actual code, just generating and publishing artefacts - hope it will be available soon - especially now when gradle force you to declare annotationProcessors explicitly in gradle config

@tbroyer
Copy link
Contributor

tbroyer commented Nov 23, 2018

@filipkowicz https://github.com/google/auto/releases/tag/auto-value-1.6

Wrt your Grade comment, for auto-service or auto-factory, just declare the same dependency in both api (or compileOnly) and annotationProcessor (the Android Gradle Plugin might have different requirements though). You can also exclude transitive dependencies (or add the dependency on the @jar) for the api/compileOnly configuration.

@filipkowicz
Copy link

@tbroyer it's great but it's for AutoValue - I need same one for AutoFactory.

according to gradle: I'm currently doing it this way but:

  • i need to exclude Guava package added by it (even if it's compileOnly it breaks Dagger file generation because Dagger assume that Guava is in classpath)
  • can't use Kapt (kotlin annotation processor) because if I include AutoFactory with compileOnly it force me to use annotationProcessor instead of kapt

so yes - currently it works but it could be a lot nicer and there is no point of adding classes from annotation processor to classpath during compile

@technoir42
Copy link

technoir42 commented Oct 6, 2019

Wrt your Grade comment, for auto-service or auto-factory, just declare the same dependency in both api (or compileOnly) and annotationProcessor (the Android Gradle Plugin might have different requirements though). You can also exclude transitive dependencies (or add the dependency on the @jar) for the api/compileOnly configuration.

I updated to Android Studio 3.6 Canary 12 and there is a (new?) Lint check called AnnotationProcessorOnCompilePath which complains when I add AutoFactory to compileOnly configuration. I had to disable the check entirely.

dependencies {
    compileOnly("com.google.auto.factory:auto-factory:$versions.autoFactory") {
        transitive = false
    }
    kapt "com.google.auto.factory:auto-factory:$versions.autoFactory"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants