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