aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp29
-rw-r--r--TEST_MAPPING16
-rw-r--r--cargo2android.json4
-rw-r--r--cargo2android_nostd.bp20
-rw-r--r--patches/std.diff3
-rw-r--r--src/lib.rs2
6 files changed, 63 insertions, 11 deletions
diff --git a/Android.bp b/Android.bp
index 34481ec..1610254 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,8 +1,6 @@
// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
-
-
package {
default_applicable_licenses: ["external_rust_crates_ciborium-io_license"],
}
@@ -32,4 +30,31 @@ rust_library {
"alloc",
"std",
],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+ product_available: true,
+ vendor_available: true,
+}
+
+rust_library_rlib {
+ name: "libciborium_io_nostd",
+ crate_name: "ciborium_io",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.2.0",
+ srcs: ["src/lib.rs"],
+ edition: "2021",
+ features: ["alloc"],
+ prefer_rlib: true,
+ no_stdlibs: true,
+ stdlibs: [
+ "liballoc.rust_sysroot",
+ "libcompiler_builtins.rust_sysroot",
+ "libcore.rust_sysroot",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
}
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 2f7de78..fe37418 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,13 +1,17 @@
// Generated by update_crate_tests.py for tests that depend on this crate.
{
- "presubmit": [
+ "imports": [
{
- "name": "libcert_request_validator_tests"
- }
- ],
- "presubmit-rust": [
+ "path": "external/rust/crates/ciborium-ll"
+ },
+ {
+ "path": "external/rust/crates/coset"
+ },
+ {
+ "path": "system/keymint/derive"
+ },
{
- "name": "libcert_request_validator_tests"
+ "path": "system/keymint/hal"
}
]
}
diff --git a/cargo2android.json b/cargo2android.json
index 479f52f..eb19901 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,6 +1,8 @@
{
+ "add-toplevel-block": "cargo2android_nostd.bp",
"device": true,
"features": "alloc,std,",
"run": true,
- "dependencies": true
+ "dependencies": true,
+ "vendor-available": true
}
diff --git a/cargo2android_nostd.bp b/cargo2android_nostd.bp
new file mode 100644
index 0000000..9712ce9
--- /dev/null
+++ b/cargo2android_nostd.bp
@@ -0,0 +1,20 @@
+rust_library_rlib {
+ name: "libciborium_io_nostd",
+ crate_name: "ciborium_io",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.2.0",
+ srcs: ["src/lib.rs"],
+ edition: "2021",
+ features: ["alloc"],
+ prefer_rlib: true,
+ no_stdlibs: true,
+ stdlibs: [
+ "liballoc.rust_sysroot",
+ "libcompiler_builtins.rust_sysroot",
+ "libcore.rust_sysroot",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+}
diff --git a/patches/std.diff b/patches/std.diff
index fcb2329..d27ac7c 100644
--- a/patches/std.diff
+++ b/patches/std.diff
@@ -5,7 +5,8 @@ index c887e19..0594e8c 100644
@@ -19,6 +19,8 @@
#![deny(clippy::all)]
#![deny(clippy::cargo)]
-
+ -
+ +#[cfg(android_dylib)]
+extern crate std;
+
#[cfg(feature = "alloc")]
diff --git a/src/lib.rs b/src/lib.rs
index 0594e8c..80125bf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,7 +18,7 @@
#![deny(missing_docs)]
#![deny(clippy::all)]
#![deny(clippy::cargo)]
-
+#[cfg(android_dylib)]
extern crate std;
#[cfg(feature = "alloc")]