java_grpc_library: Add support for protobuf lite#4289
Conversation
|
CC @codesuki |
|
Thanks! That looks good. You didn't even need to add a new rule. I will give it a spin when I am back from vacation. |
|
I am on mobile and didn't dig any deeper, let me ask a stupid question. Why does the 'protobuf-lite' rule even need the full protobuf in the default case. I am not saying it's not correct just thinking it's unintuitive :) |
|
@codesuki, so... Lite is a subset of full proto. Or rather, it was a subset before the fork. The fork should be temporary, but it will be with us a while longer. grcp-protobuf-lite uses only the subset of full proto supported by lite. But it can work with both full and lite protobufs. grpc-protobuf actually depends on grpc-protobuf-lite. However, since Lite is a fork now, it's dangerous to depend on both full and lite protobuf as you'll get conflicts in the classpath. Thus we have to select which version we want. |
|
Oh, and since it is dangerous to mix lite and full protobuf, I am sort of imposing the solution we have done internally: use lite if and only if on Android. |
|
|
||
| # This config is not fully-reliable. If it breaks, it is probably because you | ||
| # are changing --android_crosstool_top. Instead of doing that, you can bind | ||
| # your own toolchain on top of the default android/closstool, as mentioned at |
ericgribkoff
left a comment
There was a problem hiding this comment.
LGTM.
Coverage for this on Kokoro is blocked by getting the Android examples building with bazel, right? I manually built protobuf-lite with --crosstool_top=//external:android/crosstool which I think demonstrates that this works - is this or another similar command appropriate to add to the bazel build script as a measure?
|
Coverage is blocked by getting a
It shows that grpc-protobuf-lite can be built against protobuf-lite (which we already do with gradle). It doesn't show the rest of the stuff works. And it doesn't show that the |
gRPC's protobuf-lite auto-selects between full and lite protobuf based on the value of crosstool_top. If the user is specifying their own --android_crosstool_top, then it will not auto-detect correctly. One day, platforms will fix problems like this, but for the moment it seems we get to live with it.
gRPC's protobuf-lite auto-selects between full and lite protobuf based on the
value of crosstool_top. If the user is specifying their own
--android_crosstool_top, then it will not auto-detect correctly. One day,
platforms will fix problems like this, but for the moment it seems we get to
live with it.
This includes #4288 as the first commit.
Note: I would have added a BUILD for the helloworld Android app, but ran
into unrelated problems ("cannot access TaskStackBuilder").