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