| diff --git a/Android.bp b/Android.bp |
| index 45707bc..d0369e6 100644 |
| --- a/Android.bp |
| +++ b/Android.bp |
| @@ -40,7 +40,10 @@ |
| host_supported: true, |
| crate_name: "grpcio_sys", |
| cargo_env_compat: true, |
| - srcs: ["src/lib.rs"], |
| + srcs: [ |
| + "src/lib.rs", |
| + ":libgrpc_bindgen", |
| + ], |
| edition: "2018", |
| features: [ |
| "bindgen", |
| @@ -55,52 +55,75 @@ |
| "liblibc", |
| "liblibz_sys", |
| ], |
| - static_libs: [ |
| - "libabsl_bad_optional_access", |
| - "libabsl_bad_variant_access", |
| - "libabsl_base", |
| - "libabsl_city", |
| - "libabsl_civil_time", |
| - "libabsl_cord", |
| - "libabsl_debugging_internal", |
| - "libabsl_demangle_internal", |
| - "libabsl_exponential_biased", |
| - "libabsl_graphcycles_internal", |
| - "libabsl_hash", |
| - "libabsl_hashtablez_sampler", |
| - "libabsl_int128", |
| - "libabsl_log_severity", |
| - "libabsl_malloc_internal", |
| - "libabsl_raw_hash_set", |
| - "libabsl_raw_logging_internal", |
| - "libabsl_spinlock_wait", |
| - "libabsl_stacktrace", |
| - "libabsl_status", |
| - "libabsl_statusor", |
| - "libabsl_str_format_internal", |
| - "libabsl_strings", |
| - "libabsl_strings_internal", |
| - "libabsl_symbolize", |
| - "libabsl_synchronization", |
| - "libabsl_throw_delegate", |
| - "libabsl_time", |
| - "libabsl_time_zone", |
| - "libabsl_wyhash", |
| - "libaddress_sorting", |
| - "libcares", |
| - "libcrypto", |
| - "libgpr", |
| - "libgrpc", |
| - "libgrpc_wrap", |
| - "libre2", |
| - "libssl", |
| - "libupb", |
| - "libz", |
| + shared_libs: [ |
| + "libgrpc++", |
| + "libgrpc_wrap" |
| ], |
| - shared_libs: ["libstdc++"], |
| apex_available: [ |
| "//apex_available:platform", |
| "com.android.btservices", |
| ], |
| min_sdk_version: "29", |
| } |
| + |
| +cc_defaults { |
| + name: "libgrpcio_sys_defaults", |
| + cflags: [ |
| + "-DGRPC_SYS_SECURE", |
| + ], |
| + cpp_std: "c++11", |
| + shared_libs: ["libgrpc++"], |
| + apex_available: [ |
| + "//apex_available:platform", |
| + "com.android.btservices", |
| + ], |
| + min_sdk_version: "29", |
| +} |
| + |
| +cc_library { |
| + name: "libgrpc_wrap", |
| + defaults: ["libgrpcio_sys_defaults"], |
| + host_supported: true, |
| + srcs: ["grpc_wrap.cc"], |
| +} |
| + |
| +rust_bindgen { |
| + name: "libgrpc_bindgen", |
| + defaults: ["libgrpcio_sys_defaults"], |
| + host_supported: true, |
| + wrapper_src: "android/bindgen_wrapper.hpp", |
| + source_stem: "grpc-bindings", |
| + crate_name: "grpc_bindgen", |
| + bindgen_flags: [ |
| + "--size_t-is-usize", |
| + "--constified-enum-module grpc_status_code", |
| + "--default-enum-style rust", |
| + "--allowlist-function=\\bgrpc_.*", |
| + "--allowlist-function=\\bgpr_.*", |
| + "--allowlist-function=\\bgrpcwrap_.*", |
| + "--allowlist-var=\\bGRPC_.*", |
| + "--allowlist-type=\\bgrpc_.*", |
| + "--allowlist-type=\\bgpr_.*", |
| + "--allowlist-type=\\bgrpcwrap_.*", |
| + "--allowlist-type=\\bcensus_context.*", |
| + "--allowlist-type=\\bverify_peer_options.*", |
| + "--blocklist-type=(__)?pthread.*", |
| + "--blocklist-function=\\bgpr_mu_.*", |
| + "--blocklist-function=\\bgpr_cv_.*", |
| + "--blocklist-function=\\bgpr_once_.*", |
| + "--blocklist-type=gpr_mu", |
| + "--blocklist-type=gpr_cv", |
| + "--blocklist-type=gpr_once", |
| + ], |
| + min_sdk_version: "29", |
| +} |
| + |
| +rust_test { |
| + name: "libgrpc_bindgen_test", |
| + srcs: [":libgrpc_bindgen"], |
| + crate_name: "grpc_bindgen_test", |
| + test_suites: ["general-tests"], |
| + auto_gen_config: true, |
| + clippy_lints: "none", |
| + lints: "none", |
| +} |