Begin consuming protobuf-lite artifact
Protobuf-lite since beta-4 is now more of a fork than a subset of
protobuf-java, which may cause us problems later since lite API is not
stable. Also, lite-generated code may now depend on APIs only in
protobuf-lite, so our users must depend on the protobuf-lite runtime.
Having all our users explicitly override the dependency is bothersome to
them and can easily only expose problems only after we do a release.
So now we are doing the dependency overriding; most users should "just
work" and pick up the correct protobuf artifact. I've confirmed the
exclusion is listed in the grpc-protobuf pom and "gradle dependencies"
and "mvn dependency:tree" do not include protobuf-lite for the examples.
Vanilla protobuf users are most likely to experience any breakage, which
should detect problems more quickly since we use protobuf-java more
frequently than protobuf-lite during development.
protobuf-lite does not include pre-generated code for the well-known
protos, so users will need to generate them themselves for the moment
(google/protobuf#1889).
Note that today changing deps does not noticeably reduce the method code
for our users, since ProGuard already is stripping most classes. The
difference in output is only a reduction of 3 classes and 6 methods for
the android example.
diff --git a/compiler/build.gradle b/compiler/build.gradle
index 460e116..7e116d4 100644
--- a/compiler/build.gradle
+++ b/compiler/build.gradle
@@ -160,7 +160,11 @@
}
plugins {
javalite {
- artifact = "com.google.protobuf:protoc-gen-javalite:${protobufVersion}"
+ if (project.hasProperty('protoc-gen-javalite')) {
+ path = project['protoc-gen-javalite']
+ } else {
+ artifact = "com.google.protobuf:protoc-gen-javalite:${protobufVersion}"
+ }
}
grpc {
path = javaPluginPath