1package { 2 default_applicable_licenses: ["Android-Apache-2.0"], 3} 4 5// The Rust implementation of the C API. 6rust_ffi_static { 7 name: "libvm_payload_impl", 8 crate_name: "vm_payload", 9 defaults: ["avf_build_flags_rust"], 10 visibility: ["//visibility:private"], 11 srcs: ["src/lib.rs"], 12 include_dirs: ["include"], 13 prefer_rlib: true, 14 rustlibs: [ 15 "android.system.virtualization.payload-rust", 16 "libandroid_logger", 17 "libanyhow", 18 "libbinder_rs", 19 "liblazy_static", 20 "liblibc", 21 "liblog_rust", 22 "libopenssl", 23 "librpcbinder_rs", 24 "libvm_payload_status_bindgen", 25 "libvsock", 26 ], 27} 28 29rust_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", 37 "--allowlist-type=AVmAttestationStatus", 38 ], 39 visibility: [":__subpackages__"], 40} 41 42// Rust wrappers round the C API for Rust clients. 43// (Yes, this involves going Rust -> C -> Rust.) 44rust_bindgen { 45 name: "libvm_payload_bindgen", 46 wrapper_src: "include-restricted/vm_payload_restricted.h", 47 crate_name: "vm_payload_bindgen", 48 defaults: ["avf_build_flags_rust"], 49 source_stem: "bindings", 50 apex_available: ["com.android.compos"], 51 bindgen_flags: [ 52 "--default-enum-style rust", 53 ], 54 visibility: [ 55 "//packages/modules/Virtualization/compos", 56 "//packages/modules/Virtualization/service_vm:__subpackages__", 57 ], 58 shared_libs: [ 59 "libvm_payload#current", 60 ], 61} 62 63// Shared library for clients to link against. 64cc_library_shared { 65 name: "libvm_payload", 66 defaults: ["avf_build_flags_cc"], 67 shared_libs: [ 68 "libbinder_ndk", 69 "libbinder_rpc_unstable", 70 "liblog", 71 "libcrypto", 72 ], 73 whole_static_libs: ["libvm_payload_impl"], 74 export_static_lib_headers: ["libvm_payload_impl"], 75 no_full_install: true, 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 visibility: ["//visibility:public"], 83} 84 85// Just the headers. Mostly useful for clients that only want the 86// declaration of AVmPayload_main(). 87cc_library_headers { 88 name: "vm_payload_headers", 89 defaults: ["avf_build_flags_cc"], 90 apex_available: ["com.android.compos"], 91 export_include_dirs: ["include"], 92 visibility: ["//visibility:public"], 93} 94 95// Restricted headers for use by internal clients & associated tests. 96cc_library_headers { 97 name: "vm_payload_restricted_headers", 98 defaults: ["avf_build_flags_cc"], 99 header_libs: ["vm_payload_headers"], 100 export_header_lib_headers: ["vm_payload_headers"], 101 export_include_dirs: ["include-restricted"], 102 apex_available: ["com.android.compos"], 103 visibility: ["//packages/modules/Virtualization:__subpackages__"], 104} 105