aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Drysdale <drysdale@google.com>2023-10-03 10:57:37 +0100
committerDavid Drysdale <drysdale@google.com>2023-10-04 13:00:38 +0100
commit7944c99fec8ce2247e2e8119c2a375b9a665732a (patch)
tree0e3ff5f20e7fd43bb5cbe5aed15967652288a879
parentb5bfd823534e1c38e7232017f9cef732c4e93199 (diff)
downloadder-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.bp44
-rw-r--r--cargo2android.json16
-rw-r--r--cargo2android_viz.bp8
3 files changed, 67 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
index 89349e8..fb8c8bc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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__",
+]