blob: dfe020bda4b3c5dccbddd22e55fd20cd92217043 [file] [log] [blame]
Bob Badourc2055fd2021-08-04 13:57:36 -07001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
Andrew Scull5e5f7e12022-01-28 00:01:00 +00005rust_defaults {
6 name: "librustutils_defaults",
7 srcs: ["lib.rs"],
Joel Galensona11c55f2021-07-30 07:36:06 -07008 rustlibs: [
9 "libanyhow",
Joel Galensone1f608a2021-07-30 07:38:37 -070010 "libcutils_bindgen",
Joel Galensona11c55f2021-07-30 07:36:06 -070011 "libsystem_properties_bindgen",
12 "libthiserror",
13 ],
Andrew Scull5e5f7e12022-01-28 00:01:00 +000014}
15
16rust_library {
17 name: "librustutils",
18 crate_name: "rustutils",
19 defaults: ["librustutils_defaults"],
Joel Galensona11c55f2021-07-30 07:36:06 -070020 shared_libs: [
21 "libbase",
22 ],
Jiyong Park50ff5a62021-09-16 21:05:34 +090023 apex_available: [
24 "//apex_available:platform",
Roopa Sattiraju7b73e782021-12-22 16:47:39 -080025 "com.android.bluetooth",
Victor Hsieha201cde2021-10-13 16:57:40 -070026 "com.android.compos",
ziyiw21830172022-03-04 20:32:04 +000027 "com.android.uwb",
Jiyong Park50ff5a62021-09-16 21:05:34 +090028 "com.android.virt",
29 ],
Roopa Sattiraju7b73e782021-12-22 16:47:39 -080030 min_sdk_version: "29",
Joel Galensona11c55f2021-07-30 07:36:06 -070031}
32
Andrew Scull5e5f7e12022-01-28 00:01:00 +000033rust_test {
34 name: "librustutils_test",
35 crate_name: "librustutils_test_test",
36 defaults: ["librustutils_defaults"],
37 test_suites: ["general-tests"],
38 auto_gen_config: true,
39}
40
Joel Galensona11c55f2021-07-30 07:36:06 -070041rust_bindgen {
42 name: "libsystem_properties_bindgen",
43 wrapper_src: "bindgen/system_properties.h",
44 crate_name: "system_properties_bindgen",
45 source_stem: "bindings",
46
47 bindgen_flags: [
48 "--size_t-is-usize",
49 "--allowlist-function=__system_property_find",
Victor Hsiehdde93512022-05-10 15:22:54 -070050 "--allowlist-function=__system_property_foreach",
Joel Galensona11c55f2021-07-30 07:36:06 -070051 "--allowlist-function=__system_property_read_callback",
52 "--allowlist-function=__system_property_set",
53 "--allowlist-function=__system_property_wait",
54 ],
Jiyong Park50ff5a62021-09-16 21:05:34 +090055 apex_available: [
56 "//apex_available:platform",
Roopa Sattiraju7b73e782021-12-22 16:47:39 -080057 "com.android.bluetooth",
Victor Hsieha201cde2021-10-13 16:57:40 -070058 "com.android.compos",
ziyiw21830172022-03-04 20:32:04 +000059 "com.android.uwb",
Jiyong Park50ff5a62021-09-16 21:05:34 +090060 "com.android.virt",
61 ],
Roopa Sattiraju7b73e782021-12-22 16:47:39 -080062 min_sdk_version: "29",
Joel Galensona11c55f2021-07-30 07:36:06 -070063}
Joel Galensone1f608a2021-07-30 07:38:37 -070064
65rust_bindgen {
66 name: "libcutils_bindgen",
67 wrapper_src: "bindgen/cutils.h",
68 crate_name: "cutils_bindgen",
69 source_stem: "bindings",
70 header_libs: ["libcutils_headers"],
71 bindgen_flags: [
72 "--allowlist-var", "AID_KEYSTORE",
Alan Stokes78ad0a82021-11-16 15:16:06 +000073 "--allowlist-var", "AID_ROOT",
74 "--allowlist-var", "AID_SHELL",
75 "--allowlist-var", "AID_SYSTEM",
Joel Galensone1f608a2021-07-30 07:38:37 -070076 "--allowlist-var", "AID_USER_OFFSET",
77 ],
Jiyong Park50ff5a62021-09-16 21:05:34 +090078 apex_available: [
79 "//apex_available:platform",
Roopa Sattiraju7b212322022-02-01 15:29:06 -080080 "com.android.bluetooth",
Victor Hsieha201cde2021-10-13 16:57:40 -070081 "com.android.compos",
ziyiw21830172022-03-04 20:32:04 +000082 "com.android.uwb",
Jiyong Park50ff5a62021-09-16 21:05:34 +090083 "com.android.virt",
84 ],
Roopa Sattiraju7b212322022-02-01 15:29:06 -080085 min_sdk_version: "29",
Joel Galensone1f608a2021-07-30 07:38:37 -070086}
Joel Galenson81539172021-08-20 14:32:10 -070087
88rust_test {
89 name: "libsystem_properties_bindgen_test",
90 srcs: [":libsystem_properties_bindgen"],
91 crate_name: "system_properties_bindgen_test",
92 test_suites: ["general-tests"],
93 auto_gen_config: true,
94 clippy_lints: "none",
95 lints: "none",
96}
97
98rust_test {
99 name: "libcutils_bindgen_test",
100 srcs: [":libcutils_bindgen"],
101 crate_name: "cutils_bindgen_test",
102 test_suites: ["general-tests"],
103 auto_gen_config: true,
104 clippy_lints: "none",
105 lints: "none",
106}
Joel Galenson15b374f2021-11-09 10:39:12 -0800107
108rust_fuzz {
109 name: "system_properties_fuzzer",
110 srcs: ["system_properties_fuzzer.rs"],
111 rustlibs: [
112 "libarbitrary",
113 "librustutils",
114 ],
115 fuzz_config: {
116 fuzz_on_haiku_device: true,
117 fuzz_on_haiku_host: true,
118 },
119}