summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2017-03-07 13:53:48 +0000
committerPaul Duffin <paulduffin@google.com>2017-03-14 14:36:04 +0000
commit616bf64e24452e7919d8379dcc408ced0d86bbd2 (patch)
treeb9f842fad1359dafc9f1e4f46799289412300161
parent4f00a506f3bc2033aafbfa1d14436d7131031bf4 (diff)
downloadmockito-616bf64e24452e7919d8379dcc408ced0d86bbd2.tar.gz
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
-rwxr-xr-xupdate_source.sh37
1 files changed, 29 insertions, 8 deletions
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 @@ git clone $SOURCE $working_dir/source
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 @@ done;
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"