xref: /aosp_15_r20/external/crosvm/base/Android.bp (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1// This file is generated by cargo_embargo.
2// Do not modify this file after the first "rust_*" or "genrule" module
3// because the changes will be overridden on upgrade.
4// Content before the first "rust_*" or "genrule" module is preserved.
5
6package {
7    // See: http://go/android-license-faq
8    // A large-scale-change added 'default_applicable_licenses' to import
9    // all of the 'license_kinds' from "external_crosvm_license"
10    // to get the below license kinds:
11    //   SPDX-license-identifier-BSD
12    default_applicable_licenses: ["external_crosvm_license"],
13}
14
15rust_test {
16    name: "base_test_src_lib",
17    defaults: ["crosvm_inner_defaults"],
18    host_supported: false, // Can't seem to access syslog in TH host tests.
19    crate_name: "base",
20    cargo_env_compat: true,
21    cargo_pkg_version: "0.1.0",
22    crate_root: "src/lib.rs",
23    test_suites: ["general-tests"],
24    auto_gen_config: true,
25    test_options: {
26        unit_test: true,
27    },
28    edition: "2021",
29    rustlibs: [
30        "libaudio_streams",
31        "libcfg_if",
32        "libchrono",
33        "libenv_logger",
34        "liblibc",
35        "liblog_rust",
36        "libonce_cell",
37        "libserde",
38        "libserde_json",
39        "libsmallvec",
40        "libsync_rust",
41        "libtempfile",
42        "libthiserror",
43        "libuuid",
44        "libzerocopy",
45    ],
46    proc_macros: [
47        "libbase_event_token_derive",
48        "libremain",
49    ],
50    target: {
51        android: {
52            rustlibs: ["libandroid_log_sys"],
53        },
54        linux_bionic_arm64: {
55            // For ARM architecture, we use aarch64-linux-android for BOTH
56            // device and host targets. As a result, host targets are also
57            // built with target_os = "android". Therefore, sys_util/src/android
58            // is used and thus this android module is required.
59            // This seems incorrect, but is inevitable because rustc doesn't
60            // yet support a Linux-based target using Bionic as libc. We can't
61            // use aarch64-unknown-linux-gnu because it's using glibc which
62            // we don't support for cross-host builds.
63            rustlibs: [
64                "libandroid_log_sys",
65            ],
66        },
67    },
68    shared_libs: ["libcap"], // specified in src/linux/capabilities.rs
69}
70
71rust_test {
72    name: "base_test_tests_linux_main",
73    defaults: ["crosvm_inner_defaults"],
74    host_supported: false, // Can't seem to access syslog in TH host tests.
75    crate_name: "linux",
76    cargo_env_compat: true,
77    cargo_pkg_version: "0.1.0",
78    crate_root: "tests/linux/main.rs",
79    test_suites: ["general-tests"],
80    auto_gen_config: true,
81    test_options: {
82        unit_test: true,
83    },
84    edition: "2021",
85    rustlibs: [
86        "libaudio_streams",
87        "libbase_rust",
88        "libcfg_if",
89        "libchrono",
90        "libenv_logger",
91        "liblibc",
92        "liblog_rust",
93        "libonce_cell",
94        "libserde",
95        "libserde_json",
96        "libsmallvec",
97        "libsync_rust",
98        "libtempfile",
99        "libthiserror",
100        "libuuid",
101        "libzerocopy",
102    ],
103    proc_macros: [
104        "libbase_event_token_derive",
105        "libremain",
106    ],
107}
108
109rust_test {
110    name: "base_test_tests_syslog",
111    defaults: ["crosvm_inner_defaults"],
112    host_supported: true,
113    crate_name: "syslog",
114    cargo_env_compat: true,
115    cargo_pkg_version: "0.1.0",
116    crate_root: "tests/syslog.rs",
117    test_suites: ["general-tests"],
118    auto_gen_config: true,
119    test_options: {
120        unit_test: true,
121    },
122    edition: "2021",
123    rustlibs: [
124        "libaudio_streams",
125        "libbase_rust",
126        "libcfg_if",
127        "libchrono",
128        "libenv_logger",
129        "liblibc",
130        "liblog_rust",
131        "libonce_cell",
132        "libserde",
133        "libserde_json",
134        "libsmallvec",
135        "libsync_rust",
136        "libtempfile",
137        "libthiserror",
138        "libuuid",
139        "libzerocopy",
140    ],
141    proc_macros: [
142        "libbase_event_token_derive",
143        "libremain",
144    ],
145}
146
147rust_test {
148    name: "base_test_tests_tube",
149    defaults: ["crosvm_inner_defaults"],
150    host_supported: true,
151    crate_name: "tube",
152    cargo_env_compat: true,
153    cargo_pkg_version: "0.1.0",
154    crate_root: "tests/tube.rs",
155    test_suites: ["general-tests"],
156    auto_gen_config: true,
157    test_options: {
158        unit_test: true,
159    },
160    edition: "2021",
161    rustlibs: [
162        "libaudio_streams",
163        "libbase_rust",
164        "libcfg_if",
165        "libchrono",
166        "libenv_logger",
167        "liblibc",
168        "liblog_rust",
169        "libonce_cell",
170        "libserde",
171        "libserde_json",
172        "libsmallvec",
173        "libsync_rust",
174        "libtempfile",
175        "libthiserror",
176        "libuuid",
177        "libzerocopy",
178    ],
179    proc_macros: [
180        "libbase_event_token_derive",
181        "libremain",
182    ],
183    target: {
184        android: {
185            rustlibs: ["libandroid_log_sys"],
186        },
187        linux_bionic_arm64: {
188            // For ARM architecture, we use aarch64-linux-android for BOTH
189            // device and host targets. As a result, host targets are also
190            // built with target_os = "android". Therefore, sys_util/src/android
191            // is used and thus this android module is required.
192            // This seems incorrect, but is inevitable because rustc doesn't
193            // yet support a Linux-based target using Bionic as libc. We can't
194            // use aarch64-unknown-linux-gnu because it's using glibc which
195            // we don't support for cross-host builds.
196            rustlibs: [
197                "libandroid_log_sys",
198            ],
199        },
200    },
201    shared_libs: ["libcap"], // specified in src/linux/capabilities.rs
202}
203
204rust_library {
205    name: "libbase_rust",
206    defaults: ["crosvm_inner_defaults"],
207    host_supported: true,
208    crate_name: "base",
209    cargo_env_compat: true,
210    cargo_pkg_version: "0.1.0",
211    crate_root: "src/lib.rs",
212    edition: "2021",
213    rustlibs: [
214        "libaudio_streams",
215        "libcfg_if",
216        "libchrono",
217        "libenv_logger",
218        "liblibc",
219        "liblog_rust",
220        "libonce_cell",
221        "libserde",
222        "libserde_json",
223        "libsmallvec",
224        "libsync_rust",
225        "libthiserror",
226        "libuuid",
227        "libzerocopy",
228    ],
229    proc_macros: [
230        "libbase_event_token_derive",
231        "libremain",
232    ],
233    target: {
234        android: {
235            rustlibs: ["libandroid_log_sys"],
236        },
237        linux_bionic_arm64: {
238            // For ARM architecture, we use aarch64-linux-android for BOTH
239            // device and host targets. As a result, host targets are also
240            // built with target_os = "android". Therefore, sys_util/src/android
241            // is used and thus this android module is required.
242            // This seems incorrect, but is inevitable because rustc doesn't
243            // yet support a Linux-based target using Bionic as libc. We can't
244            // use aarch64-unknown-linux-gnu because it's using glibc which
245            // we don't support for cross-host builds.
246            rustlibs: [
247                "libandroid_log_sys",
248            ],
249        },
250    },
251    shared_libs: ["libcap"], // specified in src/linux/capabilities.rs
252    visibility: ["//vendor:__subpackages__"],
253}
254