aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2020-12-07 17:32:58 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-12-07 17:32:58 +0000
commit86f31258c7dd846b50b6052914c924d7b784498f (patch)
tree972121bef91fceefc4fe70302f6e75d132c451a4
parent850c55d12c61a71b08420cc31429f937e3474a54 (diff)
parent6aa137e85bd01af91bdbe6acb6a614e15bbbae86 (diff)
downloaduntrusted-86f31258c7dd846b50b6052914c924d7b784498f.tar.gz
Add Android.bp am: e595b63c75 am: 6aa137e85b
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/untrusted/+/1517421 Change-Id: I4a5ddacb5ece553ab3c520f3aa9c24af5b996d94
-rw-r--r--Android.bp50
-rw-r--r--patches/std.diff14
-rw-r--r--src/untrusted.rs3
3 files changed, 67 insertions, 0 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..52ab13d
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,50 @@
+// This file is generated by cargo2android.py --run --device --dependencies --tests.
+
+rust_library {
+ name: "libuntrusted",
+ host_supported: true,
+ crate_name: "untrusted",
+ srcs: ["src/untrusted.rs"],
+ edition: "2018",
+}
+
+rust_defaults {
+ name: "untrusted_defaults",
+ crate_name: "untrusted",
+ srcs: ["src/untrusted.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2018",
+}
+
+rust_test_host {
+ name: "untrusted_host_test_src_untrusted",
+ defaults: ["untrusted_defaults"],
+}
+
+rust_test {
+ name: "untrusted_device_test_src_untrusted",
+ defaults: ["untrusted_defaults"],
+}
+
+rust_defaults {
+ name: "untrusted_defaults_tests",
+ crate_name: "tests",
+ srcs: ["tests/tests.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2018",
+ rustlibs: [
+ "libuntrusted",
+ ],
+}
+
+rust_test_host {
+ name: "untrusted_host_test_tests_tests",
+ defaults: ["untrusted_defaults_tests"],
+}
+
+rust_test {
+ name: "untrusted_device_test_tests_tests",
+ defaults: ["untrusted_defaults_tests"],
+}
diff --git a/patches/std.diff b/patches/std.diff
new file mode 100644
index 0000000..e3ebe5e
--- /dev/null
+++ b/patches/std.diff
@@ -0,0 +1,14 @@
+diff --git a/src/untrusted.rs b/src/untrusted.rs
+index 2f88bb4..b9f1439 100644
+--- a/src/untrusted.rs
++++ b/src/untrusted.rs
+@@ -102,6 +102,9 @@
+ )]
+ #![no_std]
+
++// ANDROID: Unconditionally use std to allow building as a dylib.
++extern crate std;
++
+ /// A wrapper around `&'a [u8]` that helps in writing panic-free code.
+ ///
+ /// No methods of `Input` will ever panic.
diff --git a/src/untrusted.rs b/src/untrusted.rs
index 2f88bb4..b9f1439 100644
--- a/src/untrusted.rs
+++ b/src/untrusted.rs
@@ -102,6 +102,9 @@
)]
#![no_std]
+// ANDROID: Unconditionally use std to allow building as a dylib.
+extern crate std;
+
/// A wrapper around `&'a [u8]` that helps in writing panic-free code.
///
/// No methods of `Input` will ever panic.