diff options
author | Paul Duffin <paulduffin@google.com> | 2017-03-15 16:56:30 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-03-15 16:56:31 +0000 |
commit | 34c934f7dd86d720023edf3161b115658f1d0256 (patch) | |
tree | b9f842fad1359dafc9f1e4f46799289412300161 | |
parent | 4f00a506f3bc2033aafbfa1d14436d7131031bf4 (diff) | |
parent | 616bf64e24452e7919d8379dcc408ced0d86bbd2 (diff) | |
download | mockito-34c934f7dd86d720023edf3161b115658f1d0256.tar.gz |
Merge "Update script to match upstream structure"android-n-mr2-preview-2
-rwxr-xr-x | update_source.sh | 37 |
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" |