aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Williams <christianw@google.com>2018-04-09 19:40:39 -0700
committerChristian Williams <christianw@google.com>2018-08-15 11:55:59 -0700
commit15a1e837c251a3e38d3420b6eb87f98770362467 (patch)
treeb8f6a0afd8f53736b6950da8bd3f98368d878c81 /scripts
parent2688c0ee59a76204ee1f0c10dc7679abd9df02d1 (diff)
downloadrobolectric-15a1e837c251a3e38d3420b6eb87f98770362467.tar.gz
Update native source version numbers, add update-cpp.sh script.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update-cpp.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/update-cpp.sh b/scripts/update-cpp.sh
new file mode 100755
index 000000000..ecf2c6ec3
--- /dev/null
+++ b/scripts/update-cpp.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+set -e
+
+currentVersion=android-8.0.0_r36
+#currentVersion=android-8.1.0_r22
+
+baseDir=`dirname $0`/..
+frameworksBaseRepoDir="$HOME/Dev/Android/base"
+
+function showDiffs2() {
+ file="$1"
+ line="$2"
+
+ x=$(echo "$line" | sed -e 's/.*https:\/\/android.googlesource.com\/\([^ ]*\)\/[+]\/\([^/]*\)\/\([^ ]*\).*/\1 \2 \3/')
+ IFS=" " read -a parts <<< "$x"
+ repo="${parts[0]}"
+ version="${parts[1]}"
+ file="${parts[2]}"
+
+ curSha=$(cd "$frameworksBaseRepoDir" && git rev-parse --verify "$currentVersion") || true
+ if [[ -z "$curSha" ]]; then
+ echo "Unknown $currentVersion!"
+ exit 1
+ fi
+
+ thisSha=$(cd "$frameworksBaseRepoDir" && git rev-parse --verify "$version") || true
+ if [[ -z "$thisSha" ]]; then
+ echo "Unknown $version!"
+ return
+ fi
+
+ if [ "x$curSha" != "x$thisSha" ]; then
+ echo "Apply changes to: $file"
+ (cd "$frameworksBaseRepoDir" && git diff "${version}..${currentVersion}" "$file")
+ fi
+}
+
+function showDiffs() {
+ file="$1"
+
+ grep "https://android.googlesource.com" "$file" | while read -r line ; do
+ showDiffs2 "$file" "$line"
+ done
+}
+
+files=$*
+
+if [ -z "$files" ]; then
+ find . -name "*.java" -print0 | while read -d $'\0' file; do
+ showDiffs "$file"
+ done
+else
+ for file in "$files"; do
+ showDiffs "$file"
+ done
+fi \ No newline at end of file