Update script to match upstream structure

Also, updates the README.version file.

Bug: 32912773
Test: ./update_source.sh v2.7.13 - see following commit
Change-Id: Iaf64e33b6bdbf29bef2a1bb2c9652febc4979c37
diff --git a/update_source.sh b/update_source.sh
index c4d3e39..122fb3b 100755
--- a/update_source.sh
+++ b/update_source.sh
@@ -5,21 +5,31 @@
 # Retrieves the current Mockito source code into the current directory, excluding portions related
 # to mockito's internal build system and javadoc.
 
-VERSION=${1-master}
+# Force stop on first error.
+set -e
+
+if [ $# -ne 1 ]; then
+    echo "$0 <version>" >&2
+    exit 1;
+fi
+
+if [ -z "$ANDROID_BUILD_TOP" ]; then
+    echo "Missing environment variables. Did you run build/envsetup.sh and lunch?" >&2
+    exit 1
+fi
+
+VERSION=${1}
 
 SOURCE="git://github.com/mockito/mockito.git"
 INCLUDE="
     LICENSE
-    cglib-and-asm
     src
+    subprojects/android
     "
 
 EXCLUDE="
-    cglib-and-asm/lib
-    cglib-and-asm/.project
-    cglib-and-asm/.classpath
-    cglib-and-asm/build.gradle
-    cglib-and-asm/mockito-repackaged.iml
+    src/conf
+    src/javadoc
     "
 
 working_dir="$(mktemp -d)"
@@ -32,7 +42,8 @@
 for include in ${INCLUDE}; do
   echo "Updating $include"
   rm -rf $include
-  cp -R $working_dir/source/$include .
+  mkdir -p $(dirname $include)
+  cp -R $working_dir/source/$include $include
 done;
 
 for exclude in ${EXCLUDE}; do
@@ -42,3 +53,13 @@
 
 echo "Done"
 
+# Update the version.
+perl -pi -e "s|^Version: .*$|Version: ${VERSION}|" "README.version"
+
+# Remove any documentation about local modifications.
+mv README.version README.tmp
+grep -B 100 "Local Modifications" README.tmp > README.version
+echo "        None" >> README.version
+rm README.tmp
+
+echo "Done"