• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This file is generated by cargo2android.py --config cargo2android.json.
2// Do not modify this file as changes will be overridden on upgrade.
3
4package {
5    default_applicable_licenses: ["external_rust_crates_grpcio-sys_license"],
6}
7
8// Added automatically by a large-scale-change that took the approach of
9// 'apply every license found to every target'. While this makes sure we respect
10// every license restriction, it may not be entirely correct.
11//
12// e.g. GPL in an MIT project might only apply to the contrib/ directory.
13//
14// Please consider splitting the single license below into multiple licenses,
15// taking care not to lose any license_kind information, and overriding the
16// default license using the 'licenses: [...]' property on targets as needed.
17//
18// For unused files, consider creating a 'fileGroup' with "//visibility:private"
19// to attach the license to, and including a comment whether the files may be
20// used in the current project.
21// See: http://go/android-license-faq
22license {
23    name: "external_rust_crates_grpcio-sys_license",
24    visibility: [":__subpackages__"],
25    license_kinds: [
26        "SPDX-license-identifier-Apache-2.0",
27        "SPDX-license-identifier-BSD",
28        "SPDX-license-identifier-ISC",
29        "SPDX-license-identifier-MIT",
30        "legacy_unencumbered",
31    ],
32    license_text: [
33        "LICENSE",
34    ],
35}
36
37rust_library {
38    name: "libgrpcio_sys",
39    host_supported: true,
40    crate_name: "grpcio_sys",
41    cargo_env_compat: true,
42    srcs: [
43        "src/lib.rs",
44        ":libgrpc_bindgen",
45    ],
46    edition: "2018",
47    features: [
48        "bindgen",
49        "boringssl-src",
50        "default",
51        "secure",
52        "use-bindgen",
53    ],
54    rustlibs: [
55        "liblibc",
56        "liblibz_sys",
57    ],
58    shared_libs: [
59        "libgrpc++",
60        "libgrpc_wrap"
61    ],
62    apex_available: [
63        "//apex_available:platform",
64        "com.android.bluetooth",
65    ],
66    min_sdk_version: "29",
67}
68
69cc_defaults {
70    name: "libgrpcio_sys_defaults",
71    cflags: [
72        "-DGRPC_SYS_SECURE",
73    ],
74    cpp_std: "c++11",
75    shared_libs: ["libgrpc++"],
76    apex_available: [
77        "//apex_available:platform",
78        "com.android.bluetooth",
79    ],
80    min_sdk_version: "29",
81}
82
83cc_library {
84    name: "libgrpc_wrap",
85    defaults: ["libgrpcio_sys_defaults"],
86    host_supported: true,
87    srcs: ["grpc_wrap.cc"],
88}
89
90rust_bindgen {
91    name: "libgrpc_bindgen",
92    defaults: ["libgrpcio_sys_defaults"],
93    host_supported: true,
94    wrapper_src: "android/bindgen_wrapper.hpp",
95    source_stem: "grpc-bindings",
96    crate_name: "grpc_bindgen",
97    bindgen_flags: [
98        "--size_t-is-usize",
99        "--constified-enum-module grpc_status_code",
100        "--default-enum-style rust",
101        "--allowlist-function=\\bgrpc_.*",
102        "--allowlist-function=\\bgpr_.*",
103        "--allowlist-function=\\bgrpcwrap_.*",
104        "--allowlist-var=\\bGRPC_.*",
105        "--allowlist-type=\\bgrpc_.*",
106        "--allowlist-type=\\bgpr_.*",
107        "--allowlist-type=\\bgrpcwrap_.*",
108        "--allowlist-type=\\bcensus_context.*",
109        "--allowlist-type=\\bverify_peer_options.*",
110        "--blocklist-type=(__)?pthread.*",
111        "--blocklist-function=\\bgpr_mu_.*",
112        "--blocklist-function=\\bgpr_cv_.*",
113        "--blocklist-function=\\bgpr_once_.*",
114        "--blocklist-type=gpr_mu",
115        "--blocklist-type=gpr_cv",
116        "--blocklist-type=gpr_once",
117    ],
118    min_sdk_version: "29",
119}
120
121rust_test {
122    name: "libgrpc_bindgen_test",
123    srcs: [":libgrpc_bindgen"],
124    crate_name: "grpc_bindgen_test",
125    test_suites: ["general-tests"],
126    auto_gen_config: true,
127    clippy_lints: "none",
128    lints: "none",
129}
130