diff options
author | David Drysdale <drysdale@google.com> | 2023-10-04 12:31:27 +0100 |
---|---|---|
committer | David Drysdale <drysdale@google.com> | 2023-10-04 12:31:27 +0100 |
commit | e785f6b306b1d277d68509cb2284b8810d3f852e (patch) | |
tree | 75cf40db7a09408f32eb2fe958af79e44dac6e39 | |
parent | 0257fa1943d6a01aac5cf62efca0fb8c36eeb71d (diff) | |
download | sec1-e785f6b306b1d277d68509cb2284b8810d3f852e.tar.gz |
Add baremetal _nostd variant
Note that product_available and vendor_available are dropped from the
existing target because they are irrelevant for a _host target (as per
the change in aosp/2763825).
Add a visibility restriction to the new variant to preserve the
limitation that this crate should not be used in general Android code.
Bug: 303192701
Test: build both variants
Change-Id: I36d5dc3d6a22a750963b0ffb592f65880ae60ec0
-rw-r--r-- | Android.bp | 34 | ||||
-rw-r--r-- | cargo2android.json | 15 | ||||
-rw-r--r-- | cargo2android_viz.bp | 3 |
3 files changed, 51 insertions, 1 deletions
@@ -49,6 +49,40 @@ rust_library_host { "libpkcs8", "libzeroize", ], +} + +rust_library_rlib { + name: "libsec1_nostd", + crate_name: "sec1", + cargo_env_compat: true, + cargo_pkg_version: "0.3.0", + srcs: ["src/lib.rs"], + edition: "2021", + features: [ + "alloc", + "der", + "pkcs8", + "zeroize", + ], + rustlibs: [ + "libder_nostd", + "libpkcs8_nostd", + "libzeroize_nostd", + ], + apex_available: [ + "//apex_available:platform", + "com.android.virt", + ], + prefer_rlib: true, + no_stdlibs: true, + stdlibs: [ + "libcompiler_builtins.rust_sysroot", + "libcore.rust_sysroot", + ], product_available: true, vendor_available: true, + visibility: [ + "//system/keymint:__subpackages__", + ] + , } diff --git a/cargo2android.json b/cargo2android.json index e7b7c25..ba30a27 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -5,5 +5,18 @@ ], "run": true, "vendor-available": true, - "features": "alloc,der,pkcs8" + "features": "alloc,der,pkcs8", + "variants": [ + { + }, + { + "device": true, + "no-host": true, + "add-module-block": "cargo2android_viz.bp", + "dependency_suffix": "_nostd", + "force-rlib": true, + "suffix": "_nostd", + "no-std": true + } + ] } diff --git a/cargo2android_viz.bp b/cargo2android_viz.bp new file mode 100644 index 0000000..6912520 --- /dev/null +++ b/cargo2android_viz.bp @@ -0,0 +1,3 @@ +visibility: [ + "//system/keymint:__subpackages__", +] |