Fixed update_source.sh script
Objenesis has moved from googlecode to github and the structure
has changed slightly; see previous commit. This change updates
the script to match. It also will update the README.version file
to ensure that it is up to date.
The tck-android/AndroidManifest.xml has moved to
tck-android/src/main/AndroidManifest.xml this change updates the
script to move it back in order for it to be found when
building ObjenesisTck.
Bug: 32912773
Test: Ran with ./update_source.sh 2.5 - see following commit
(cherry picked from commit 3c95c88031b5e7d709598fe86a036704c12e121a)
Change-Id: I91c141efd4b25da52d817504cd26dd23fb934f53
diff --git a/update_source.sh b/update_source.sh
index 7831e88..9526801 100755
--- a/update_source.sh
+++ b/update_source.sh
@@ -5,7 +5,22 @@
# Retrieves the current Objenesis source code into the current directory.
# Does not create a GIT commit.
-SOURCE="http://objenesis.googlecode.com/svn/trunk/"
+# 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="https://github.com/easymock/objenesis"
INCLUDE="
LICENSE.txt
main
@@ -13,11 +28,19 @@
tck-android
"
+EXCLUDE="
+ main/.settings/
+ tck-android/.settings
+ tck-android/lint.xml
+ tck-android/project.properties
+ "
+
working_dir="$(mktemp -d)"
-trap "echo \"Removing temporary directory\"; rm -rf $working_dir" EXIT
+#trap "echo \"Removing temporary directory\"; rm -rf $working_dir" EXIT
echo "Fetching Objenesis source into $working_dir"
-svn export -q $SOURCE $working_dir/source
+git clone $SOURCE $working_dir/source
+(cd $working_dir/source; git checkout $VERSION)
for include in ${INCLUDE}; do
echo "Updating $include"
@@ -25,5 +48,21 @@
cp -R $working_dir/source/$include .
done;
-echo "Done"
+for exclude in ${EXCLUDE}; do
+ echo "Excluding $exclude"
+ rm -r $exclude
+done;
+# Move the tck-android AndroidManifest.xml into the correct position.
+mv tck-android/src/main/AndroidManifest.xml tck-android/AndroidManifest.xml
+
+# Update the version and binary JAR URL.
+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"