log: Create liblog_rust_nostd bare-metal target
We want to use the log crate in a no-std environment. Create a variant
of the liblog_rust target that does not specify the 'std' feature.
Test: m liblog_rust_nostd
Change-Id: I9acf539736b575ba388de0d66379c1e03bbc04a5
diff --git a/Android.bp b/Android.bp
index e96d563..f75e6b8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -62,3 +62,25 @@
vendor_available: true,
min_sdk_version: "29",
}
+
+rust_library {
+ name: "liblog_rust_nostd",
+ crate_name: "log",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.4.14",
+ srcs: ["src/lib.rs"],
+ edition: "2015",
+ cfgs: [
+ "atomic_cas",
+ "has_atomics",
+ ],
+ rustlibs: [
+ "libcfg_if",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.virt",
+ ],
+ min_sdk_version: "29",
+}
+
diff --git a/cargo2android.json b/cargo2android.json
index 11f62b6..792a0d1 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,4 +1,5 @@
{
+ "add-toplevel-block": "cargo2android_nostd.bp",
"apex-available": [
"//apex_available:platform",
"//apex_available:anyapex"
diff --git a/cargo2android_nostd.bp b/cargo2android_nostd.bp
new file mode 100644
index 0000000..5fc0d14
--- /dev/null
+++ b/cargo2android_nostd.bp
@@ -0,0 +1,20 @@
+rust_library {
+ name: "liblog_rust_nostd",
+ crate_name: "log",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.4.14",
+ srcs: ["src/lib.rs"],
+ edition: "2015",
+ cfgs: [
+ "atomic_cas",
+ "has_atomics",
+ ],
+ rustlibs: [
+ "libcfg_if",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.virt",
+ ],
+ min_sdk_version: "29",
+}