1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#!/bin/bash
## TODO: One day, move all this into the build.xml file. The file tests are ripe for use by ant.
if test "$1" = "cleanlib"; then
rm libs/*
bzr revert libs/
fi
PROJECTROOT=$(bzr root || pwd)
ANDROIDBIN=$(which android)
if test -z "${DOWNLOADER}"; then which wget >/dev/null && DOWNLOADER="$(which wget) --no-verbose -O "; fi
if test -z "${DOWNLOADER}"; then which curl >/dev/null && DOWNLOADER="$(which curl) -o "; fi
if test -z "${ANDROIDBIN}"; then
echo "Android SDK tools not in PATH." >&2
echo " PATH=\$PATH:/PathToSDK/tools" >&2
return 1
fi
if test -z "${DOWNLOADER}"; then
echo "Need wget or curl to download." >&2
return 1
fi
GITBIN=$(which git)
if test -z "${GITBIN}"; then
echo "You need git to download GreenDroid lib." >&2
fi
trap "echo ' ==== Not Successful. ===='" EXIT
set -e
echo "Downloading dependencies."
pushd "${PROJECTROOT}"/libs
first() { printf -v $1 "%s" $2; }
general_download() {
local filename=$1
local urlstart=$2
echo " - ${filename}"
if test -f "${filename}" && file "${filename}" | grep -i "zip" >/dev/null; then
:
else
rm -f "${filename}"
first nearby_copy ../../*/libs/${filename} >/dev/null
cp -l "${nearby_copy}" . || ${DOWNLOADER} "${filename}" "${urlstart}/${filename}" >/dev/null
# Unzip Google Analytics:
if grep -i "analytics" "${filename}" >/dev/null; then
jarname="libGoogleAnalytics.jar"
unzip "${filename}" "${jarname}"
# Remove the zip file.
rm -f "${filename}"
filename="${jarname}"
fi
fi
file "${filename}" |grep -i "zip archive" >/dev/null
return $?
}
launchpad_jar_download() {
local project_name=$1
local project_rev=$2
general_download "${project_name}-${project_rev}.jar" "http://launchpad.net/${project_name}/trunk/${project_rev}/+download"
return $?
}
# If you add new downloadable jar files here, please add a wildcard to
# ".bzrignore" to match it in libs/ , and "bzr remove" the existing file if
# it's in the branch.
SIGNPOSTVER=1.2.1.1
general_download "signpost-core-${SIGNPOSTVER}.jar" "http://oauth-signpost.googlecode.com/files"
general_download "signpost-commonshttp4-${SIGNPOSTVER}.jar" "http://oauth-signpost.googlecode.com/files"
USSO_JAVA_CLIENT_REV=rev14
launchpad_jar_download "ubuntu-sso-java-client" "${USSO_JAVA_CLIENT_REV}"
GOOGLE_ANALYTICS_VER=1.2
general_download "GoogleAnalyticsAndroid_${GOOGLE_ANALYTICS_VER}.zip" "http://dl.google.com/gaformobileapps"
popd
echo "Updating local project files for this machine and SDK."
APILEVELID=$(android list target |grep "android-7"|cut -d " " -f 2)
test "${APILEVELID}" || { echo "Android SDK has no 2.1 API, (level 7). Please install. SDK/tools/android"; false; }
android update lib-project --path ../ubuntu-sso-android-client --target "${APILEVELID}"
echo
trap EXIT
|