Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 1 | package { |
| 2 | default_applicable_licenses: ["Android-Apache-2.0"], |
| 3 | } |
| 4 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 5 | // The Rust implementation of the C API. |
| 6 | rust_ffi_static { |
| 7 | name: "libvm_payload_impl", |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 8 | crate_name: "vm_payload", |
Nikita Ioffe | da1b273 | 2023-09-04 13:46:56 +0100 | [diff] [blame] | 9 | defaults: ["avf_build_flags_rust"], |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 10 | visibility: ["//visibility:private"], |
Alan Stokes | f760196 | 2023-11-09 14:28:40 +0000 | [diff] [blame] | 11 | srcs: ["src/lib.rs"], |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 12 | include_dirs: ["include"], |
| 13 | prefer_rlib: true, |
| 14 | rustlibs: [ |
Alice Wang | 59a9e56 | 2022-10-04 15:24:10 +0000 | [diff] [blame] | 15 | "android.system.virtualization.payload-rust", |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 16 | "libandroid_logger", |
| 17 | "libanyhow", |
| 18 | "libbinder_rs", |
Alice Wang | 6bbb6da | 2022-10-26 12:44:06 +0000 | [diff] [blame] | 19 | "liblazy_static", |
David Brazdil | 451cc96 | 2022-10-14 14:08:12 +0100 | [diff] [blame] | 20 | "liblibc", |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 21 | "liblog_rust", |
Alice Wang | 4e3015d | 2023-10-10 09:35:37 +0000 | [diff] [blame] | 22 | "libopenssl", |
Alice Wang | 2be64f3 | 2022-10-13 14:37:35 +0000 | [diff] [blame] | 23 | "librpcbinder_rs", |
Alice Wang | 4e3015d | 2023-10-10 09:35:37 +0000 | [diff] [blame] | 24 | "libvm_payload_status_bindgen", |
David Brazdil | 73988ea | 2022-11-11 15:10:32 +0000 | [diff] [blame] | 25 | "libvsock", |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 26 | ], |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 27 | } |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 28 | |
Alice Wang | 4e3015d | 2023-10-10 09:35:37 +0000 | [diff] [blame] | 29 | rust_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=attestation_status_t", |
| 38 | ], |
| 39 | visibility: [":__subpackages__"], |
| 40 | } |
| 41 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 42 | // Rust wrappers round the C API for Rust clients. |
| 43 | // (Yes, this involves going Rust -> C -> Rust.) |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 44 | rust_bindgen { |
| 45 | name: "libvm_payload_bindgen", |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 46 | wrapper_src: "include-restricted/vm_payload_restricted.h", |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 47 | crate_name: "vm_payload_bindgen", |
Nikita Ioffe | da1b273 | 2023-09-04 13:46:56 +0100 | [diff] [blame] | 48 | defaults: ["avf_build_flags_rust"], |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 49 | source_stem: "bindings", |
| 50 | apex_available: ["com.android.compos"], |
Alice Wang | 4e3015d | 2023-10-10 09:35:37 +0000 | [diff] [blame] | 51 | bindgen_flags: [ |
| 52 | "--default-enum-style rust", |
| 53 | ], |
Alice Wang | c2fec93 | 2023-02-23 16:24:02 +0000 | [diff] [blame] | 54 | visibility: [ |
| 55 | "//packages/modules/Virtualization/compos", |
Alice Wang | ac080d3 | 2023-11-02 13:12:25 +0000 | [diff] [blame] | 56 | "//packages/modules/Virtualization/service_vm/test_apk", |
Alice Wang | c2fec93 | 2023-02-23 16:24:02 +0000 | [diff] [blame] | 57 | ], |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 58 | shared_libs: [ |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 59 | "libvm_payload#current", |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 60 | ], |
| 61 | } |
Alan Stokes | 52d3c72 | 2022-10-04 17:27:13 +0100 | [diff] [blame] | 62 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 63 | // Shared library for clients to link against. |
| 64 | cc_library_shared { |
| 65 | name: "libvm_payload", |
| 66 | shared_libs: [ |
| 67 | "libbinder_ndk", |
| 68 | "libbinder_rpc_unstable", |
| 69 | "liblog", |
Alice Wang | 4e3015d | 2023-10-10 09:35:37 +0000 | [diff] [blame] | 70 | "libcrypto", |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 71 | ], |
| 72 | whole_static_libs: ["libvm_payload_impl"], |
| 73 | export_static_lib_headers: ["libvm_payload_impl"], |
| 74 | installable: false, |
| 75 | version_script: "libvm_payload.map.txt", |
| 76 | stubs: { |
| 77 | symbol_file: "libvm_payload.map.txt", |
| 78 | // Implementation is available inside a Microdroid VM. |
| 79 | implementation_installable: false, |
| 80 | }, |
| 81 | } |
| 82 | |
| 83 | // Just the headers. Mostly useful for clients that only want the |
| 84 | // declaration of AVmPayload_main(). |
Alan Stokes | 52d3c72 | 2022-10-04 17:27:13 +0100 | [diff] [blame] | 85 | cc_library_headers { |
| 86 | name: "vm_payload_headers", |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 87 | apex_available: ["com.android.compos"], |
Alan Stokes | 52d3c72 | 2022-10-04 17:27:13 +0100 | [diff] [blame] | 88 | export_include_dirs: ["include"], |
| 89 | } |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 90 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 91 | // Restricted headers for use by internal clients & associated tests. |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 92 | cc_library_headers { |
| 93 | name: "vm_payload_restricted_headers", |
| 94 | header_libs: ["vm_payload_headers"], |
| 95 | export_header_lib_headers: ["vm_payload_headers"], |
| 96 | export_include_dirs: ["include-restricted"], |
| 97 | apex_available: ["com.android.compos"], |
| 98 | visibility: ["//packages/modules/Virtualization:__subpackages__"], |
| 99 | } |