diff options
author | Raphael Moll <raphael@google.com> | 2013-10-14 12:37:33 -0700 |
---|---|---|
committer | Raphaƫl Moll <ralf@android.com> | 2013-10-14 22:51:12 +0000 |
commit | 0b331dd30515d5adbfe697f9035e36858be1bd58 (patch) | |
tree | 39a0b7eb5b9e6dff9d03323c0dee58a4df417796 /eclipse/scripts/update_version.sh | |
parent | 1343e0d08b4b58d30f90c10c9b93bb61ee38d6e1 (diff) | |
download | sdk-0b331dd30515d5adbfe697f9035e36858be1bd58.zip sdk-0b331dd30515d5adbfe697f9035e36858be1bd58.tar.gz sdk-0b331dd30515d5adbfe697f9035e36858be1bd58.tar.bz2 |
Switch ADT to version 22.3
Change-Id: I14e95b886f39ffc73f14fbe201e7936e4fe57778
(cherry picked from commit 6598a14ec6f0bd983d22aef0c7bc1cfed66efb40)
Diffstat (limited to 'eclipse/scripts/update_version.sh')
-rwxr-xr-x | eclipse/scripts/update_version.sh | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/eclipse/scripts/update_version.sh b/eclipse/scripts/update_version.sh index 855b97c..88a0e6c 100755 --- a/eclipse/scripts/update_version.sh +++ b/eclipse/scripts/update_version.sh @@ -2,7 +2,6 @@ OLD="$1" NEW="$2" -REALOLD="$1" # sanity check in input args if [ -z "$OLD" ] || [ -z "$NEW" ]; then @@ -22,22 +21,48 @@ if [ `basename "$PWD"` != "eclipse" ]; then exit 1 fi + +function replace() { + if [[ -f "$1" ]]; then + echo "### Change $SED_OLD => $SED_NEW in $1" + if [[ $(uname) == "Linux" ]]; then + sed -i "s/$SED_OLD/$SED_NEW/g" "$1" + else + # sed on Mac doesn't handle -i the same way as on Linux + sed -i "" "s/$SED_OLD/$SED_NEW/g" "$1" + fi + fi +} + +# ---1--- Change Eclipse's qualified version numbers # quote dots for regexps -OLD="${OLD//./\.}\.qualifier" -NEW="${NEW//./\.}\.qualifier" - -# Now find the same files but this time use sed to replace in-place with -# the new pattern. Old files get backuped with the .old extension. -if [[ $(uname) == "Linux" ]]; then - grep -rl "$OLD" * | grep -E "\.xml$|\.MF$" | xargs -n 1 sed -i "s/$OLD/$NEW/g" -else - # sed on Mac doesn't handle -i the same way as on Linux - grep -rl "$OLD" * | grep -E "\.xml$|\.MF$" | xargs -n 1 sed -i "" "s/$OLD/$NEW/g" -fi +SED_OLD="${OLD//./\.}\.qualifier" +SED_NEW="${NEW//./\.}\.qualifier" + +for i in $(grep -rl "$OLD" * | grep -E "\.xml$|\.MF$"); do + if [[ -f "$i" && $(basename "$i") != "build.xml" ]]; then + replace "$i" + fi +done + +# ---2--- Change unqualified version numbers in specific files +SED_OLD="${OLD//./\.}" +SED_NEW="${NEW//./\.}" +for i in plugins/com.android.ide.eclipse.adt.package/ide.product \ + plugins/com.android.ide.eclipse.monitor/monitor.product \ + plugins/com.android.ide.eclipse.monitor/plugin.properties; do + if grep -qs "$OLD" "$i"; then + replace "$i" + fi +done -echo "Remaining instances of $REALOLD" # do another grep for older version without the qualifier. We don't # want to replace those automatically as it could be something else. -# Printing out occurence helps find ones to update manually. -grep -r "$REALOLD" * +# Printing out occurence helps find ones to update manually, but exclude +# some known useless files. +echo +echo "#### ----------------" +echo "#### Remaining instances of $OLD" +echo +grep -r "$OLD" * | grep -v -E "/build.xml:|/javaCompiler\.\.\.args:" |