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
diff --git a/Android.bp b/Android.bp
index 3b61d08..0fa5a64 100644
--- a/Android.bp
+++ b/Android.bp
@@ -28,3 +28,17 @@
"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 32d177a..78cb49d 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 d7a89b8..410ce78 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 @@
"guava",
"jsr305",
],
+ sdk_version: "current",
}
diff --git a/core/Android.bp b/core/Android.bp
index ed371b0d..9bfddc4 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 @@
"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 @@
"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 @@
"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 @@
"jsr305",
"guava",
],
+ sdk_version: "current",
}
diff --git a/okhttp/Android.bp b/okhttp/Android.bp
index dd0906d..4e329f2 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 @@
static_libs: [
"okhttp-norepackage",
],
+ sdk_version: "current",
}
diff --git a/protobuf-lite/Android.bp b/protobuf-lite/Android.bp
index a8374f5..f1c4651 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 @@
"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 4a56f7e..af52701 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 @@
"guava",
"jsr305",
],
+ sdk_version: "current",
}