aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2020-12-04 14:18:07 +0100
committerJeff Vander Stoep <jeffv@google.com>2020-12-04 14:18:07 +0100
commite595b63c7542df5941c7701feaf9b1e82919e80e (patch)
tree972121bef91fceefc4fe70302f6e75d132c451a4
parent10c89c58562f8e90c25e7573096e71dc83dc4786 (diff)
downloaduntrusted-e595b63c7542df5941c7701feaf9b1e82919e80e.tar.gz
Add Android.bp
And patch file to include std crate. Test: mm Bug: 155855709 Change-Id: I3c662624df1cf78a089829e9acacf02923c94912
-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.