Use cargo2android.py with a patch file.
* No need to manually fix the .bp file after a version upgrade.
* post_update.sh is no longer needed.
Bug: 172093078
Test: make and regenerate .bp
Change-Id: I72e06f0a59c281211b21bb5b2891f9123da73457
diff --git a/Android.bp b/Android.bp
index 277296f..a55ed6d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --run --device --dependencies.
+// This file is generated by cargo2android.py --run --device --dependencies --patch=patches/Android.bp.patch.
rust_library {
name: "libserde",
diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch
new file mode 100644
index 0000000..4f03f0b
--- /dev/null
+++ b/patches/Android.bp.patch
@@ -0,0 +1,12 @@
+diff --git b/Android.bp a/Android.bp
+index 41d67cc..277296f 100644
+--- b/Android.bp
++++ a/Android.bp
+@@ -23,6 +23,6 @@ rust_library {
+ "--cfg ops_bound",
+ "--cfg range_inclusive",
+ "--cfg std_atomic",
+- "--cfg std_atomic64",
++ // "--cfg std_atomic64", // not for arm/arm64
+ ],
+ }
diff --git a/post_update.sh b/post_update.sh
deleted file mode 100755
index 7de4f29..0000000
--- a/post_update.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-# $1 Path to the new version.
-# $2 Path to the old version.
-
-set -x
-set -e
-
-# work around missing std_atomic64 on arm/arm64
-SRCFILE=Android.bp
-OLDSTR='"--cfg std_atomic64",'
-NEWSTR='// "--cfg std_atomic64", // not for arm/arm64'
-sed -i -e "s:$OLDSTR:$NEWSTR:" $SRCFILE
-# Make sure that sed replaced $OLDSTR with $NEWSTR
-grep "$NEWSTR" $SRCFILE > /dev/null