aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2023-02-07 02:40:41 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-02-07 02:40:41 +0000
commit45b7e3978f8e6e42005e96c1bb4cf74257b674b5 (patch)
tree3129376b3129de357b55d6bb85cb5d7fb51d2d65
parent9ec9176f9f877ea8fc4dbc37277e3217847a87b4 (diff)
parent0ae5a64f116d46913911556d93275fa9ba8d6468 (diff)
downloadzerocopy-45b7e3978f8e6e42005e96c1bb4cf74257b674b5.tar.gz
libzerocopy w/o nostd am: 0ae5a64f11
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/zerocopy/+/2423806 Change-Id: Ic5829a71f8eb6380a6538d3d9427c39e6c95583f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--Android.bp31
-rw-r--r--cargo2android.json4
-rw-r--r--cargo2android_nostd.bp17
-rw-r--r--patches/Android.bp.patch15
4 files changed, 44 insertions, 23 deletions
diff --git a/Android.bp b/Android.bp
index 8a78897..562ee9c 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_zerocopy_license"],
}
@@ -20,16 +18,16 @@ license {
],
}
-rust_library_rlib {
+rust_library {
name: "libzerocopy",
+ host_supported: true,
crate_name: "zerocopy",
cargo_env_compat: true,
cargo_pkg_version: "0.6.1",
srcs: ["src/lib.rs"],
edition: "2018",
- no_stdlibs: true,
rustlibs: [
- "libbyteorder_nostd",
+ "libbyteorder",
],
proc_macros: ["libzerocopy_derive"],
apex_available: [
@@ -40,12 +38,16 @@ rust_library_rlib {
rust_test {
name: "zerocopy_test_src_lib",
+ host_supported: true,
crate_name: "zerocopy",
cargo_env_compat: true,
cargo_pkg_version: "0.6.1",
srcs: ["src/lib.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
+ test_options: {
+ unit_test: true,
+ },
edition: "2018",
rustlibs: [
"libbyteorder",
@@ -53,3 +55,22 @@ rust_test {
],
proc_macros: ["libzerocopy_derive"],
}
+
+rust_library_rlib {
+ name: "libzerocopy_nostd",
+ crate_name: "zerocopy",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.6.1",
+ srcs: ["src/lib.rs"],
+ edition: "2018",
+ no_stdlibs: true,
+ rustlibs: [
+ "libbyteorder_nostd",
+ ],
+ proc_macros: ["libzerocopy_derive"],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+}
+
diff --git a/cargo2android.json b/cargo2android.json
index 8ee6367..c5c89d8 100644
--- a/cargo2android.json
+++ b/cargo2android.json
@@ -1,8 +1,6 @@
{
+ "add-toplevel-block": "cargo2android_nostd.bp",
"device": true,
- "force-rlib": true,
- "no-host": true,
- "patch": "patches/Android.bp.patch",
"run": true,
"tests": true
}
diff --git a/cargo2android_nostd.bp b/cargo2android_nostd.bp
new file mode 100644
index 0000000..2649817
--- /dev/null
+++ b/cargo2android_nostd.bp
@@ -0,0 +1,17 @@
+rust_library_rlib {
+ name: "libzerocopy_nostd",
+ crate_name: "zerocopy",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.6.1",
+ srcs: ["src/lib.rs"],
+ edition: "2018",
+ no_stdlibs: true,
+ rustlibs: [
+ "libbyteorder_nostd",
+ ],
+ proc_macros: ["libzerocopy_derive"],
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+}
diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch
deleted file mode 100644
index f85efc3..0000000
--- a/patches/Android.bp.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/Android.bp b/Android.bp
-index 97a1493..314d50b 100644
---- a/Android.bp
-+++ b/Android.bp
-@@ -10,8 +10,9 @@ rust_library_rlib {
- cargo_pkg_version: "0.6.1",
- srcs: ["src/lib.rs"],
- edition: "2018",
-+ no_stdlibs: true,
- rustlibs: [
-- "libbyteorder",
-+ "libbyteorder_nostd",
- ],
- proc_macros: ["libzerocopy_derive"],
- apex_available: [