1// This file is generated by cargo2android.py --run --device --tests --dependencies --no-subdir.
2// Most modules in this file are edited manually:
3// * global defaults defined in crosvm_defaults, enabled for linux_glibc_x86_64
4//   * all modules use crosvm_defaults or other defaults derived from it
5// * root host binary is crosvm
6// * crosvm and libcrosvm have extra features:
7//   * audio, gfxstream, gpu, virgl_renderer, virgl_renderer_next
8// * crosvm has extra flags and ld_flags
9// * crosvm_host_test_tests_boot and crosvm_host_test_tests_plugins
10//   are not ready yet
11// We use cargo2android.py only to discover new changes.
12//   * Use --no-subdir to suppress output of subdirectory Android.bp files.
13//   * Run cargo2android.py in each subdirectory to generate .bp files.
14
15package {
16    default_applicable_licenses: ["external_crosvm_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32// See: http://go/android-license-faq
33license {
34    name: "external_crosvm_license",
35    visibility: [":__subpackages__"],
36    license_kinds: [
37        "SPDX-license-identifier-Apache-2.0",
38        "SPDX-license-identifier-BSD",
39        "SPDX-license-identifier-MIT",
40    ],
41    license_text: [
42        "LICENSE",
43    ],
44}
45
46rust_defaults {
47    name: "crosvm_defaults",
48    edition: "2018",
49    enabled: false,
50    target: {
51        linux_glibc_x86_64: {
52            enabled: true,
53            flags: [
54                "-L device/google/cuttlefish_vmm/x86_64-linux-gnu/bin/",
55            ],
56        },
57        android64: {
58            compile_multilib: "64",
59            enabled: true,
60        },
61        linux_bionic_arm64: {
62            enabled: true,
63        },
64        darwin: {
65            enabled: false,
66        },
67    },
68    apex_available: [
69        "//apex_available:platform",
70        "com.android.virt",
71    ],
72}
73
74rust_defaults {
75    name: "crosvm_proc_macro_defaults",
76    defaults: ["crosvm_defaults"],
77    target: {
78        darwin: {
79            enabled: true,
80        },
81    },
82}
83
84rust_binary {
85    name: "crosvm",
86    defaults: ["crosvm_defaults"],
87    host_supported: true,
88    prefer_rlib: true,
89    crate_name: "crosvm",
90    srcs: ["src/main.rs"],
91
92    target: {
93        linux_bionic_arm64: {
94            relative_install_path: "aarch64-linux-bionic",
95        },
96        linux_glibc_x86_64: {
97            features: [
98                "gdb",
99                "gdbstub",
100            ],
101            relative_install_path: "x86_64-linux-gnu",
102            rustlibs: [
103                "libgdbstub",
104                "libthiserror",
105            ],
106        },
107        darwin: {
108            enabled: false,
109        },
110    },
111    arch: {
112        x86_64: {
113            rustlibs: ["libx86_64_rust"],
114        },
115        arm64: {
116            rustlibs: ["libaarch64"],
117        },
118    },
119
120    edition: "2018",
121    features: [
122        "audio",
123        "default",
124        "gpu",
125        "gfxstream",
126    ],
127
128    flags: [
129        "-C overflow-checks=y",
130    ],
131    ld_flags: [
132        "-Wl,--rpath,\\$$ORIGIN",
133        "-Wl,--rpath,\\$$ORIGIN/../../lib64",
134    ],
135    rustlibs: [
136        "libacpi_tables",
137        "libarch",
138        "libassertions",
139        "libaudio_streams",
140        "libbase_rust",
141        "libbit_field",
142        "libcrosvm",
143        "libdata_model",
144        "libdevices",
145        "libdisk",
146        "libhypervisor",
147        "libkernel_cmdline",
148        "libkernel_loader",
149        "liblibc",
150        "liblibcras",
151        "libminijail_rust",
152        "libnet_util",
153        "libp9",
154        "librand_ish",
155        "libresources",
156        "librutabaga_gfx",
157        "libsync_rust",
158        "libtempfile",
159        "libvhost",
160        "libvm_control",
161        "libvm_memory",
162    ],
163    proc_macros: [
164        "libenumn",
165        "libremain",
166    ],
167}
168
169rust_defaults {
170    name: "crosvm_defaults_test",
171    defaults: ["crosvm_defaults"],
172    crate_name: "crosvm",
173    srcs: ["src/crosvm.rs"],
174    test_suites: ["general-tests"],
175    auto_gen_config: true,
176    edition: "2018",
177    arch: {
178        x86_64: {
179            rustlibs: ["libx86_64_rust"],
180        },
181        arm64: {
182            rustlibs: ["libaarch64"],
183        },
184    },
185    target: {
186        linux_glibc_x86_64: {
187            features: [
188                "gdb",
189                "gdbstub",
190            ],
191            rustlibs: [
192                "libgdbstub",
193                "libthiserror",
194            ],
195        },
196    },
197    features: [
198        "default",
199    ],
200    rustlibs: [
201        "libacpi_tables",
202        "libarch",
203        "libassertions",
204        "libbase_rust",
205        "libbit_field",
206        "libdata_model",
207        "libdevices",
208        "libdisk",
209        "libhypervisor",
210        "libkernel_cmdline",
211        "libkernel_loader",
212        "liblibc",
213        "libminijail_rust",
214        "libnet_util",
215        "libp9",
216        "librand_ish",
217        "libresources",
218        "librutabaga_gfx",
219        "libsync_rust",
220        "libtempfile",
221        "libvhost",
222        "libvm_control",
223        "libvm_memory",
224    ],
225    proc_macros: [
226        "libenumn",
227        "libremain",
228    ],
229}
230
231rust_test_host {
232    name: "crosvm_host_test_src_crosvm",
233    defaults: ["crosvm_defaults_test"],
234    features: [
235        "audio",
236    ],
237    rustlibs: [
238        "libaudio_streams",
239        "liblibcras",
240    ],
241    test_options: {
242        unit_test: true,
243    },
244}
245
246rust_test {
247    name: "crosvm_device_test_src_crosvm",
248    defaults: ["crosvm_defaults_test"],
249    features: [
250        "audio",
251    ],
252    rustlibs: [
253        "libaudio_streams",
254        "liblibcras",
255    ],
256}
257
258rust_defaults {
259    name: "crosvm_defaults_crosvm",
260    defaults: ["crosvm_defaults"],
261    crate_name: "crosvm",
262    srcs: ["src/main.rs"],
263    test_suites: ["general-tests"],
264    auto_gen_config: true,
265    edition: "2018",
266    arch: {
267        x86_64: {
268            rustlibs: ["libx86_64_rust"],
269        },
270        arm64: {
271            rustlibs: ["libaarch64"],
272        },
273    },
274    features: [
275        "default",
276    ],
277    rustlibs: [
278        "libacpi_tables",
279        "libarch",
280        "libassertions",
281        "libbase_rust",
282        "libbit_field",
283        "libcrosvm",
284        "libdata_model",
285        "libdevices",
286        "libdisk",
287        "libhypervisor",
288        "libkernel_cmdline",
289        "libkernel_loader",
290        "liblibc",
291        "libminijail_rust",
292        "libnet_util",
293        "libp9",
294        "librand_ish",
295        "libresources",
296        "librutabaga_gfx",
297        "libsync_rust",
298        "libtempfile",
299        "libvhost",
300        "libvm_control",
301        "libvm_memory",
302    ],
303    proc_macros: [
304        "libenumn",
305        "libremain",
306    ],
307}
308
309rust_test_host {
310    name: "crosvm_host_test_src_main",
311    defaults: ["crosvm_defaults_crosvm"],
312    features: [
313        "audio",
314    ],
315    rustlibs: [
316        "libaudio_streams",
317        "liblibcras",
318    ],
319    test_options: {
320        unit_test: true,
321    },
322}
323
324rust_test {
325    name: "crosvm_device_test_src_main",
326    defaults: ["crosvm_defaults_crosvm"],
327}
328
329rust_library {
330    name: "libcrosvm",
331    defaults: ["crosvm_defaults"],
332    host_supported: true,
333    crate_name: "crosvm",
334    srcs: ["src/crosvm.rs"],
335    edition: "2018",
336    target: {
337        linux_glibc: {
338            features: [
339                "gfxstream",
340            ],
341        },
342        linux_glibc_x86_64: {
343            features: [
344                "gdb",
345                "gdbstub",
346            ],
347            rustlibs: [
348                "libgdbstub",
349                "libthiserror",
350            ],
351        },
352    },
353    arch: {
354        x86_64: {
355            rustlibs: ["libx86_64_rust"],
356        },
357        arm64: {
358            rustlibs: ["libaarch64"],
359        },
360    },
361    features: [
362        "audio",
363        "default",
364        "gpu",
365    ],
366    rustlibs: [
367        "libacpi_tables",
368        "libarch",
369        "libassertions",
370        "libaudio_streams",
371        "libbase_rust",
372        "libbit_field",
373        "libdata_model",
374        "libdevices",
375        "libdisk",
376        "libhypervisor",
377        "libkernel_cmdline",
378        "libkernel_loader",
379        "liblibc",
380        "liblibcras",
381        "libminijail_rust",
382        "libnet_util",
383        "libp9",
384        "librand_ish",
385        "libresources",
386        "librutabaga_gfx",
387        "libsync_rust",
388        "libtempfile",
389        "libvhost",
390        "libvm_control",
391        "libvm_memory",
392    ],
393    proc_macros: [
394        "libenumn",
395        "libremain",
396    ],
397}
398
399// dependent_library ["feature_list"]
400//   ../adhd/audio_streams/src/audio_streams.rs
401//   ../adhd/cras/client/cras-sys/src/lib.rs
402//   ../adhd/cras/client/libcras/src/libcras.rs
403//   ../libchromeos-rs/src/lib.rs
404//   ../minijail/rust/minijail-sys/lib.rs
405//   ../minijail/rust/minijail/src/lib.rs
406//   ../vm_tools/p9/src/lib.rs
407//   ../vm_tools/p9/wire_format_derive/wire_format_derive.rs
408//   async-task-4.0.3 "default,std"
409//   async-trait-0.1.45
410//   autocfg-1.0.1
411//   bitflags-1.2.1 "default"
412//   cc-1.0.25
413//   cfg-if-1.0.0
414//   downcast-rs-1.2.0 "default,std"
415//   futures-0.3.13 "alloc,async-await,default,executor,futures-executor,std"
416//   futures-channel-0.3.13 "alloc,futures-sink,sink,std"
417//   futures-core-0.3.13 "alloc,std"
418//   futures-executor-0.3.13 "std"
419//   futures-io-0.3.13 "std"
420//   futures-macro-0.3.13
421//   futures-sink-0.3.13 "alloc,std"
422//   futures-task-0.3.13 "alloc,std"
423//   futures-util-0.3.13 "alloc,async-await,async-await-macro,channel,futures-channel,futures-io,futures-macro,futures-sink,io,memchr,proc-macro-hack,proc-macro-nested,sink,slab,std"
424//   getrandom-0.2.2 "std"
425//   intrusive-collections-0.9.0 "alloc,default"
426//   libc-0.2.87 "default,std"
427//   log-0.4.14
428//   memchr-2.3.4 "default,std"
429//   memoffset-0.5.6 "default"
430//   paste-1.0.4
431//   pin-project-lite-0.2.6
432//   pin-utils-0.1.0
433//   pkg-config-0.3.19
434//   ppv-lite86-0.2.10 "simd,std"
435//   proc-macro-hack-0.5.19
436//   proc-macro-nested-0.1.7
437//   proc-macro2-1.0.24 "default,proc-macro"
438//   protobuf-2.22.0
439//   quote-1.0.9 "default,proc-macro"
440//   rand-0.8.3 "alloc,default,getrandom,libc,rand_chacha,rand_hc,std,std_rng"
441//   rand_chacha-0.3.0 "std"
442//   rand_core-0.6.2 "alloc,getrandom,std"
443//   remain-0.2.2
444//   remove_dir_all-0.5.3
445//   serde-1.0.123 "default,derive,serde_derive,std"
446//   serde_derive-1.0.123 "default"
447//   slab-0.4.2
448//   syn-1.0.61 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote,visit-mut"
449//   tempfile-3.2.0
450//   thiserror-1.0.24
451//   thiserror-impl-1.0.24
452//   unicode-xid-0.2.1 "default"
453