Create no_std builds of ciborium and dependencies am: aba717c00f

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/serde/+/23106377

Change-Id: I179961dbcc66bce7262a6fe881af06c90dee966f
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/Android.bp b/Android.bp
index d88ecc7..676732d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -63,6 +63,32 @@
     min_sdk_version: "29",
 }
 
+rust_library_rlib {
+    name: "libserde_nostd",
+    crate_name: "serde",
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.0.152",
+    srcs: ["src/lib.rs"],
+    edition: "2015",
+    prefer_rlib: true,
+    no_stdlibs: true,
+    stdlibs: [
+        "liballoc.rust_sysroot",
+        "libcompiler_builtins.rust_sysroot",
+        "libcore.rust_sysroot",
+    ],
+    features: [
+        "alloc",
+        "derive",
+        "serde_derive",
+    ],
+    proc_macros: ["libserde_derive"],
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
+}
+
 rust_test {
     name: "serde_test_src_lib",
     host_supported: true,
diff --git a/cargo2android.json b/cargo2android.json
index 8579ca9..89a0f3e 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,8 +1,5 @@
 {
-  "apex-available": [
-    "//apex_available:platform",
-    "//apex_available:anyapex"
-  ],
+  "add-toplevel-block": "cargo2android_nostd.bp",
   "cfg-blocklist": [
     "std_atomic64"
   ],
diff --git a/cargo2android_nostd.bp b/cargo2android_nostd.bp
new file mode 100644
index 0000000..d0e88d9
--- /dev/null
+++ b/cargo2android_nostd.bp
@@ -0,0 +1,25 @@
+rust_library_rlib {
+    name: "libserde_nostd",
+    crate_name: "serde",
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.0.152",
+    srcs: ["src/lib.rs"],
+    edition: "2015",
+    prefer_rlib: true,
+    no_stdlibs: true,
+    stdlibs: [
+        "liballoc.rust_sysroot",
+        "libcompiler_builtins.rust_sysroot",
+        "libcore.rust_sysroot",
+    ],
+    features: [
+        "alloc",
+        "derive",
+        "serde_derive",
+    ],
+    proc_macros: ["libserde_derive"],
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
+}