blob: 4154bf8ab522be7f9a831f69b16e4bd75e36d6bf (
plain)
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
|
#!/bin/bash
# Quick script used to setup Eclipse for the ADT plugin build.
#
# usage:
# setup_eclipse.sh [-p] <dest_dir>
# -p: run Eclipse in the background and print its PID in dest_dir/eclipse.pid
#
# Workflow:
# - downloads & unpack Eclipse if necessary
# - *runs* it once
#-----------------
#
# Note: right now this is invoked by sdk/eclipse/doBuild.sh
# and it *MUST* be invoked with the following destination directory:
#
# $ setup_eclipse.sh /buildbot/eclipse-android/3.4.0/
#
#-----------------
set -e # abort this script early if any command fails
function die() {
echo $@
exit 1
}
V="--no-verbose"
if [[ "$1" == "-v" ]]; then
V=""
shift
fi
if [[ "-p" == "$1" ]]; then
GET_PID="-p"
shift
fi
BASE_DIR="$1"
[[ -n "$1" ]] || die "Usage: $0 <dest-dir>"
# URL for Eclipse Linux RCP.
DOWNLOAD_URL="http://download.eclipse.org/technology/epp/downloads/release/helios/SR2/eclipse-rcp-helios-SR2-linux-gtk-x86_64.tar.gz"
# URL for CDT
CDT_DOWNLOAD_URL="http://download.eclipse.org/tools/cdt/releases/helios/dist/cdt-master-7.0.2.zip"
BIN="$BASE_DIR/eclipse/eclipse" # path to installed binary
TARGZ="$BASE_DIR/${DOWNLOAD_URL##*/}" # base dir + filename of the download URL
CDTZIP="$BASE_DIR/${CDT_DOWNLOAD_URL##*/}"
if [[ ! -f "$BIN" ]]; then
echo "Downloading and installing Eclipse in $BASE_DIR."
mkdir -p "$BASE_DIR"
wget --continue $V --output-document="$TARGZ" "$DOWNLOAD_URL"
echo "Unpacking $TARGZ"
(cd "$BASE_DIR" && tar xzf "$TARGZ")
wget --continue $V --output-document="$CDTZIP" "$CDT_DOWNLOAD_URL"
echo "Unpacking $CDTZIP"
(cd "$BASE_DIR/eclipse" && unzip -o "$CDTZIP")
echo
echo "*** WARNING: To setup Eclipse correctly, it must be ran at least once manually"
echo "*** Eclipse will now start."
echo
if [[ -n "$GET_PID" ]]; then
# if started from the automatic eclipse build, run Eclipse in the background
"$BIN" &
ECLIPSE_PID=$!
echo "*** Eclipse started in background with PID $ECLIPSE_PID"
echo "$ECLIPSE_PID" > "$BASE_DIR"/eclipse.pid
sleep 5 # give some time for Eclipse to start and setup its environment
else
# if started manually, run Eclipse in the foreground
"$BIN"
fi
fi
|