aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-04 23:11:54 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-04 23:11:54 +0000
commitb8bffd5103934bcfb96c043d182d02af24eee688 (patch)
tree6ff75f6c9619217311c95c939af05f5f22b69bf9
parentb69ee321f2dd746c57ca47113aa3277a5dff84c7 (diff)
parent21e501d290225560655acc48237ad8f47309903a (diff)
downloadgrpcio-b8bffd5103934bcfb96c043d182d02af24eee688.tar.gz
Snap for 11052692 from 21e501d290225560655acc48237ad8f47309903a to 24Q1-release
Change-Id: I29dafd77e39c780fbd6e8c38ac3e0fbce6a8b45b
-rw-r--r--Android.bp12
-rw-r--r--cargo2android.json6
-rw-r--r--cargo2android_cfgs.bp5
-rw-r--r--patches/lib.rs17
-rw-r--r--src/lib.rs6
5 files changed, 39 insertions, 7 deletions
diff --git a/Android.bp b/Android.bp
index 2fb65f0..8ea87cb 100644
--- a/Android.bp
+++ b/Android.bp
@@ -29,8 +29,8 @@ rust_library {
features: [
"_secure",
"boringssl",
- "protobuf",
- "protobuf-codec",
+ "protobufv3",
+ "protobufv3-codec",
],
rustlibs: [
"libfutures_executor",
@@ -39,11 +39,17 @@ rust_library {
"liblibc",
"liblog_rust",
"libparking_lot",
- "libprotobuf_deprecated",
+ "libprotobuf",
],
apex_available: [
"//apex_available:platform",
],
vendor_available: true,
min_sdk_version: "29",
+ cfgs: [
+ // cfg(soong) is used to distinguish code that only builds on Android, so
+ // that (most of) the same code can be built under both Soong and cargo.
+ "soong",
+ ]
+ ,
}
diff --git a/cargo2android.json b/cargo2android.json
index bc4594d..c908dd9 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -3,12 +3,10 @@
"//apex_available:platform"
],
"device": true,
- "features": "_secure,boringssl,protobuf-codec,protobuf",
+ "features": "_secure,boringssl,protobufv3-codec",
"min-sdk-version": "29",
"run": true,
"vendor-available": true,
"product-available": false,
- "dep-suffixes": {
- "protobuf": "_deprecated"
- }
+ "add-module-block": "cargo2android_cfgs.bp"
}
diff --git a/cargo2android_cfgs.bp b/cargo2android_cfgs.bp
new file mode 100644
index 0000000..328d17d
--- /dev/null
+++ b/cargo2android_cfgs.bp
@@ -0,0 +1,5 @@
+cfgs: [
+ // cfg(soong) is used to distinguish code that only builds on Android, so
+ // that (most of) the same code can be built under both Soong and cargo.
+ "soong",
+]
diff --git a/patches/lib.rs b/patches/lib.rs
new file mode 100644
index 0000000..0a1d2e9
--- /dev/null
+++ b/patches/lib.rs
@@ -0,0 +1,17 @@
+diff --git a/src/lib.rs b/src/lib.rs
+index c8cebca..ba47f95 100644
+--- a/src/lib.rs
++++ b/src/lib.rs
+@@ -29,6 +29,12 @@ use grpcio_sys as grpc_sys;
+ #[macro_use]
+ extern crate log;
+
++// grpcio with feature protobufv3-codec expects a "protobufv3" dependency,
++// but Android.bp is not able to rename dependencies yet. See b/308790322.
++// It is enabled unconditionally since protobufv3-codec also is.
++#[cfg(soong)]
++extern crate protobuf as protobufv3;
++
+ mod buf;
+ mod call;
+ mod channel;
diff --git a/src/lib.rs b/src/lib.rs
index c8cebca..ba47f95 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -29,6 +29,12 @@ use grpcio_sys as grpc_sys;
#[macro_use]
extern crate log;
+// grpcio with feature protobufv3-codec expects a "protobufv3" dependency,
+// but Android.bp is not able to rename dependencies yet. See b/308790322.
+// It is enabled unconditionally since protobufv3-codec also is.
+#[cfg(soong)]
+extern crate protobuf as protobufv3;
+
mod buf;
mod call;
mod channel;