blob: 9526801a6d39dc0bdb9499a2fc6abc8b139eeab5 [file] [log] [blame]
Ian Parkinsonf7b455e2013-01-30 18:38:43 +00001#!/bin/bash
2#
3# Copyright 2013 The Android Open Source Project.
4#
5# Retrieves the current Objenesis source code into the current directory.
6# Does not create a GIT commit.
7
Paul Duffinf51a26a2017-03-07 14:21:29 +00008# Force stop on first error.
9set -e
10
11if [ $# -ne 1 ]; then
12 echo "$0 <version>" >&2
13 exit 1;
14fi
15
16if [ -z "$ANDROID_BUILD_TOP" ]; then
17 echo "Missing environment variables. Did you run build/envsetup.sh and lunch?" >&2
18 exit 1
19fi
20
21VERSION=${1}
22
23SOURCE="https://github.com/easymock/objenesis"
Ian Parkinsonf7b455e2013-01-30 18:38:43 +000024INCLUDE="
25 LICENSE.txt
26 main
27 tck
28 tck-android
29 "
30
Paul Duffinf51a26a2017-03-07 14:21:29 +000031EXCLUDE="
32 main/.settings/
33 tck-android/.settings
34 tck-android/lint.xml
35 tck-android/project.properties
36 "
37
Ian Parkinsonf7b455e2013-01-30 18:38:43 +000038working_dir="$(mktemp -d)"
Paul Duffinf51a26a2017-03-07 14:21:29 +000039#trap "echo \"Removing temporary directory\"; rm -rf $working_dir" EXIT
Ian Parkinsonf7b455e2013-01-30 18:38:43 +000040
41echo "Fetching Objenesis source into $working_dir"
Paul Duffinf51a26a2017-03-07 14:21:29 +000042git clone $SOURCE $working_dir/source
43(cd $working_dir/source; git checkout $VERSION)
Ian Parkinsonf7b455e2013-01-30 18:38:43 +000044
45for include in ${INCLUDE}; do
46 echo "Updating $include"
47 rm -rf $include
48 cp -R $working_dir/source/$include .
49done;
50
Paul Duffinf51a26a2017-03-07 14:21:29 +000051for exclude in ${EXCLUDE}; do
52 echo "Excluding $exclude"
53 rm -r $exclude
54done;
Ian Parkinsonf7b455e2013-01-30 18:38:43 +000055
Paul Duffinf51a26a2017-03-07 14:21:29 +000056# Move the tck-android AndroidManifest.xml into the correct position.
57mv tck-android/src/main/AndroidManifest.xml tck-android/AndroidManifest.xml
58
59# Update the version and binary JAR URL.
60perl -pi -e "s|^Version: .*$|Version: ${VERSION}|" "README.version"
61
62# Remove any documentation about local modifications.
63mv README.version README.tmp
64grep -B 100 "Local Modifications" README.tmp > README.version
65echo " None" >> README.version
66rm README.tmp
67
68echo "Done"