diff options
author | Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> | 2023-10-13 22:15:43 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-10-13 22:15:43 +0000 |
commit | 773e361286fb516d3ae27f858b468b55fe527593 (patch) | |
tree | 34d4c080434dbdd216c67fb4fbc1d5c26e520ae2 | |
parent | 0363aeac13d2fc7b9f5b480c5c6a462ba2c22df6 (diff) | |
parent | 116d175694deb21427a80b19cd6f89409beaedac (diff) | |
download | avb-773e361286fb516d3ae27f858b468b55fe527593.tar.gz |
Merge "libavb_rs: move build rules and tests to rust/" into main am: e5706fcac1 am: 116d175694
Original change: https://android-review.googlesource.com/c/platform/external/avb/+/2781847
Change-Id: I5c0cadc3ddfa3b72d8c3998d0a4e1c69ea4cf0bd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | Android.bp | 94 | ||||
-rw-r--r-- | TEST_MAPPING | 9 | ||||
-rw-r--r-- | rust/Android.bp | 106 | ||||
-rw-r--r-- | rust/TEST_MAPPING | 10 |
4 files changed, 116 insertions, 103 deletions
@@ -398,97 +398,3 @@ cc_library_headers { }, }, } - -// Rust bindgen wrappers to allow calling into libavb from Rust. -// -// The auto-generated wrappers are Rust unsafe and somewhat difficult to work -// with so are not exposed outside of this directory; instead we will provide -// a safe higher-level Rust API. -rust_defaults { - name: "libavb_bindgen.defaults", - wrapper_src: "rust/bindgen/avb.h", - crate_name: "avb_bindgen", - edition: "2021", - visibility: [ - ":__subpackages__", - // TODO(b/290110273): add the Rust public API layer here and adjust - // Virtualization packages to depend on it instead of the raw bindgen. - "//packages/modules/Virtualization:__subpackages__", - ], - source_stem: "bindings", - bindgen_flags: [ - "--constified-enum-module AvbDescriptorTag", - "--default-enum-style rust", - "--allowlist-type=AvbDescriptorTag", - "--allowlist-function=.*", - "--allowlist-var=AVB.*", - "--use-core", - "--raw-line=#![no_std]", - "--ctypes-prefix=core::ffi", - ], - cflags: ["-DBORINGSSL_NO_CXX"], -} - -rust_bindgen { - name: "libavb_bindgen", - defaults: ["libavb_bindgen.defaults"], - host_supported: true, - static_libs: [ - "libavb", - ], - shared_libs: [ - "libcrypto", - ], -} - -rust_bindgen { - name: "libavb_bindgen_nostd", - defaults: ["libavb_bindgen.defaults"], - static_libs: [ - "libavb_baremetal", - "libcrypto_baremetal", - ], -} - -rust_test { - name: "libavb_bindgen_test", - srcs: [":libavb_bindgen"], - crate_name: "avb_bindgen_test", - edition: "2021", - test_suites: ["general-tests"], - auto_gen_config: true, - clippy_lints: "none", - lints: "none", -} - -// Rust library wrapping libavb C implementation. -rust_defaults { - name: "libavb_rs.defaults", - srcs: ["rust/src/lib.rs"], - // Require unsafe blocks for inside unsafe functions. - flags: ["-Dunsafe_op_in_unsafe_fn"], - rustlibs: [ - "libavb_bindgen_nostd", - "libtinyvec_nostd", - ], - whole_static_libs: [ - "libavb_baremetal", - ], -} - -rust_library_rlib { - name: "libavb_rs_nostd", - crate_name: "avb", - prefer_rlib: true, - defaults: ["libavb_rs.defaults"], - no_stdlibs: true, - stdlibs: [ - "libcore.rust_sysroot", - ], -} - -rust_test { - name: "libavb_rs_test", - defaults: ["libavb_rs.defaults"], - test_suites: ["general-tests"], -} diff --git a/TEST_MAPPING b/TEST_MAPPING index f0315f7..d848978 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -6,14 +6,5 @@ { "name": "libavb_host_unittest_sha" } - ], - // We can move to presubmit once we have the necessary SLO data. - "postsubmit": [ - { - "name": "libavb_bindgen_test" - }, - { - "name": "libavb_rs_test" - } ] }
\ No newline at end of file diff --git a/rust/Android.bp b/rust/Android.bp new file mode 100644 index 0000000..685f51b --- /dev/null +++ b/rust/Android.bp @@ -0,0 +1,106 @@ +// Copyright 2023, The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Rust bindgen wrappers to allow calling into libavb from Rust. +// +// The auto-generated wrappers are Rust unsafe and somewhat difficult to work +// with so are not exposed outside of this directory; instead we will provide +// a safe higher-level Rust API. +rust_defaults { + name: "libavb_bindgen.defaults", + wrapper_src: "bindgen/avb.h", + crate_name: "avb_bindgen", + edition: "2021", + visibility: [ + ":__subpackages__", + // TODO(b/290110273): add the Rust public API layer here and adjust + // Virtualization packages to depend on it instead of the raw bindgen. + "//packages/modules/Virtualization:__subpackages__", + ], + source_stem: "bindings", + bindgen_flags: [ + "--constified-enum-module AvbDescriptorTag", + "--default-enum-style rust", + "--allowlist-type=AvbDescriptorTag", + "--allowlist-function=.*", + "--allowlist-var=AVB.*", + "--use-core", + "--raw-line=#![no_std]", + "--ctypes-prefix=core::ffi", + ], + cflags: ["-DBORINGSSL_NO_CXX"], +} + +rust_bindgen { + name: "libavb_bindgen", + defaults: ["libavb_bindgen.defaults"], + host_supported: true, + static_libs: [ + "libavb", + ], + shared_libs: [ + "libcrypto", + ], +} + +rust_bindgen { + name: "libavb_bindgen_nostd", + defaults: ["libavb_bindgen.defaults"], + static_libs: [ + "libavb_baremetal", + "libcrypto_baremetal", + ], +} + +rust_test { + name: "libavb_bindgen_test", + srcs: [":libavb_bindgen"], + crate_name: "avb_bindgen_test", + edition: "2021", + test_suites: ["general-tests"], + auto_gen_config: true, + clippy_lints: "none", + lints: "none", +} + +// Rust library wrapping libavb C implementation. +rust_defaults { + name: "libavb_rs.defaults", + srcs: ["src/lib.rs"], + // Require unsafe blocks for inside unsafe functions. + flags: ["-Dunsafe_op_in_unsafe_fn"], + rustlibs: [ + "libavb_bindgen_nostd", + ], + whole_static_libs: [ + "libavb_baremetal", + ], +} + +rust_library_rlib { + name: "libavb_rs_nostd", + crate_name: "avb", + prefer_rlib: true, + defaults: ["libavb_rs.defaults"], + no_stdlibs: true, + stdlibs: [ + "libcore.rust_sysroot", + ], +} + +rust_test { + name: "libavb_rs_test", + defaults: ["libavb_rs.defaults"], + test_suites: ["general-tests"], +} diff --git a/rust/TEST_MAPPING b/rust/TEST_MAPPING new file mode 100644 index 0000000..2eb8bab --- /dev/null +++ b/rust/TEST_MAPPING @@ -0,0 +1,10 @@ +{ + "postsubmit": [ + { + "name": "libavb_bindgen_test" + }, + { + "name": "libavb_rs_test" + } + ] +}
\ No newline at end of file |