aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Drysdale <drysdale@google.com>2023-10-04 12:31:27 +0100
committerDavid Drysdale <drysdale@google.com>2023-10-04 12:31:27 +0100
commite785f6b306b1d277d68509cb2284b8810d3f852e (patch)
tree75cf40db7a09408f32eb2fe958af79e44dac6e39
parent0257fa1943d6a01aac5cf62efca0fb8c36eeb71d (diff)
downloadsec1-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.bp34
-rw-r--r--cargo2android.json15
-rw-r--r--cargo2android_viz.bp3
3 files changed, 51 insertions, 1 deletions
diff --git a/Android.bp b/Android.bp
index 068693a..a229c53 100644
--- a/Android.bp
+++ b/Android.bp
@@ -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__",
+]