blob: 80d289b4b5467617380c24b361bdcfd1223e8412 [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",
Nikita Ioffeda1b2732023-09-04 13:46:56 +01009 defaults: ["avf_build_flags_rust"],
Alan Stokesbcc2ec22022-10-31 17:02:50 +000010 visibility: ["//visibility:private"],
Alan Stokesf7601962023-11-09 14:28:40 +000011 srcs: ["src/lib.rs"],
Alice Wangfb46ee12022-09-30 13:08:52 +000012 include_dirs: ["include"],
13 prefer_rlib: true,
14 rustlibs: [
Alice Wang59a9e562022-10-04 15:24:10 +000015 "android.system.virtualization.payload-rust",
Alice Wangfb46ee12022-09-30 13:08:52 +000016 "libandroid_logger",
17 "libanyhow",
18 "libbinder_rs",
Alice Wang6bbb6da2022-10-26 12:44:06 +000019 "liblazy_static",
David Brazdil451cc962022-10-14 14:08:12 +010020 "liblibc",
Alice Wangfb46ee12022-09-30 13:08:52 +000021 "liblog_rust",
Alice Wang4e3015d2023-10-10 09:35:37 +000022 "libopenssl",
Alice Wang2be64f32022-10-13 14:37:35 +000023 "librpcbinder_rs",
Alice Wang4e3015d2023-10-10 09:35:37 +000024 "libvm_payload_status_bindgen",
David Brazdil73988ea2022-11-11 15:10:32 +000025 "libvsock",
Alice Wangfb46ee12022-09-30 13:08:52 +000026 ],
Alice Wangfb46ee12022-09-30 13:08:52 +000027}
Alice Wangbd569a02022-10-06 15:23:24 +000028
Alice Wang4e3015d2023-10-10 09:35:37 +000029rust_bindgen {
30 name: "libvm_payload_status_bindgen",
31 wrapper_src: "include/vm_payload.h",
32 crate_name: "vm_payload_status_bindgen",
33 defaults: ["avf_build_flags_rust"],
34 source_stem: "bindings",
35 bindgen_flags: [
36 "--default-enum-style rust",
Alice Wang1715f372024-02-14 10:51:52 +000037 "--allowlist-type=AVmAttestationStatus",
Alice Wang4e3015d2023-10-10 09:35:37 +000038 ],
39 visibility: [":__subpackages__"],
40}
41
Alan Stokesbcc2ec22022-10-31 17:02:50 +000042// Rust wrappers round the C API for Rust clients.
43// (Yes, this involves going Rust -> C -> Rust.)
Alice Wangbd569a02022-10-06 15:23:24 +000044rust_bindgen {
45 name: "libvm_payload_bindgen",
Alan Stokesd4ea5a82022-11-10 12:17:42 +000046 wrapper_src: "include-restricted/vm_payload_restricted.h",
Alice Wangbd569a02022-10-06 15:23:24 +000047 crate_name: "vm_payload_bindgen",
Nikita Ioffeda1b2732023-09-04 13:46:56 +010048 defaults: ["avf_build_flags_rust"],
Alice Wangbd569a02022-10-06 15:23:24 +000049 source_stem: "bindings",
50 apex_available: ["com.android.compos"],
Alice Wang4e3015d2023-10-10 09:35:37 +000051 bindgen_flags: [
52 "--default-enum-style rust",
53 ],
Alice Wangc2fec932023-02-23 16:24:02 +000054 visibility: [
55 "//packages/modules/Virtualization/compos",
Alice Wangeeadc3f2024-02-08 13:14:13 +000056 "//packages/modules/Virtualization/service_vm:__subpackages__",
Alice Wangc2fec932023-02-23 16:24:02 +000057 ],
Alice Wangbd569a02022-10-06 15:23:24 +000058 shared_libs: [
Alan Stokesbcc2ec22022-10-31 17:02:50 +000059 "libvm_payload#current",
Alice Wangbd569a02022-10-06 15:23:24 +000060 ],
61}
Alan Stokes52d3c722022-10-04 17:27:13 +010062
Alan Stokesbcc2ec22022-10-31 17:02:50 +000063// Shared library for clients to link against.
64cc_library_shared {
65 name: "libvm_payload",
Nikita Ioffe38b9e712024-02-08 15:55:07 +000066 defaults: ["avf_build_flags_cc"],
Alan Stokesbcc2ec22022-10-31 17:02:50 +000067 shared_libs: [
68 "libbinder_ndk",
69 "libbinder_rpc_unstable",
70 "liblog",
Alice Wang4e3015d2023-10-10 09:35:37 +000071 "libcrypto",
Alan Stokesbcc2ec22022-10-31 17:02:50 +000072 ],
73 whole_static_libs: ["libvm_payload_impl"],
74 export_static_lib_headers: ["libvm_payload_impl"],
75 installable: false,
76 version_script: "libvm_payload.map.txt",
77 stubs: {
78 symbol_file: "libvm_payload.map.txt",
79 // Implementation is available inside a Microdroid VM.
80 implementation_installable: false,
81 },
82}
83
84// Just the headers. Mostly useful for clients that only want the
85// declaration of AVmPayload_main().
Alan Stokes52d3c722022-10-04 17:27:13 +010086cc_library_headers {
87 name: "vm_payload_headers",
Nikita Ioffe38b9e712024-02-08 15:55:07 +000088 defaults: ["avf_build_flags_cc"],
Alan Stokesd4ea5a82022-11-10 12:17:42 +000089 apex_available: ["com.android.compos"],
Alan Stokes52d3c722022-10-04 17:27:13 +010090 export_include_dirs: ["include"],
91}
Alan Stokesd4ea5a82022-11-10 12:17:42 +000092
Alan Stokesbcc2ec22022-10-31 17:02:50 +000093// Restricted headers for use by internal clients & associated tests.
Alan Stokesd4ea5a82022-11-10 12:17:42 +000094cc_library_headers {
95 name: "vm_payload_restricted_headers",
Nikita Ioffe38b9e712024-02-08 15:55:07 +000096 defaults: ["avf_build_flags_cc"],
Alan Stokesd4ea5a82022-11-10 12:17:42 +000097 header_libs: ["vm_payload_headers"],
98 export_header_lib_headers: ["vm_payload_headers"],
99 export_include_dirs: ["include-restricted"],
100 apex_available: ["com.android.compos"],
101 visibility: ["//packages/modules/Virtualization:__subpackages__"],
102}