aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2020-10-15 21:38:22 +0200
committerJeff Vander Stoep <jeffv@google.com>2020-10-15 21:58:34 +0200
commitdbbce4ec9529e125d066a639307be1d38fb15345 (patch)
tree06387a99197895704c1163958f6a8551e9798983
parent761577d44d5d8104fb718fbab47ca87353e75f9f (diff)
downloadgrpcio-dbbce4ec9529e125d066a639307be1d38fb15345.tar.gz
Add Android.bp
Test: build Change-Id: I015ade6b61a68a443c0338d607a8fff83e723142
-rw-r--r--Android.bp76
-rw-r--r--README.android2
-rw-r--r--patches/env.diff16
-rw-r--r--src/channel.rs5
4 files changed, 98 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..fe1f4e4
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,76 @@
+// This file is generated by cargo2android.py --run --device --dependencies.
+
+rust_library {
+ name: "libgrpcio",
+ host_supported: true,
+ crate_name: "grpcio",
+ srcs: ["src/lib.rs"],
+ edition: "2018",
+ features: [
+ "protobuf",
+ "protobuf-codec",
+ ],
+ rustlibs: [
+ "libfutures",
+ "libgrpcio_sys",
+ "liblibc",
+ "liblog_rust",
+ "libparking_lot",
+ "libprotobuf",
+ ],
+}
+
+// dependent_library ["feature_list"]
+// aho-corasick-0.7.13 "default,std"
+// bindgen-0.51.1
+// bitflags-1.2.1 "default"
+// cc-1.0.60
+// cexpr-0.3.6
+// cfg-if-0.1.10
+// clang-sys-0.28.1 "clang_6_0,gte_clang_3_6,gte_clang_3_7,gte_clang_3_8,gte_clang_3_9,gte_clang_4_0,gte_clang_5_0,gte_clang_6_0,libloading,runtime"
+// cmake-0.1.44
+// futures-0.3.5 "alloc,async-await,default,executor,futures-executor,std"
+// futures-channel-0.3.5 "alloc,futures-sink,sink,std"
+// futures-core-0.3.5 "alloc,std"
+// futures-executor-0.3.5 "std"
+// futures-io-0.3.5 "std"
+// futures-macro-0.3.5
+// futures-sink-0.3.5 "alloc,std"
+// futures-task-0.3.5 "alloc,once_cell,std"
+// futures-util-0.3.5 "alloc,async-await,async-await-macro,channel,futures-channel,futures-io,futures-macro,futures-sink,io,memchr,proc-macro-hack,proc-macro-nested,sink,slab,std"
+// glob-0.3.0
+// grpcio-sys-0.6.0 "default"
+// lazy_static-1.4.0
+// libc-0.2.77 "default,std"
+// libloading-0.5.2
+// libz-sys-1.1.2 "default,libc,static,stock-zlib"
+// lock_api-0.3.4
+// log-0.4.11
+// memchr-2.3.3 "default,std,use_std"
+// nom-4.2.3 "alloc,default,std,verbose-errors"
+// once_cell-1.4.1 "std"
+// parking_lot-0.10.2 "default"
+// parking_lot_core-0.7.2
+// peeking_take_while-0.1.2
+// pin-project-0.4.23
+// pin-project-internal-0.4.23
+// pin-utils-0.1.0
+// pkg-config-0.3.18
+// proc-macro-hack-0.5.18
+// proc-macro-nested-0.1.6
+// proc-macro2-1.0.21 "default,proc-macro"
+// protobuf-2.17.0
+// quote-1.0.7 "default,proc-macro"
+// regex-1.3.9 "aho-corasick,default,memchr,perf,perf-cache,perf-dfa,perf-inline,perf-literal,std,thread_local,unicode,unicode-age,unicode-bool,unicode-case,unicode-gencat,unicode-perl,unicode-script,unicode-segment"
+// regex-syntax-0.6.18 "default,unicode,unicode-age,unicode-bool,unicode-case,unicode-gencat,unicode-perl,unicode-script,unicode-segment"
+// rustc-hash-1.1.0 "default,std"
+// same-file-1.0.6
+// scopeguard-1.1.0
+// shlex-0.1.1
+// slab-0.4.2
+// smallvec-1.4.2
+// syn-1.0.41 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut"
+// thread_local-1.0.1
+// unicode-xid-0.2.1 "default"
+// version_check-0.1.5
+// walkdir-2.3.1
diff --git a/README.android b/README.android
new file mode 100644
index 0000000..ef72ffa
--- /dev/null
+++ b/README.android
@@ -0,0 +1,2 @@
+The patch in patches/env.diff needs to be updated with crate version update to match
+the new crate version.
diff --git a/patches/env.diff b/patches/env.diff
new file mode 100644
index 0000000..61c4abb
--- /dev/null
+++ b/patches/env.diff
@@ -0,0 +1,16 @@
+diff --git a/src/channel.rs b/src/channel.rs
+index 7301fcb..13f2a1a 100644
+--- a/src/channel.rs
++++ b/src/channel.rs
+@@ -28,7 +28,10 @@ pub use crate::grpc_sys::{
+
+ /// Ref: http://www.grpc.io/docs/guides/wire.html#user-agents
+ fn format_user_agent_string(agent: &str) -> CString {
+- let version = env!("CARGO_PKG_VERSION");
++ //let version = env!("CARGO_PKG_VERSION");
++ // ANDROID's build system doesn't support environment variables
++ // so we hardcode the package version here.
++ let version = "0.6.0";
+ let trimed_agent = agent.trim();
+ let val = if trimed_agent.is_empty() {
+ format!("grpc-rust/{}", version)
diff --git a/src/channel.rs b/src/channel.rs
index 7301fcb..13f2a1a 100644
--- a/src/channel.rs
+++ b/src/channel.rs
@@ -28,7 +28,10 @@ pub use crate::grpc_sys::{
/// Ref: http://www.grpc.io/docs/guides/wire.html#user-agents
fn format_user_agent_string(agent: &str) -> CString {
- let version = env!("CARGO_PKG_VERSION");
+ //let version = env!("CARGO_PKG_VERSION");
+ // ANDROID's build system doesn't support environment variables
+ // so we hardcode the package version here.
+ let version = "0.6.0";
let trimed_agent = agent.trim();
let val = if trimed_agent.is_empty() {
format!("grpc-rust/{}", version)