| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Quick script used to setup Eclipse for the ADT plugin build. |
| 4 | # |
| 5 | # usage: |
| Raphael Moll | 15a7276 | 2010-12-09 19:17:15 -0800 | [diff] [blame] | 6 | # 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 Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 8 | # |
| 9 | # Workflow: |
| 10 | # - downloads & unpack Eclipse if necessary |
| 11 | # - *runs* it once |
| 12 | |
| 13 | |
| 14 | #----------------- |
| 15 | # |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 16 | # Note: right now this is invoked by sdk/eclipse/doBuild.sh |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 17 | # 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 | |
| 24 | set -e # abort this script early if any command fails |
| 25 | |
| 26 | function die() { |
| 27 | echo $@ |
| 28 | exit 1 |
| 29 | } |
| 30 | |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 31 | V="--no-verbose" |
| 32 | if [[ "$1" == "-v" ]]; then |
| 33 | V="" |
| 34 | shift |
| 35 | fi |
| 36 | |
| 37 | if [[ "-p" == "$1" ]]; then |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 38 | GET_PID="-p" |
| 39 | shift |
| 40 | fi |
| 41 | |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 42 | |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 43 | BASE_DIR="$1" |
| 44 | |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 45 | [[ -n "$1" ]] || die "Usage: $0 <dest-dir>" |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 46 | |
| Raphael Moll | 15a7276 | 2010-12-09 19:17:15 -0800 | [diff] [blame] | 47 | # URL for 3.5.2 RCP Linux 32 Bits. Includes GEF, WTP as needed. |
| Raphael | 9c014a8 | 2011-11-02 15:49:49 -0700 | [diff] [blame^] | 48 | DOWNLOAD_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 Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 49 | |
| 50 | BIN="$BASE_DIR/eclipse/eclipse" # path to installed binary |
| Raphael Moll | 15a7276 | 2010-12-09 19:17:15 -0800 | [diff] [blame] | 51 | TARGZ="$BASE_DIR/${DOWNLOAD_URL##*/}" # base dir + filename of the download URL |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 52 | |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 53 | if [[ ! -f "$BIN" ]]; then |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 54 | echo "Downloading and installing Eclipse in $BASE_DIR." |
| 55 | mkdir -p "$BASE_DIR" |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 56 | wget --continue $V --output-document="$TARGZ" "$DOWNLOAD_URL" |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 57 | echo "Unpacking $TARGZ" |
| 58 | (cd "$BASE_DIR" && tar xzf "$TARGZ") |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 59 | |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 60 | 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 Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 64 | if [[ -n "$GET_PID" ]]; then |
| The Android Open Source Project | 55a2c71 | 2009-03-03 19:29:09 -0800 | [diff] [blame] | 65 | # 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 |
| 75 | fi |
| Raphael Moll | b371920 | 2010-11-23 01:18:20 -0800 | [diff] [blame] | 76 | |