summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2017-03-15 17:14:30 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-15 17:14:30 +0000
commit2ec0ef53c0f54d6d5b92d2bd88254f51e3b89369 (patch)
tree2c6c110ca0e0c17f35d624844536e3c2ace50f2d
parent9ef9c0c8f188eff7a655e009de77a39845a2cb31 (diff)
parentf730d7767ba3113d6439cc036020e17846a17ce1 (diff)
downloadmockito-2ec0ef53c0f54d6d5b92d2bd88254f51e3b89369.tar.gz
Merge "Update script to match upstream structure" am: 34c934f7dd am: 71deb5ab06
am: f730d7767b Change-Id: I319a37788231d195424f9717feae76cad66efd36
-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"