Add post_update.sh
* Include out/count.rs in src/lib.rs.
* Update src/lib.rs to match simple post_update.sh output.
Bug: 169118732
Test: tools/external_updater/updater.sh update rust/crates/proc-macro-nested
Test: mm in external/rust/crates/proc-macro-nested
Change-Id: I6fb8637205bc0742e35ef222362a459e483e4cd4
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]