• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "frameworks_native_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_native_license"],
8}
9
10rust_library {
11    name: "libbinder_rs",
12    crate_name: "binder",
13    srcs: ["src/lib.rs"],
14    rustlibs: [
15        "libbinder_ndk_sys",
16        "libdowncast_rs",
17        "liblibc",
18    ],
19    host_supported: true,
20    vendor_available: true,
21    product_available: true,
22    target: {
23        darwin: {
24            enabled: false,
25        },
26    },
27    apex_available: [
28        "//apex_available:platform",
29        "//apex_available:anyapex",
30    ],
31    min_sdk_version: "Tiramisu",
32}
33
34rust_library {
35    name: "libbinder_rs_on_trusty_mock",
36    crate_name: "binder",
37    srcs: ["src/lib.rs"],
38    cfgs: [
39        "trusty",
40    ],
41    rustlibs: [
42        "libbinder_ndk_sys_on_trusty_mock",
43        "libdowncast_rs",
44        "liblibc",
45    ],
46    vendor: true,
47}
48
49rust_library {
50    name: "libbinder_tokio_rs",
51    crate_name: "binder_tokio",
52    srcs: ["binder_tokio/lib.rs"],
53    rustlibs: [
54        "libbinder_rs",
55        "libtokio",
56    ],
57    host_supported: true,
58    vendor_available: true,
59    product_available: true,
60    target: {
61        darwin: {
62            enabled: false,
63        },
64    },
65    apex_available: [
66        "//apex_available:platform",
67        "//apex_available:anyapex",
68    ],
69    min_sdk_version: "Tiramisu",
70}
71
72rust_library {
73    name: "libbinder_ndk_sys",
74    crate_name: "binder_ndk_sys",
75    srcs: [
76        "sys/lib.rs",
77        ":libbinder_ndk_bindgen",
78    ],
79    shared_libs: [
80        "libbinder_ndk",
81    ],
82    host_supported: true,
83    vendor_available: true,
84    product_available: true,
85    target: {
86        darwin: {
87            enabled: false,
88        },
89    },
90    apex_available: [
91        "//apex_available:platform",
92        "//apex_available:anyapex",
93    ],
94    min_sdk_version: "Tiramisu",
95    lints: "none",
96    clippy_lints: "none",
97    visibility: [":__subpackages__"],
98}
99
100rust_library {
101    name: "libbinder_ndk_sys_on_trusty_mock",
102    crate_name: "binder_ndk_sys",
103    srcs: [
104        "sys/lib.rs",
105        ":libbinder_ndk_bindgen_on_trusty_mock",
106    ],
107    cfgs: [
108        "trusty",
109    ],
110    shared_libs: [
111        "libbinder_ndk_on_trusty_mock",
112    ],
113    vendor: true,
114    // Lints are checked separately for libbinder_ndk_sys.
115    // The Trusty mock copy pulls in extra headers that
116    // don't pass the lints for the bindgen output.
117    lints: "none",
118}
119
120rust_bindgen {
121    name: "libbinder_ndk_bindgen",
122    crate_name: "binder_ndk_bindgen",
123    wrapper_src: "sys/BinderBindings.hpp",
124    source_stem: "bindings",
125    bindgen_flag_files: [
126        // Unfortunately the only way to specify the rust_non_exhaustive enum
127        // style for a type is to make it the default
128        // and then specify constified enums for the enums we don't want
129        // rustified
130        "libbinder_ndk_bindgen_flags.txt",
131    ],
132    shared_libs: [
133        "libbinder_ndk",
134    ],
135    host_supported: true,
136    vendor_available: true,
137    product_available: true,
138
139    // Currently necessary for host builds
140    // TODO(b/31559095): bionic on host should define this
141    target: {
142        darwin: {
143            enabled: false,
144        },
145    },
146    apex_available: [
147        "//apex_available:platform",
148        "//apex_available:anyapex",
149    ],
150    min_sdk_version: "Tiramisu",
151}
152
153rust_bindgen {
154    name: "libbinder_ndk_bindgen_on_trusty_mock",
155    crate_name: "binder_ndk_bindgen",
156    wrapper_src: "sys/BinderBindings.hpp",
157    source_stem: "bindings",
158    defaults: [
159        "trusty_mock_defaults",
160    ],
161
162    bindgen_flag_files: [
163        // Unfortunately the only way to specify the rust_non_exhaustive enum
164        // style for a type is to make it the default
165        // and then specify constified enums for the enums we don't want
166        // rustified
167        "libbinder_ndk_bindgen_flags.txt",
168    ],
169    shared_libs: [
170        "libbinder_ndk_on_trusty_mock",
171        "libc++",
172    ],
173}
174
175rust_test {
176    name: "libbinder_rs-internal_test",
177    crate_name: "binder",
178    srcs: ["src/lib.rs"],
179    test_suites: ["general-tests"],
180    auto_gen_config: true,
181    shared_libs: [
182        "libbinder_ndk",
183    ],
184    rustlibs: [
185        "libbinder_ndk_sys",
186        "libdowncast_rs",
187        "liblibc",
188    ],
189}
190
191rust_test {
192    name: "libbinder_ndk_bindgen_test",
193    srcs: [":libbinder_ndk_bindgen"],
194    crate_name: "binder_ndk_bindgen",
195    test_suites: ["general-tests"],
196    auto_gen_config: true,
197    clippy_lints: "none",
198    lints: "none",
199}
200