aboutsummaryrefslogtreecommitdiff
path: root/base/Android.bp
blob: 1ed8cb7dae9047b8bb94c5cd8547642b8b3ab102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// This file is generated by cargo_embargo.
// Do not modify this file as most changes will be overridden on upgrade.
// Content before the first "rust_*" or "genrule" module is preserved.

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "external_crosvm_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-BSD
    default_applicable_licenses: ["external_crosvm_license"],
}

rust_test {
    name: "base_test_src_lib",
    defaults: ["crosvm_inner_defaults"],
    host_supported: false, // Can't seem to access syslog in TH host tests.
    crate_name: "base",
    cargo_env_compat: true,
    cargo_pkg_version: "0.1.0",
    srcs: ["src/lib.rs"],
    test_suites: ["general-tests"],
    auto_gen_config: true,
    test_options: {
        unit_test: true,
    },
    edition: "2021",
    rustlibs: [
        "libaudio_streams",
        "libcfg_if",
        "libchrono",
        "libenv_logger",
        "liblibc",
        "liblog_rust",
        "libminijail_rust",
        "libonce_cell",
        "libserde",
        "libserde_json",
        "libsmallvec",
        "libsync_rust",
        "libtempfile",
        "libthiserror",
        "libuuid",
        "libzerocopy",
    ],
    proc_macros: [
        "libbase_event_token_derive",
        "libremain",
    ],
    target: {
        android: {
            rustlibs: ["libandroid_log_sys"],
        },
        linux_bionic_arm64: {
            // For ARM architecture, we use aarch64-linux-android for BOTH
            // device and host targets. As a result, host targets are also
            // built with target_os = "android". Therefore, sys_util/src/android
            // is used and thus this android module is required.
            // This seems incorrect, but is inevitable because rustc doesn't
            // yet support a Linux-based target using Bionic as libc. We can't
            // use aarch64-unknown-linux-gnu because it's using glibc which
            // we don't support for cross-host builds.
            rustlibs: [
                "libandroid_log_sys",
            ],
        },
    },
    shared_libs: ["libcap"], // specified in src/linux/capabilities.rs
}

rust_test {
    name: "base_test_tests_linux_main",
    defaults: ["crosvm_inner_defaults"],
    host_supported: false, // Can't seem to access syslog in TH host tests.
    crate_name: "linux",
    cargo_env_compat: true,
    cargo_pkg_version: "0.1.0",
    srcs: ["tests/linux/main.rs"],
    test_suites: ["general-tests"],
    auto_gen_config: true,
    test_options: {
        unit_test: true,
    },
    edition: "2021",
    rustlibs: [
        "libaudio_streams",
        "libbase_rust",
        "libcfg_if",
        "libchrono",
        "libenv_logger",
        "liblibc",
        "liblog_rust",
        "libminijail_rust",
        "libonce_cell",
        "libserde",
        "libserde_json",
        "libsmallvec",
        "libsync_rust",
        "libtempfile",
        "libthiserror",
        "libuuid",
        "libzerocopy",
    ],
    proc_macros: [
        "libbase_event_token_derive",
        "libremain",
    ],
}

rust_test {
    name: "base_test_tests_syslog",
    defaults: ["crosvm_inner_defaults"],
    host_supported: true,
    crate_name: "syslog",
    cargo_env_compat: true,
    cargo_pkg_version: "0.1.0",
    srcs: ["tests/syslog.rs"],
    test_suites: ["general-tests"],
    auto_gen_config: true,
    test_options: {
        unit_test: true,
    },
    edition: "2021",
    rustlibs: [
        "libaudio_streams",
        "libbase_rust",
        "libcfg_if",
        "libchrono",
        "libenv_logger",
        "liblibc",
        "liblog_rust",
        "libminijail_rust",
        "libonce_cell",
        "libserde",
        "libserde_json",
        "libsmallvec",
        "libsync_rust",
        "libtempfile",
        "libthiserror",
        "libuuid",
        "libzerocopy",
    ],
    proc_macros: [
        "libbase_event_token_derive",
        "libremain",
    ],
}

rust_test {
    name: "base_test_tests_tube",
    defaults: ["crosvm_inner_defaults"],
    host_supported: true,
    crate_name: "tube",
    cargo_env_compat: true,
    cargo_pkg_version: "0.1.0",
    srcs: ["tests/tube.rs"],
    test_suites: ["general-tests"],
    auto_gen_config: true,
    test_options: {
        unit_test: true,
    },
    edition: "2021",
    rustlibs: [
        "libaudio_streams",
        "libbase_rust",
        "libcfg_if",
        "libchrono",
        "libenv_logger",
        "liblibc",
        "liblog_rust",
        "libminijail_rust",
        "libonce_cell",
        "libserde",
        "libserde_json",
        "libsmallvec",
        "libsync_rust",
        "libtempfile",
        "libthiserror",
        "libuuid",
        "libzerocopy",
    ],
    proc_macros: [
        "libbase_event_token_derive",
        "libremain",
    ],
    target: {
        android: {
            rustlibs: ["libandroid_log_sys"],
        },
        linux_bionic_arm64: {
            // For ARM architecture, we use aarch64-linux-android for BOTH
            // device and host targets. As a result, host targets are also
            // built with target_os = "android". Therefore, sys_util/src/android
            // is used and thus this android module is required.
            // This seems incorrect, but is inevitable because rustc doesn't
            // yet support a Linux-based target using Bionic as libc. We can't
            // use aarch64-unknown-linux-gnu because it's using glibc which
            // we don't support for cross-host builds.
            rustlibs: [
                "libandroid_log_sys",
            ],
        },
    },
    shared_libs: ["libcap"], // specified in src/linux/capabilities.rs
}

rust_library {
    name: "libbase_rust",
    defaults: ["crosvm_inner_defaults"],
    host_supported: true,
    crate_name: "base",
    cargo_env_compat: true,
    cargo_pkg_version: "0.1.0",
    srcs: ["src/lib.rs"],
    edition: "2021",
    rustlibs: [
        "libaudio_streams",
        "libcfg_if",
        "libchrono",
        "libenv_logger",
        "liblibc",
        "liblog_rust",
        "libminijail_rust",
        "libonce_cell",
        "libserde",
        "libserde_json",
        "libsmallvec",
        "libsync_rust",
        "libtempfile",
        "libthiserror",
        "libuuid",
        "libzerocopy",
    ],
    proc_macros: [
        "libbase_event_token_derive",
        "libremain",
    ],
    target: {
        android: {
            rustlibs: ["libandroid_log_sys"],
        },
        linux_bionic_arm64: {
            // For ARM architecture, we use aarch64-linux-android for BOTH
            // device and host targets. As a result, host targets are also
            // built with target_os = "android". Therefore, sys_util/src/android
            // is used and thus this android module is required.
            // This seems incorrect, but is inevitable because rustc doesn't
            // yet support a Linux-based target using Bionic as libc. We can't
            // use aarch64-unknown-linux-gnu because it's using glibc which
            // we don't support for cross-host builds.
            rustlibs: [
                "libandroid_log_sys",
            ],
        },
    },
    shared_libs: ["libcap"], // specified in src/linux/capabilities.rs
    visibility: [
        "//packages/modules/Virtualization/virtualizationmanager",
        "//vendor:__subpackages__",
    ],
}