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"], |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 11 | srcs: ["src/*.rs"], |
| 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 | 2be64f3 | 2022-10-13 14:37:35 +0000 | [diff] [blame] | 22 | "librpcbinder_rs", |
David Brazdil | 73988ea | 2022-11-11 15:10:32 +0000 | [diff] [blame] | 23 | "libvsock", |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 24 | ], |
Alice Wang | fb46ee1 | 2022-09-30 13:08:52 +0000 | [diff] [blame] | 25 | } |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 26 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 27 | // Rust wrappers round the C API for Rust clients. |
| 28 | // (Yes, this involves going Rust -> C -> Rust.) |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 29 | rust_bindgen { |
| 30 | name: "libvm_payload_bindgen", |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 31 | wrapper_src: "include-restricted/vm_payload_restricted.h", |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 32 | crate_name: "vm_payload_bindgen", |
Nikita Ioffe | da1b273 | 2023-09-04 13:46:56 +0100 | [diff] [blame^] | 33 | defaults: ["avf_build_flags_rust"], |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 34 | source_stem: "bindings", |
| 35 | apex_available: ["com.android.compos"], |
Alice Wang | c2fec93 | 2023-02-23 16:24:02 +0000 | [diff] [blame] | 36 | visibility: [ |
| 37 | "//packages/modules/Virtualization/compos", |
| 38 | "//packages/modules/Virtualization/service_vm/client_apk", |
| 39 | ], |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 40 | shared_libs: [ |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 41 | "libvm_payload#current", |
Alice Wang | bd569a0 | 2022-10-06 15:23:24 +0000 | [diff] [blame] | 42 | ], |
| 43 | } |
Alan Stokes | 52d3c72 | 2022-10-04 17:27:13 +0100 | [diff] [blame] | 44 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 45 | // Shared library for clients to link against. |
| 46 | cc_library_shared { |
| 47 | name: "libvm_payload", |
| 48 | shared_libs: [ |
| 49 | "libbinder_ndk", |
| 50 | "libbinder_rpc_unstable", |
| 51 | "liblog", |
| 52 | ], |
| 53 | whole_static_libs: ["libvm_payload_impl"], |
| 54 | export_static_lib_headers: ["libvm_payload_impl"], |
| 55 | installable: false, |
| 56 | version_script: "libvm_payload.map.txt", |
| 57 | stubs: { |
| 58 | symbol_file: "libvm_payload.map.txt", |
| 59 | // Implementation is available inside a Microdroid VM. |
| 60 | implementation_installable: false, |
| 61 | }, |
| 62 | } |
| 63 | |
| 64 | // Just the headers. Mostly useful for clients that only want the |
| 65 | // declaration of AVmPayload_main(). |
Alan Stokes | 52d3c72 | 2022-10-04 17:27:13 +0100 | [diff] [blame] | 66 | cc_library_headers { |
| 67 | name: "vm_payload_headers", |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 68 | apex_available: ["com.android.compos"], |
Alan Stokes | 52d3c72 | 2022-10-04 17:27:13 +0100 | [diff] [blame] | 69 | export_include_dirs: ["include"], |
| 70 | } |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 71 | |
Alan Stokes | bcc2ec2 | 2022-10-31 17:02:50 +0000 | [diff] [blame] | 72 | // Restricted headers for use by internal clients & associated tests. |
Alan Stokes | d4ea5a8 | 2022-11-10 12:17:42 +0000 | [diff] [blame] | 73 | cc_library_headers { |
| 74 | name: "vm_payload_restricted_headers", |
| 75 | header_libs: ["vm_payload_headers"], |
| 76 | export_header_lib_headers: ["vm_payload_headers"], |
| 77 | export_include_dirs: ["include-restricted"], |
| 78 | apex_available: ["com.android.compos"], |
| 79 | visibility: ["//packages/modules/Virtualization:__subpackages__"], |
| 80 | } |