diff options
author | Chih-Hung Hsieh <chh@google.com> | 2020-10-26 20:47:36 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-10-26 20:47:36 +0000 |
commit | 78452f28ba441742bcf59390101ea6aa768f2341 (patch) | |
tree | 781361c8be30ac51b435318f0d119aaa5ef33b42 | |
parent | 825f6c6bc1c4e087328b4649474a9f79914c42e9 (diff) | |
parent | 905c18a920cc668e076d505df2f9f38ffb671200 (diff) | |
download | proc-macro-nested-78452f28ba441742bcf59390101ea6aa768f2341.tar.gz |
Use --copy-out to generate .bp file. am: 905c18a920
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/proc-macro-nested/+/1473516
Change-Id: I10b38ccbb742e0d191347eab3c94b7edcf297610
-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] |