dice: add trusty build rules
Adds the ability to build libdiced_open_dice with the trusty build
system. Besides the various rules.mk files this requires a few changes
to the library itself:
Bindgen changes:
1. The bindgen headers have each been moved to to their own subdir. This
stems from a limitation in the trusty build system whereby you can't
have two rules.mk files in the same directory.
2. A lib.rs has been added for each bindgen target. This remains unused
in the android build, but is needed in the trusty build so we can
include!() the generated bindings.
Test changes:
1. The tests have been wrapped in a module so that they can be
conditionally compiled. The trusty build system doesn't support
building rust test targets on their own. It will attempt to compile
this code as a non-test target.
2. A feature, `trusty`, has been added to the test crate to guard
invoking the trusty test harness initialization macro.
Bug: 369146791
Test: atest libdiced_open_dice_nostd.integration_test
Test: # requires associated trusty changes (see topic) \
trusty/vendor/google/aosp/scripts/build.py qemu-generic-arm64-test-debug \
--test="boot-test:com.android.trusty.rust.diced_open_dice_tests.test" \
Change-Id: Ibaefa21473c1de5882a8a225a06d17f1466b4a7f
diff --git a/libs/dice/open_dice/Android.bp b/libs/dice/open_dice/Android.bp
index f799fb1..1870ab6 100644
--- a/libs/dice/open_dice/Android.bp
+++ b/libs/dice/open_dice/Android.bp
@@ -128,7 +128,7 @@
rust_defaults {
name: "libopen_dice_cbor_bindgen.rust_defaults",
- wrapper_src: "bindgen/dice.h",
+ wrapper_src: "bindgen/dice/dice.h",
crate_name: "open_dice_cbor_bindgen",
source_stem: "bindings",
bindgen_flags: [
@@ -184,7 +184,7 @@
rust_defaults {
name: "libopen_dice_android_bindgen.rust_defaults",
- wrapper_src: "bindgen/android.h",
+ wrapper_src: "bindgen/android/android.h",
crate_name: "open_dice_android_bindgen",
source_stem: "bindings",
bindgen_flags: [
@@ -264,3 +264,9 @@
clippy_lints: "none",
lints: "none",
}
+
+dirgroup {
+ name: "trusty_dirgroup_packages_modules_virtualization_libs_open_dice",
+ visibility: ["//trusty/vendor/google/aosp/scripts"],
+ dirs: ["."],
+}