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

all: update animalsniffer to Java 7 and add Android 14 #4727

Merged
merged 5 commits into from
Aug 9, 2018

Conversation

ericgribkoff
Copy link
Contributor

No description provided.

dependencies {
compile project(':grpc-context'),
libraries.gson,
libraries.guava,
libraries.errorprone,
libraries.jsr305
libraries.jsr305,
libraries.animalsniffer_annotations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compileOnly. The annotation is Retention(Class)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compileOnly triggers a Proguard warning (=> fails the Android build):

Warning: io.grpc.internal.JndiResourceResolverFactory$JndiResourceResolver: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

I think JndiResourceResolverFactory should actually be stripped out by proguard, so adding a proguard -dontwarn is probably all that's necessary - but this would then be required in all downstream apps' proguard configs as well. Will look for a better solution here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a few options here: (fwiw, guava had some similar pain tracked in google/guava#2721)

  1. Keep the dependency as compileOnly, which will require Android apps to add a new -dontwarn to their proguard configs
  2. Bite the cost of making this a compile dependency in open-source. The annotation package is very small (no impact on Android app size/dex count).
  3. Use our own custom annotation (supported by animalsniffer) to avoid the dependency
  4. Drop the annotations altogether and configure animalsniffer to ignore JndiResourceResolverFactory's uses of unsupported APIs

I lean towards option 4. @ejona86 what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(2) sounds appropriate. Let's just add it as a normal dep. Unfortunate, but whatever.

@@ -21,7 +21,8 @@ dependencies {
compileOnly libraries.javax_annotation
testCompile project(':grpc-testing'),
libraries.netty_epoll // for DomainSocketAddress
signature "org.codehaus.mojo.signature:java16:1.1@signature"
signature "org.codehaus.mojo.signature:java17:1.0@signature"
signature "net.sf.androidscents.signature:android-api-level-14:4.0_r4@signature"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No android here. This depends on protobuf full.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@ericgribkoff
Copy link
Contributor Author

@ejona86 Added the dep to the bazel build rules as well (I don't think bazel supports a compileOnly equivalent, based on https://docs.bazel.build/versions/master/be/workspace.html#maven_jar). I will wait for re-approval before merging.

@ejona86
Copy link
Member

ejona86 commented Aug 9, 2018

@ericgribkoff, Bazel can do compileOnly via neverlink=1. #4702 has an example. Unfortunately, the ProGuard integration complains if you include the same dependency via both neverlink=0 and neverlink=1.

@ericgribkoff ericgribkoff merged commit 79b2470 into grpc:master Aug 9, 2018
@ericgribkoff ericgribkoff deleted the android_animal_sniffing branch August 9, 2018 16:09
@lock lock bot locked as resolved and limited conversation to collaborators Nov 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants