diff options
author | David Drysdale <drysdale@google.com> | 2023-10-03 10:57:37 +0100 |
---|---|---|
committer | David Drysdale <drysdale@google.com> | 2023-10-04 13:00:38 +0100 |
commit | 7944c99fec8ce2247e2e8119c2a375b9a665732a (patch) | |
tree | 0e3ff5f20e7fd43bb5cbe5aed15967652288a879 | |
parent | b5bfd823534e1c38e7232017f9cef732c4e93199 (diff) | |
download | der-7944c99fec8ce2247e2e8119c2a375b9a665732a.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: Ib9f3a7b59d8c3549f23c9590a324240dbbb3860a
-rw-r--r-- | Android.bp | 44 | ||||
-rw-r--r-- | cargo2android.json | 16 | ||||
-rw-r--r-- | cargo2android_viz.bp | 8 |
3 files changed, 67 insertions, 1 deletions
@@ -53,6 +53,50 @@ rust_library_host { "libzeroize", ], proc_macros: ["libder_derive"], +} + +rust_library_rlib { + name: "libder_nostd", + crate_name: "der", + cargo_env_compat: true, + cargo_pkg_version: "0.6.1", + srcs: ["src/lib.rs"], + edition: "2021", + features: [ + "alloc", + "const-oid", + "der_derive", + "derive", + "flagset", + "oid", + "zeroize", + ], + rustlibs: [ + "libconst_oid_nostd", + "libflagset_nostd", + "libzeroize_nostd", + ], + proc_macros: ["libder_derive"], + apex_available: [ + "//apex_available:platform", + "com.android.virt", + ], + prefer_rlib: true, + no_stdlibs: true, + stdlibs: [ + "liballoc.rust_sysroot", + "libcompiler_builtins.rust_sysroot", + "libcore.rust_sysroot", + ], product_available: true, vendor_available: true, + visibility: [ + "//external/rust/crates/sec1:__subpackages__", + "//external/rust/crates/spki:__subpackages__", + "//external/rust/crates/pkcs1:__subpackages__", + "//external/rust/crates/pkcs8:__subpackages__", + "//external/rust/crates/x509-cert:__subpackages__", + "//system/keymint:__subpackages__", + ] + , } diff --git a/cargo2android.json b/cargo2android.json index f708fb4..5a21e1d 100644 --- a/cargo2android.json +++ b/cargo2android.json @@ -5,5 +5,19 @@ ], "run": true, "vendor-available": true, - "features": "alloc,derive,flagset,oid,zeroize" + "features": "alloc,derive,flagset,oid,zeroize", + "variants": [ + { + }, + { + "device": true, + "alloc": 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..0d0b30d --- /dev/null +++ b/cargo2android_viz.bp @@ -0,0 +1,8 @@ +visibility: [ + "//external/rust/crates/sec1:__subpackages__", + "//external/rust/crates/spki:__subpackages__", + "//external/rust/crates/pkcs1:__subpackages__", + "//external/rust/crates/pkcs8:__subpackages__", + "//external/rust/crates/x509-cert:__subpackages__", + "//system/keymint:__subpackages__", +] |