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 "liblibc", 20 "liblog_rust", 21 "libopenssl", 22 "librpcbinder_rs", 23 "libvm_payload_status_bindgen", 24 "libvsock", 25 ], 26} 27 28rust_bindgen { 29 name: "libvm_payload_status_bindgen", 30 wrapper_src: "include/vm_payload.h", 31 crate_name: "vm_payload_status_bindgen", 32 defaults: ["avf_build_flags_rust"], 33 source_stem: "bindings", 34 bindgen_flags: [ 35 "--default-enum-style rust", 36 "--allowlist-type=AVmAttestationStatus", 37 ], 38 visibility: [":__subpackages__"], 39} 40 41// Access to the C API for Rust code. 42// This shouldn't be used directly - prefer libvm_payload_rs (below) 43rust_bindgen { 44 name: "libvm_payload_bindgen", 45 wrapper_src: "include-restricted/vm_payload_restricted.h", 46 crate_name: "vm_payload_bindgen", 47 defaults: ["avf_build_flags_rust"], 48 source_stem: "bindings", 49 apex_available: ["com.android.compos"], 50 bindgen_flags: [ 51 "--default-enum-style rust", 52 ], 53 shared_libs: [ 54 "libvm_payload#current", 55 ], 56} 57 58// Wrapper library for the raw C API for use by Rust clients. 59// (Yes, this involves going Rust -> C -> Rust.) 60// This is not a stable API - we may change it in subsequent versions. 61// But it is made available as an rlib so it is linked into any 62// code using it, leaving only dependencies on stable APIs. 63// So code built with it should run unchanged on future versions. 64rust_library_rlib { 65 name: "libvm_payload_rs", 66 crate_name: "vm_payload", 67 defaults: ["avf_build_flags_rust"], 68 srcs: ["wrapper/lib.rs"], 69 rustlibs: [ 70 "libbinder_rs", 71 "libstatic_assertions", 72 "libvm_payload_bindgen", 73 ], 74 apex_available: ["com.android.compos"], 75 visibility: ["//visibility:public"], 76} 77 78// Shared library for clients to link against. 79cc_library_shared { 80 name: "libvm_payload", 81 defaults: ["avf_build_flags_cc"], 82 shared_libs: [ 83 "libbinder_ndk", 84 "libbinder_rpc_unstable", 85 "liblog", 86 "libcrypto", 87 ], 88 whole_static_libs: ["libvm_payload_impl"], 89 export_static_lib_headers: ["libvm_payload_impl"], 90 no_full_install: true, 91 version_script: "libvm_payload.map.txt", 92 stubs: { 93 symbol_file: "libvm_payload.map.txt", 94 // Implementation is available inside a Microdroid VM. 95 implementation_installable: false, 96 }, 97 visibility: ["//visibility:public"], 98} 99 100// Just the headers. Mostly useful for clients that only want the 101// declaration of AVmPayload_main(). 102cc_library_headers { 103 name: "vm_payload_headers", 104 defaults: ["avf_build_flags_cc"], 105 apex_available: ["com.android.compos"], 106 export_include_dirs: ["include"], 107 visibility: ["//visibility:public"], 108} 109 110// Restricted headers for use by internal clients & associated tests. 111cc_library_headers { 112 name: "vm_payload_restricted_headers", 113 defaults: ["avf_build_flags_cc"], 114 header_libs: ["vm_payload_headers"], 115 export_header_lib_headers: ["vm_payload_headers"], 116 export_include_dirs: ["include-restricted"], 117 apex_available: ["com.android.compos"], 118 visibility: ["//packages/modules/Virtualization:__subpackages__"], 119} 120