diff options
author | Karl Shaffer <karlshaffer@google.com> | 2020-11-18 15:04:30 -0500 |
---|---|---|
committer | Karl Shaffer <karlshaffer@google.com> | 2020-11-18 16:13:57 -0500 |
commit | 8e51fde6c2065d6091b0dbd501fdf080f48c769f (patch) | |
tree | 89f5d5958ca0ab30d667070f2c36f1392e9eeab0 | |
parent | 30a843d392f6f6d5e2b599ffb03c5450b9b7372f (diff) | |
download | grpc-grpc-java-8e51fde6c2065d6091b0dbd501fdf080f48c769f.tar.gz |
Add a lite OkHttp gRPC Client Library.
Updates several targets within grpc-grpc-java to allow for Android and Host targets to allow the building of a gRPC client library that uess OkHttp and Protobuf Lite. This provides a lightweight client library for gRPC clients that works on both Android and Host since it uses lite protos rather than full protos.
Test: m grpc-java-okhttp-client-lite
Test: mm
Test: Manual testing using client library on Android.
Change-Id: Ib9dc14a44856914b38662c01905337f98bd8d108
-rw-r--r-- | Android.bp | 14 | ||||
-rw-r--r-- | annotation-stubs/Android.bp | 4 | ||||
-rw-r--r-- | context/Android.bp | 3 | ||||
-rw-r--r-- | core/Android.bp | 27 | ||||
-rw-r--r-- | okhttp/Android.bp | 4 | ||||
-rw-r--r-- | protobuf-lite/Android.bp | 6 | ||||
-rw-r--r-- | stub/Android.bp | 4 |
7 files changed, 52 insertions, 10 deletions
diff --git a/Android.bp b/Android.bp index 3b61d0847..0fa5a64d5 100644 --- a/Android.bp +++ b/Android.bp @@ -28,3 +28,17 @@ java_library_host { "grpc-java-stub", ] } + +java_library { + name: "grpc-java-okhttp-client-lite", + host_supported: true, + static_libs: [ + "grpc-java-stub", + "grpc-java-context", + "grpc-java-core", + "grpc-java-core-internal", + "grpc-java-protobuf-lite", + "grpc-java-okhttp", + ], + sdk_version: "current", +}
\ No newline at end of file diff --git a/annotation-stubs/Android.bp b/annotation-stubs/Android.bp index 32d177a81..78cb49daa 100644 --- a/annotation-stubs/Android.bp +++ b/annotation-stubs/Android.bp @@ -13,11 +13,13 @@ // limitations under the License. // -java_library_host { +java_library { name: "grpc-java-annotation-stubs", + host_supported: true, srcs: [ ":grpc-java-annotation-stubs-srcjar", ], + sdk_version: "current", } gensrcs { diff --git a/context/Android.bp b/context/Android.bp index d7a89b819..410ce78c4 100644 --- a/context/Android.bp +++ b/context/Android.bp @@ -14,7 +14,7 @@ // // -java_library_static { +java_library { name: "grpc-java-context", host_supported: true, srcs: [ @@ -25,4 +25,5 @@ java_library_static { "guava", "jsr305", ], + sdk_version: "current", } diff --git a/core/Android.bp b/core/Android.bp index ed371b0d0..9bfddc42f 100644 --- a/core/Android.bp +++ b/core/Android.bp @@ -13,8 +13,9 @@ // limitations under the License. // -java_library_host { +java_library { name: "grpc-java-core", + host_supported: true, srcs: [ "src/main/java/io/grpc/*.java", ], @@ -26,10 +27,12 @@ java_library_host { "jsr305", "guava", ], + sdk_version: "current", } -java_library_host { +java_library { name: "grpc-java-core-inprocess", + host_supported: true, srcs: [ "src/main/java/io/grpc/inprocess/*.java", ], @@ -40,10 +43,12 @@ java_library_host { "jsr305", "guava", ], + sdk_version: "current", } -java_library_host { +java_library { name: "grpc-java-core-internal", + host_supported: true, srcs: [ "src/main/java/io/grpc/internal/*.java", ], @@ -58,10 +63,23 @@ java_library_host { "opencensus-java-api", "opencensus-java-contrib-grpc-metrics", ], + target: { + + // For the Android variant, ignore this class since it is optional, + // uses javax APIs not available on Android, and is used reflectively + // so ignoring it does not affect the functionality of the library. + android: { + exclude_srcs: [ + "src/main/java/io/grpc/internal/JndiResourceResolverFactory.java", + ], + }, + }, + sdk_version: "current", } -java_library_host { +java_library { name: "grpc-java-core-util", + host_supported: true, srcs: [ "src/main/java/io/grpc/util/*.java", ], @@ -71,4 +89,5 @@ java_library_host { "jsr305", "guava", ], + sdk_version: "current", } diff --git a/okhttp/Android.bp b/okhttp/Android.bp index dd0906d6e..4e329f276 100644 --- a/okhttp/Android.bp +++ b/okhttp/Android.bp @@ -13,8 +13,9 @@ // limitations under the License. // -java_library_host { +java_library { name: "grpc-java-okhttp", + host_supported: true, srcs: [ "third_party/okhttp/main/java/**/*.java", "src/main/java/**/*.java", @@ -31,4 +32,5 @@ java_library_host { static_libs: [ "okhttp-norepackage", ], + sdk_version: "current", } diff --git a/protobuf-lite/Android.bp b/protobuf-lite/Android.bp index a8374f5be..f1c46518b 100644 --- a/protobuf-lite/Android.bp +++ b/protobuf-lite/Android.bp @@ -14,8 +14,9 @@ // // -java_library_host { +java_library { name: "grpc-java-protobuf-lite", + host_supported: true, srcs: [ "src/main/java/**/*.java", ], @@ -23,6 +24,7 @@ java_library_host { "grpc-java-core", "guava", "jsr305", - "libprotobuf-java-full", + "libprotobuf-java-lite", ], + sdk_version: "current", } diff --git a/stub/Android.bp b/stub/Android.bp index 4a56f7eef..af5270121 100644 --- a/stub/Android.bp +++ b/stub/Android.bp @@ -14,8 +14,9 @@ // // -java_library_host { +java_library { name: "grpc-java-stub", + host_supported: true, srcs: [ "src/main/java/**/*.java", ], @@ -25,4 +26,5 @@ java_library_host { "guava", "jsr305", ], + sdk_version: "current", } |