diff options
author | Chih-Hung Hsieh <chh@google.com> | 2020-10-26 22:07:12 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-10-26 22:07:12 +0000 |
commit | 2b0e7c7af3cae08025927f813500d4ef4005f57c (patch) | |
tree | 781361c8be30ac51b435318f0d119aaa5ef33b42 | |
parent | 60cae3a9c90f6f670f8b8fe9446f391b1a1ef480 (diff) | |
parent | 601b1c60af865c8cf184bd61ce4138f28512d24b (diff) | |
download | proc-macro-nested-2b0e7c7af3cae08025927f813500d4ef4005f57c.tar.gz |
Use --copy-out to generate .bp file. am: 905c18a920 am: 78452f28ba am: c2e67bb2db am: 601b1c60af
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/proc-macro-nested/+/1473516
Change-Id: I9d67ced8f37a7a3dda3edaac2312ddf4b5836d63
-rw-r--r-- | Android.bp | 19 | ||||
-rw-r--r-- | patches/std.diff | 14 | ||||
-rwxr-xr-x | post_update.sh | 16 | ||||
-rw-r--r-- | src/lib.rs | 2 |
4 files changed, 31 insertions, 20 deletions
@@ -1,17 +1,30 @@ -// This file is generated by cargo2android.py --run --device --dependencies --tests. +// This file is generated by cargo2android.py --run --device --dependencies --tests --copy-out. + +genrule { + name: "copy_proc-macro-nested_build_out", + srcs: ["out/*"], + cmd: "cp $(in) $(genDir)", + out: ["count.rs"], +} rust_library { name: "libproc_macro_nested", host_supported: true, crate_name: "proc_macro_nested", - srcs: ["src/lib.rs"], + srcs: [ + "src/lib.rs", + ":copy_proc-macro-nested_build_out", + ], edition: "2015", } rust_defaults { name: "proc-macro-nested_defaults", crate_name: "proc_macro_nested", - srcs: ["src/lib.rs"], + srcs: [ + "src/lib.rs", + ":copy_proc-macro-nested_build_out", + ], test_suites: ["general-tests"], auto_gen_config: true, edition: "2015", diff --git a/patches/std.diff b/patches/std.diff new file mode 100644 index 0000000..6d71af2 --- /dev/null +++ b/patches/std.diff @@ -0,0 +1,14 @@ +diff --git a/src/lib.rs b/src/lib.rs +index 9ec6df0..0cd8302 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -40,6 +40,9 @@ + + #![no_std] + ++// ANDROID: Use std to allow building as a dylib. ++extern crate std; ++ + include!(concat!(env!("OUT_DIR"), "/count.rs")); + + #[doc(hidden)] diff --git a/post_update.sh b/post_update.sh deleted file mode 100755 index befd02c..0000000 --- a/post_update.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# $1 Path to the new version. -# $2 Path to the old version. - -set -x -set -e - -# out/count.rs should be copied after cargo build. -# Change src/lib.rs to include files from ../out/ -SRCFILE=src/lib.rs -OLDSTR='include!(concat!(env!("OUT_DIR"), "/count.rs"));' -NEWSTR='include!("../out/count.rs"); // ANDROID' -sed -i -e "s:$OLDSTR:$NEWSTR:" $SRCFILE -# Make sure that sed replaced $OLDSTR with $NEWSTR -grep "$NEWSTR" $SRCFILE > /dev/null @@ -43,7 +43,7 @@ // ANDROID: Use std to allow building as a dylib. extern crate std; -include!("../out/count.rs"); // ANDROID +include!(concat!(env!("OUT_DIR"), "/count.rs")); #[doc(hidden)] #[macro_export] |