Replace keystore2_vintf's bindgen with cxx
This simplifies things by removing code and unsafe blocks.
Test: Boot
Test: keystore2_vintf_test
Change-Id: I5858a2a25e0ee27e42ee9846d44762da2454f706
diff --git a/keystore2/src/vintf/Android.bp b/keystore2/src/vintf/Android.bp
index 352f2be..34719aa 100644
--- a/keystore2/src/vintf/Android.bp
+++ b/keystore2/src/vintf/Android.bp
@@ -26,39 +26,32 @@
crate_name: "keystore2_vintf",
srcs: ["lib.rs"],
rustlibs: [
- "libkeystore2_vintf_bindgen",
+ "libcxx",
],
shared_libs: [
+ "libvintf",
+ ],
+ static_libs: [
"libkeystore2_vintf_cpp",
- "libvintf",
],
}
-cc_library {
+cc_library_static {
name: "libkeystore2_vintf_cpp",
- srcs: [
- "vintf.cpp",
- ],
+ srcs: ["vintf.cpp"],
+ generated_headers: ["cxx-bridge-header"],
+ generated_sources: ["vintf_bridge_code"],
shared_libs: [
"libvintf",
],
}
-rust_bindgen {
- name: "libkeystore2_vintf_bindgen",
- wrapper_src: "vintf.hpp",
- crate_name: "keystore2_vintf_bindgen",
- source_stem: "bindings",
- host_supported: true,
- shared_libs: ["libvintf"],
- bindgen_flags: [
- "--size_t-is-usize",
- "--allowlist-function", "getHalNames",
- "--allowlist-function", "getHalNamesAndVersions",
- "--allowlist-function", "getHidlInstances",
- "--allowlist-function", "getAidlInstances",
- "--allowlist-function", "freeNames",
- ],
+genrule {
+ name: "vintf_bridge_code",
+ tools: ["cxxbridge"],
+ cmd: "$(location cxxbridge) $(in) >> $(out)",
+ srcs: ["lib.rs"],
+ out: ["vintf_cxx_generated.cc"],
}
rust_test {
@@ -68,7 +61,7 @@
test_suites: ["general-tests"],
auto_gen_config: true,
rustlibs: [
- "libkeystore2_vintf_bindgen",
+ "libcxx",
],
static_libs: [
"libkeystore2_vintf_cpp",
@@ -78,13 +71,3 @@
"libvintf",
],
}
-
-rust_test {
- name: "libkeystore2_vintf_bindgen_test",
- srcs: [":libkeystore2_vintf_bindgen"],
- crate_name: "keystore2_vintf_bindgen_test",
- test_suites: ["general-tests"],
- auto_gen_config: true,
- clippy_lints: "none",
- lints: "none",
-}