diff options
author | Eric Anderson <ejona@google.com> | 2016-07-29 11:57:41 -0700 |
---|---|---|
committer | Eric Anderson <ejona@google.com> | 2016-08-01 15:51:11 -0700 |
commit | a8700a7837d450a410e8705fcf75c01e4c80a4eb (patch) | |
tree | c4e2a65a2aeddaf92b4ef3f068772fe873f70a2b /protobuf-lite | |
parent | 21b4ce70eaac75aa06c6451d4efbdbb7fb4e00c4 (diff) | |
download | grpc-grpc-java-a8700a7837d450a410e8705fcf75c01e4c80a4eb.tar.gz |
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.
Diffstat (limited to 'protobuf-lite')
-rw-r--r-- | protobuf-lite/build.gradle | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/protobuf-lite/build.gradle b/protobuf-lite/build.gradle index 1425a3bb8..7e3058b4e 100644 --- a/protobuf-lite/build.gradle +++ b/protobuf-lite/build.gradle @@ -1,13 +1,61 @@ +buildscript { + repositories { + mavenCentral() + mavenLocal() + } + dependencies { + classpath libraries.protobuf_plugin + } +} + plugins { id "be.insaneprogramming.gradle.animalsniffer" version "1.4.0" } +apply plugin: 'com.google.protobuf' + description = 'gRPC: Protobuf Lite' dependencies { compile project(':grpc-core'), - libraries.protobuf, + libraries.protobuf_lite, libraries.guava + + testProtobuf libraries.protobuf +} + +compileTestJava { + // Protobuf-generated Lite produces quite a few warnings. + options.compilerArgs += ["-Xlint:-rawtypes", "-Xlint:-unchecked", "-Xlint:-fallthrough"] +} + +protobuf { + protoc { + if (project.hasProperty('protoc')) { + path = project.protoc + } else { + artifact = "com.google.protobuf:protoc:${protobufVersion}" + } + } + plugins { + javalite { + if (project.hasProperty('protoc-gen-javalite')) { + path = project['protoc-gen-javalite'] + } else { + artifact = "com.google.protobuf:protoc-gen-javalite:${protobufVersion}" + } + } + } + generateProtoTasks { + ofSourceSet('test')*.each { task -> + task.builtins { + remove java + } + task.plugins { + javalite {} + } + } + } } animalsniffer { |