summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Hung Hsieh <chh@google.com>2020-09-24 01:25:34 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-09-24 01:25:34 +0000
commit01e9d937b4060faaab77451d2950d1112d194d8e (patch)
tree8ef1a1691a599f2646e7578edf3d0a8645e234c3
parent319ecfb7b1f1887af54223be264131e925bc1469 (diff)
parentefcbcebf7fcdb40af2995c5f1b761f80d6ae4c35 (diff)
downloadproc-macro-nested-01e9d937b4060faaab77451d2950d1112d194d8e.tar.gz
Add post_update.sh am: daef00fd01 am: 565e216014 am: efcbcebf7f
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/proc-macro-nested/+/1434798 Change-Id: Ibc1b4b26ab8b2ba29d1bb0c91ba97c10171d81ec
-rwxr-xr-xpost_update.sh16
-rw-r--r--src/lib.rs4
2 files changed, 17 insertions, 3 deletions
diff --git a/post_update.sh b/post_update.sh
new file mode 100755
index 0000000..befd02c
--- /dev/null
+++ b/post_update.sh
@@ -0,0 +1,16 @@
+#!/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
diff --git a/src/lib.rs b/src/lib.rs
index 91089e0..a8b7694 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,9 +43,7 @@
// ANDROID: Use std to allow building as a dylib.
extern crate std;
-// ANDROID: count.rs generated and put in the out subdirectory.
-// include!(concat!(env!("OUT_DIR"), "/count.rs"));
-include!("../out/count.rs");
+include!("../out/count.rs"); // ANDROID
#[doc(hidden)]
#[macro_export]