• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    default_applicable_licenses: ["external_crosvm_license"],
8}
9
10// Added automatically by a large-scale-change that took the approach of
11// 'apply every license found to every target'. While this makes sure we respect
12// every license restriction, it may not be entirely correct.
13//
14// e.g. GPL in an MIT project might only apply to the contrib/ directory.
15//
16// Please consider splitting the single license below into multiple licenses,
17// taking care not to lose any license_kind information, and overriding the
18// default license using the 'licenses: [...]' property on targets as needed.
19//
20// For unused files, consider creating a 'fileGroup' with "//visibility:private"
21// to attach the license to, and including a comment whether the files may be
22// used in the current project.
23// See: http://go/android-license-faq
24license {
25    name: "external_crosvm_license",
26    visibility: [":__subpackages__"],
27    license_kinds: [
28        "SPDX-license-identifier-Apache-2.0",
29        "SPDX-license-identifier-BSD",
30        "SPDX-license-identifier-MIT",
31    ],
32    license_text: [
33        "LICENSE",
34    ],
35}
36
37rust_binary {
38    name: "crosvm",
39    defaults: ["crosvm_inner_defaults"],
40    host_supported: true,
41    prefer_rlib: true,
42    crate_name: "crosvm",
43    cargo_env_compat: true,
44    cargo_pkg_version: "0.1.0",
45    srcs: ["src/main.rs"],
46    edition: "2021",
47    features: [
48        "android-sparse",
49        "android_display",
50        "android_display_stub",
51        "audio",
52        "audio_aaudio",
53        "balloon",
54        "config-file",
55        "gdb",
56        "gdbstub",
57        "gdbstub_arch",
58        "geniezone",
59        "gfxstream",
60        "gpu",
61        "gpu_display",
62        "gunyah",
63        "libaaudio_stub",
64        "net",
65        "qcow",
66        "usb",
67        "virgl_renderer",
68    ],
69    rustlibs: [
70        "libacpi_tables",
71        "libandroid_audio",
72        "libanyhow",
73        "libarch",
74        "libargh",
75        "libaudio_streams",
76        "libbase_rust",
77        "libbit_field",
78        "libbroker_ipc",
79        "libcfg_if",
80        "libcros_async",
81        "libcros_tracing",
82        "libcrosvm_cli",
83        "libdevices",
84        "libdisk",
85        "libgdbstub",
86        "libgdbstub_arch",
87        "libhypervisor",
88        "libjail",
89        "libkernel_cmdline",
90        "libkernel_loader",
91        "liblibc",
92        "liblibcras",
93        "liblog_rust",
94        "libmerge",
95        "libmetrics",
96        "libminijail_rust",
97        "libnet_util",
98        "libonce_cell",
99        "libp9",
100        "libresources",
101        "librutabaga_gfx",
102        "libserde",
103        "libserde_json",
104        "libserde_keyvalue",
105        "libsmallvec",
106        "libstatic_assertions",
107        "libswap",
108        "libsync_rust",
109        "libtempfile",
110        "libthiserror",
111        "libuuid",
112        "libvhost",
113        "libvm_control",
114        "libvm_memory",
115        "libzerocopy",
116    ],
117    proc_macros: [
118        "libargh_helpers",
119        "libenumn",
120        "libremain",
121    ],
122    visibility: ["//visibility:public"],
123    arch: {
124        x86_64: {
125            rustlibs: ["libx86_64_rust"],
126        },
127        arm64: {
128            rustlibs: ["libaarch64"],
129        },
130        riscv64: {
131            rustlibs: ["libriscv64"],
132        },
133    },
134    target: {
135        host: {
136            strip: {
137                keep_symbols_and_debug_frame: true,
138            },
139        },
140        android: {
141            shared_libs: [
142                // TODO(b/332677108): remove libc++ when display service is rewritten in rust.
143                "libc++",
144                "libbinder_ndk",
145                "libnativewindow",
146                "libprocessgroup",
147            ],
148        },
149        host_linux: {
150            shared_libs: [
151                "libprocessgroup",
152            ],
153        },
154        linux_bionic_arm64: {
155            relative_install_path: "aarch64-linux-bionic",
156        },
157        linux_glibc_x86_64: {
158            relative_install_path: "x86_64-linux-gnu",
159        },
160        linux_musl_x86_64: {
161            relative_install_path: "x86_64-linux-musl",
162        },
163        linux_musl_arm64: {
164            relative_install_path: "aarch64-linux-musl",
165        },
166    },
167    ld_flags: [
168        "-Wl,--rpath,\\$$ORIGIN",
169        "-Wl,--rpath,\\$$ORIGIN/../../lib64",
170    ],
171
172}
173
174rust_test {
175    name: "crosvm_test_src_main",
176    defaults: ["crosvm_inner_defaults"],
177    host_supported: true,
178    crate_name: "crosvm",
179    cargo_env_compat: true,
180    cargo_pkg_version: "0.1.0",
181    srcs: ["src/main.rs"],
182    test_suites: ["general-tests"],
183    auto_gen_config: true,
184    test_options: {
185        unit_test: false,
186    },
187    edition: "2021",
188    features: [
189        "android-sparse",
190        "android_display",
191        "android_display_stub",
192        "audio",
193        "audio_aaudio",
194        "balloon",
195        "config-file",
196        "gdb",
197        "gdbstub",
198        "gdbstub_arch",
199        "geniezone",
200        "gfxstream",
201        "gpu",
202        "gpu_display",
203        "gunyah",
204        "libaaudio_stub",
205        "net",
206        "qcow",
207        "usb",
208        "virgl_renderer",
209    ],
210    rustlibs: [
211        "libacpi_tables",
212        "libandroid_audio",
213        "libanyhow",
214        "libarch",
215        "libargh",
216        "libaudio_streams",
217        "libbase_rust",
218        "libbit_field",
219        "libbroker_ipc",
220        "libcfg_if",
221        "libcros_async",
222        "libcros_tracing",
223        "libcrosvm_cli",
224        "libdevices",
225        "libdisk",
226        "libgdbstub",
227        "libgdbstub_arch",
228        "libhypervisor",
229        "libjail",
230        "libkernel_cmdline",
231        "libkernel_loader",
232        "liblibc",
233        "liblibcras",
234        "liblog_rust",
235        "libmerge",
236        "libmetrics",
237        "libminijail_rust",
238        "libnet_util",
239        "libonce_cell",
240        "libp9",
241        "librand",
242        "libresources",
243        "librutabaga_gfx",
244        "libserde",
245        "libserde_json",
246        "libserde_keyvalue",
247        "libsmallvec",
248        "libstatic_assertions",
249        "libswap",
250        "libsync_rust",
251        "libtempfile",
252        "libthiserror",
253        "libuuid",
254        "libvhost",
255        "libvm_control",
256        "libvm_memory",
257        "libzerocopy",
258    ],
259    proc_macros: [
260        "libargh_helpers",
261        "libenumn",
262        "libremain",
263    ],
264    arch: {
265        x86_64: {
266            rustlibs: ["libx86_64_rust"],
267        },
268        arm64: {
269            rustlibs: ["libaarch64"],
270        },
271        riscv64: {
272            rustlibs: ["libriscv64"],
273        },
274    },
275    target: {
276        host: {
277            strip: {
278                keep_symbols_and_debug_frame: true,
279            },
280        },
281        android: {
282            shared_libs: [
283                "libprocessgroup",
284            ],
285        },
286        host_linux: {
287            shared_libs: [
288                "libprocessgroup",
289            ],
290        },
291    },
292    ld_flags: [
293        "-Wl,--rpath,\\$$ORIGIN",
294        "-Wl,--rpath,\\$$ORIGIN/../../lib64",
295    ],
296
297}
298
299rust_defaults {
300    name: "crosvm_defaults",
301    edition: "2018",
302    enabled: false,
303    target: {
304        linux_glibc_x86_64: {
305            enabled: true,
306        },
307        linux_musl_x86_64: {
308            enabled: true,
309        },
310        android64: {
311            compile_multilib: "64",
312            enabled: true,
313        },
314        linux_bionic_arm64: {
315            enabled: true,
316        },
317        linux_musl_arm64: {
318            enabled: true,
319        },
320        darwin: {
321            enabled: false,
322        },
323    },
324    apex_available: [
325        "com.android.virt",
326    ],
327    defaults_visibility: [
328        "//external/crosvm:__subpackages__",
329        "//packages/modules/Virtualization/authfs",
330        // For QCOM's crosvm fork.
331        "//vendor:__subpackages__",
332    ],
333}
334
335// "crosvm_defaults" is being used outside of external/crosvm, so we need a
336// layer of indirection to add options that would break those users.
337//
338// TODO(b/238324526): move others off of "crosvm_defaults"
339rust_defaults {
340    name: "crosvm_inner_defaults",
341    defaults: ["crosvm_defaults"],
342    defaults_visibility: ["//external/crosvm:__subpackages__"],
343    visibility: ["//external/crosvm:__subpackages__"],
344}
345