blob: 5143e23268b163e6093b3b6757789e0e214d966c [file] [log] [blame]
The Android Open Source Project52d4c302009-03-03 19:29:09 -08001#!/bin/bash
2
3# Quick script used to setup Eclipse for the ADT plugin build.
4#
5# usage:
6# setup_eclipse.sh <dest_dir>
7#
8# Workflow:
9# - downloads & unpack Eclipse if necessary
10# - *runs* it once
11
12
13#-----------------
14#
15# Note: right now this is invoked by //device/tools/eclipse/doBuild.sh
16# and it *MUST* be invoked with the following destination directory:
17#
18# $ setup_eclipse.sh /buildbot/eclipse-android/3.4.0/
19#
20#-----------------
21
22
23set -e # abort this script early if any command fails
24
25function die() {
26 echo $@
27 exit 1
28}
29
30if [ "-p" == "$1" ]; then
31 GET_PID="-p"
32 shift
33fi
34
35BASE_DIR="$1"
36
37[ -n "$1" ] || die "Usage: $0 <dest-dir>"
38
39# URL for 3.4.0 RCP Linux 32 Bits. Includes GEF, WTP as needed.
40DOWNLOAD_URL="http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/ganymede/R/eclipse-rcp-ganymede-linux-gtk.tar.gz&url=http://eclipse.unixheads.org/technology/epp/downloads/release/ganymede/R/eclipse-rcp-ganymede-linux-gtk.tar.gz&mirror_id=480"
41
42BIN="$BASE_DIR/eclipse/eclipse" # path to installed binary
43TARGZ="$BASE_DIR/eclipse-rcp-ganymede-linux-gtk.tar.gz"
44
45if [ ! -f "$BIN" ]; then
46 echo "Downloading and installing Eclipse in $BASE_DIR."
47 mkdir -p "$BASE_DIR"
48 wget --continue --no-verbose --output-document="$TARGZ" "$DOWNLOAD_URL"
49 echo "Unpacking $TARGZ"
50 (cd "$BASE_DIR" && tar xzf "$TARGZ")
51
52 echo
53 echo "*** WARNING: To setup Eclipse correctly, it must be ran at least once manually"
54 echo "*** Eclipse will now start."
55 echo
56 if [ -n "$GET_PID" ]; then
57 # if started from the automatic eclipse build, run Eclipse in the background
58 "$BIN" &
59 ECLIPSE_PID=$!
60 echo "*** Eclipse started in background with PID $ECLIPSE_PID"
61 echo "$ECLIPSE_PID" > "$BASE_DIR"/eclipse.pid
62 sleep 5 # give some time for Eclipse to start and setup its environment
63 else
64 # if started manually, run Eclipse in the foreground
65 "$BIN"
66 fi
67fi