• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/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
8# 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"
24INCLUDE="
25    LICENSE.txt
26    main
27    tck
28    tck-android
29    "
30
31EXCLUDE="
32    main/.settings/
33    tck-android/.settings
34    tck-android/lint.xml
35    tck-android/project.properties
36    "
37
38working_dir="$(mktemp -d)"
39#trap "echo \"Removing temporary directory\"; rm -rf $working_dir" EXIT
40
41echo "Fetching Objenesis source into $working_dir"
42git clone $SOURCE $working_dir/source
43(cd $working_dir/source; git checkout $VERSION)
44
45for include in ${INCLUDE}; do
46  echo "Updating $include"
47  rm -rf $include
48  cp -R $working_dir/source/$include .
49done;
50
51for exclude in ${EXCLUDE}; do
52  echo "Excluding $exclude"
53  rm -r $exclude
54done;
55
56# 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"
69