blob: 78627026fc62813673c4e89057be5c710fe34917 [file] [log] [blame]
Alice Wangfb46ee12022-09-30 13:08:52 +00001package {
2 default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
Alan Stokesbcc2ec22022-10-31 17:02:50 +00005// The Rust implementation of the C API.
6rust_ffi_static {
7 name: "libvm_payload_impl",
Alice Wangfb46ee12022-09-30 13:08:52 +00008 crate_name: "vm_payload",
Alan Stokesbcc2ec22022-10-31 17:02:50 +00009 visibility: ["//visibility:private"],
Alice Wangfb46ee12022-09-30 13:08:52 +000010 srcs: ["src/*.rs"],
11 include_dirs: ["include"],
12 prefer_rlib: true,
Alan Stokesa0e42962023-04-14 17:59:50 +010013 // Require unsafe blocks for inside unsafe functions.
14 flags: ["-Dunsafe_op_in_unsafe_fn"],
Alice Wangfb46ee12022-09-30 13:08:52 +000015 rustlibs: [
Alice Wang59a9e562022-10-04 15:24:10 +000016 "android.system.virtualization.payload-rust",
Alice Wangfb46ee12022-09-30 13:08:52 +000017 "libandroid_logger",
18 "libanyhow",
19 "libbinder_rs",
Alice Wang6bbb6da2022-10-26 12:44:06 +000020 "liblazy_static",
David Brazdil451cc962022-10-14 14:08:12 +010021 "liblibc",
Alice Wangfb46ee12022-09-30 13:08:52 +000022 "liblog_rust",
Alice Wang2be64f32022-10-13 14:37:35 +000023 "librpcbinder_rs",
David Brazdil73988ea2022-11-11 15:10:32 +000024 "libvsock",
Alice Wangfb46ee12022-09-30 13:08:52 +000025 ],
Alice Wang5ef60e62022-11-03 08:19:02 +000026 // The sanitize section below fixes the fuzzer build in b/256166339.
27 // TODO(b/250854486): Remove the sanitize section once the bug is fixed.
Alice Wang8d7e1072022-11-02 17:42:52 +000028 sanitize: {
29 address: false,
30 },
Alice Wangfb46ee12022-09-30 13:08:52 +000031}
Alice Wangbd569a02022-10-06 15:23:24 +000032
Alan Stokesbcc2ec22022-10-31 17:02:50 +000033// Rust wrappers round the C API for Rust clients.
34// (Yes, this involves going Rust -> C -> Rust.)
Alice Wangbd569a02022-10-06 15:23:24 +000035rust_bindgen {
36 name: "libvm_payload_bindgen",
Alan Stokesd4ea5a82022-11-10 12:17:42 +000037 wrapper_src: "include-restricted/vm_payload_restricted.h",
Alice Wangbd569a02022-10-06 15:23:24 +000038 crate_name: "vm_payload_bindgen",
39 source_stem: "bindings",
40 apex_available: ["com.android.compos"],
41 visibility: ["//packages/modules/Virtualization/compos"],
42 shared_libs: [
Alan Stokesbcc2ec22022-10-31 17:02:50 +000043 "libvm_payload#current",
Alice Wangbd569a02022-10-06 15:23:24 +000044 ],
45}
Alan Stokes52d3c722022-10-04 17:27:13 +010046
Alan Stokesbcc2ec22022-10-31 17:02:50 +000047// Shared library for clients to link against.
48cc_library_shared {
49 name: "libvm_payload",
50 shared_libs: [
51 "libbinder_ndk",
52 "libbinder_rpc_unstable",
53 "liblog",
54 ],
55 whole_static_libs: ["libvm_payload_impl"],
56 export_static_lib_headers: ["libvm_payload_impl"],
57 installable: false,
58 version_script: "libvm_payload.map.txt",
59 stubs: {
60 symbol_file: "libvm_payload.map.txt",
61 // Implementation is available inside a Microdroid VM.
62 implementation_installable: false,
63 },
64}
65
66// Just the headers. Mostly useful for clients that only want the
67// declaration of AVmPayload_main().
Alan Stokes52d3c722022-10-04 17:27:13 +010068cc_library_headers {
69 name: "vm_payload_headers",
Alan Stokesd4ea5a82022-11-10 12:17:42 +000070 apex_available: ["com.android.compos"],
Alan Stokes52d3c722022-10-04 17:27:13 +010071 export_include_dirs: ["include"],
72}
Alan Stokesd4ea5a82022-11-10 12:17:42 +000073
Alan Stokesbcc2ec22022-10-31 17:02:50 +000074// Restricted headers for use by internal clients & associated tests.
Alan Stokesd4ea5a82022-11-10 12:17:42 +000075cc_library_headers {
76 name: "vm_payload_restricted_headers",
77 header_libs: ["vm_payload_headers"],
78 export_header_lib_headers: ["vm_payload_headers"],
79 export_include_dirs: ["include-restricted"],
80 apex_available: ["com.android.compos"],
81 visibility: ["//packages/modules/Virtualization:__subpackages__"],
82}