blob: d3d597ffd4fff5a21bd5847be60ee44341dce031 [file] [log] [blame]
The Android Open Source Project55a2c712009-03-03 19:29:09 -08001#!/bin/bash
2
3# Quick script used to setup Eclipse for the ADT plugin build.
4#
5# usage:
Raphael Moll15a72762010-12-09 19:17:15 -08006# setup_eclipse.sh [-p] <dest_dir>
7# -p: run Eclipse in the background and print its PID in dest_dir/eclipse.pid
The Android Open Source Project55a2c712009-03-03 19:29:09 -08008#
9# Workflow:
10# - downloads & unpack Eclipse if necessary
11# - *runs* it once
12
13
14#-----------------
15#
Raphael Mollb3719202010-11-23 01:18:20 -080016# Note: right now this is invoked by sdk/eclipse/doBuild.sh
The Android Open Source Project55a2c712009-03-03 19:29:09 -080017# and it *MUST* be invoked with the following destination directory:
18#
19# $ setup_eclipse.sh /buildbot/eclipse-android/3.4.0/
20#
21#-----------------
22
23
24set -e # abort this script early if any command fails
25
26function die() {
27 echo $@
28 exit 1
29}
30
Raphael Mollb3719202010-11-23 01:18:20 -080031V="--no-verbose"
32if [[ "$1" == "-v" ]]; then
33 V=""
34 shift
35fi
36
37if [[ "-p" == "$1" ]]; then
The Android Open Source Project55a2c712009-03-03 19:29:09 -080038 GET_PID="-p"
39 shift
40fi
41
Raphael Mollb3719202010-11-23 01:18:20 -080042
The Android Open Source Project55a2c712009-03-03 19:29:09 -080043BASE_DIR="$1"
44
Raphael Mollb3719202010-11-23 01:18:20 -080045[[ -n "$1" ]] || die "Usage: $0 <dest-dir>"
The Android Open Source Project55a2c712009-03-03 19:29:09 -080046
Raphael Moll15a72762010-12-09 19:17:15 -080047# URL for 3.5.2 RCP Linux 32 Bits. Includes GEF, WTP as needed.
Raphael9c014a82011-11-02 15:49:49 -070048DOWNLOAD_URL="http://download.eclipse.org/technology/epp/downloads/release/helios/SR2/eclipse-rcp-helios-SR2-linux-gtk-x86_64.tar.gz"
The Android Open Source Project55a2c712009-03-03 19:29:09 -080049
50BIN="$BASE_DIR/eclipse/eclipse" # path to installed binary
Raphael Moll15a72762010-12-09 19:17:15 -080051TARGZ="$BASE_DIR/${DOWNLOAD_URL##*/}" # base dir + filename of the download URL
The Android Open Source Project55a2c712009-03-03 19:29:09 -080052
Raphael Mollb3719202010-11-23 01:18:20 -080053if [[ ! -f "$BIN" ]]; then
The Android Open Source Project55a2c712009-03-03 19:29:09 -080054 echo "Downloading and installing Eclipse in $BASE_DIR."
55 mkdir -p "$BASE_DIR"
Raphael Mollb3719202010-11-23 01:18:20 -080056 wget --continue $V --output-document="$TARGZ" "$DOWNLOAD_URL"
The Android Open Source Project55a2c712009-03-03 19:29:09 -080057 echo "Unpacking $TARGZ"
58 (cd "$BASE_DIR" && tar xzf "$TARGZ")
Raphael Mollb3719202010-11-23 01:18:20 -080059
The Android Open Source Project55a2c712009-03-03 19:29:09 -080060 echo
61 echo "*** WARNING: To setup Eclipse correctly, it must be ran at least once manually"
62 echo "*** Eclipse will now start."
63 echo
Raphael Mollb3719202010-11-23 01:18:20 -080064 if [[ -n "$GET_PID" ]]; then
The Android Open Source Project55a2c712009-03-03 19:29:09 -080065 # if started from the automatic eclipse build, run Eclipse in the background
66 "$BIN" &
67 ECLIPSE_PID=$!
68 echo "*** Eclipse started in background with PID $ECLIPSE_PID"
69 echo "$ECLIPSE_PID" > "$BASE_DIR"/eclipse.pid
70 sleep 5 # give some time for Eclipse to start and setup its environment
71 else
72 # if started manually, run Eclipse in the foreground
73 "$BIN"
74 fi
75fi
Raphael Mollb3719202010-11-23 01:18:20 -080076