auto import from //depot/cupcake/@135843
diff --git a/tools/eclipse/scripts/_mk_icons.sh b/tools/eclipse/scripts/_mk_icons.sh
new file mode 100755
index 0000000..b3ea35b
--- /dev/null
+++ b/tools/eclipse/scripts/_mk_icons.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+function icon() {
+  # $1=letter, $2=letter's color (e.g. A red), $3=filename
+  ./gen_icon.py ${3}.png 16 white black $2 $1
+}
+
+icon M green  manifest
+  icon S blue   sharedUserId
+  icon S red    signature
+  icon P green  package
+
+icon I green  instrumentation
+  icon F green  functionalTest
+  icon H green  handleProfiling
+  icon I green  icon
+  icon T green  targetPackage
+
+icon U blue   uses-permission
+icon P red    permission
+  icon N green  name
+  icon L blue   label
+
+icon A blue     application
+    icon P red    permission
+    icon P blue   persistent
+    icon P green  process
+    icon T green  taskAffinity
+    icon T blue   theme
+  icon P red    provider
+    icon A green  authorities
+    icon I green  initOrder
+    icon M green  multiprocess
+    icon R green  readPermission
+    icon W green  writePermission
+    icon S green  syncable
+  icon R green  receiver
+  icon S blue   service
+  icon A green  activity
+      icon C blue   clearOnBackground
+      icon C green  configChanges
+      icon E green  excludeFromRecents
+      icon L green  launchMode
+      icon S green  stateNotNeeded
+    icon F blue  intent-filter
+        icon P green  priority
+      icon A red    action
+      icon C green  category
+      icon D green  data
+        icon M green    mimeType
+        icon S green    scheme
+        icon H green    host
+        icon P green    port
+        icon P blue     path
+
diff --git a/tools/eclipse/scripts/build_plugins.sh b/tools/eclipse/scripts/build_plugins.sh
new file mode 100755
index 0000000..5f94ca0
--- /dev/null
+++ b/tools/eclipse/scripts/build_plugins.sh
@@ -0,0 +1,225 @@
+#!/bin/bash
+
+# build script for eclipse adt build on linux platform
+#
+# Usage: development/tools/eclipse/scripts/build_plugins <build_version> 
+#
+# It expects environment variable ECLIPSE_HOME to be defined to point to _your_
+# version of Eclipse RCP (must have the WTP & GEF plugins available too.)
+#
+# If ECLIPSE_HOME is not provided, this script will _download_ a reference version
+# of Eclipse RCP and install it in a specific location.
+# 
+# Other properties, ant scripts that drive the build are defined in ./buildConfig
+# Currently, this script will create an update site at ${user.home}/www/no_crawl/android-build
+# or at the directory specified using "-d"
+
+# Known Issues:
+# - Build does not properly clean up after itself (build server always executes from
+#   a clean state.)
+# - Script will fail if current absolute path has spaces in it.
+# - Only linux is supported for now
+
+
+set -e # abort this script early if any command fails
+
+#
+# -- Utility methods --
+# 
+
+function printUsage() {
+  echo "Usage: $0 <build_qualifier> [-i] [-d <destination-directory>] [-a <archivePrefix>] "
+  echo "<build_qualifier>: build qualifier string"
+  echo "-i = build internal site. Otherwise, external site will be built"
+  echo "-d = destination directory. Default is $USER/www/no_crawl/. Cannot contain spaces."
+  echo "-a = archive prefix. Cannot contain spaces."
+}
+
+function die() {
+  echo $@
+  exit 1
+}
+
+function dieWithUsage() {
+  echo $@
+  echo
+  printUsage
+  exit 1
+}
+
+
+#
+# -- Setup our custom version of Eclipse --
+#
+
+# The dependency on the linux platform comes from a series of environment
+# variables that the eclipse ant runner expects. These are defined in the
+# build.properties file. We can easily support other platforms but would need
+# to override those values in this script.
+HOST=`uname`
+[ "$HOST" == "Linux" ] || die "ERROR: This script is currently only supported on Linux platform"
+
+# Make sure this runs from the tools/eclipse plugin.
+D=`dirname "$0"`
+cd "$D/.."
+[ `basename "$PWD"` == "eclipse" ] || dieWithUsage "Please run this script from the device/tools/eclipse directory"
+
+# check for number of parameters
+[ $# -lt 1 ] && dieWithUsage "ERROR: Not enough parameters"
+
+# check if ECLIPSE_HOME set (ECLIPSE_HOME is were the "eclipse" binary and the
+# "plugins" sub-directory are located)
+if [ -z "$ECLIPSE_HOME" ]; then
+  BASE_DIR=/buildbot/eclipse-android
+
+  echo "ECLIPSE_HOME not set, using $BASE_DIR as default"
+
+  if [ ! -d "$BASE_DIR" ]; then
+    mkdir -p "$BASE_DIR" || die "Please create a directory $BASE_DIR where Eclipse will be installed, i.e. execute 'mkdir -p $BASE_DIR && chown $USER $BASE_DIR'."
+  fi
+
+  # download the version if not available
+  VERSION="3.4.0"
+  BASE_DIR="$BASE_DIR/$VERSION"
+  scripts/setup_eclipse.sh -p "$BASE_DIR"
+
+  ECLIPSE_HOME="$BASE_DIR/eclipse"      # path to installed directory
+  PID_FILE="$BASE_DIR/eclipse.pid"
+  [ -f "$PID_FILE" ] && ECLIPSE_PID=`cat "$PID_FILE"`
+fi
+
+echo "PWD=`pwd`"
+echo "ECLIPSE_HOME=$ECLIPSE_HOME"
+
+#
+# -- Site parameters and Build version --
+#
+
+BUILD_VERSION="$1" ; shift
+
+# parse for build internal site flag. If set, pass in internalSite property to ant scripts
+if [ "-i" == "$1" ]; then
+  shift
+  echo "Setting for internal site build"
+  SITE_PARAM="-DinternalSite=1 -DupdateSiteSource=$PWD/sites/internal"
+else
+  SITE_PARAM="-DupdateSiteSource=$PWD/sites/external"
+fi
+
+if [ "-d" == $1 ]; then
+  shift
+  echo "Setting destination directory to $1"
+  SITE_PARAM="$SITE_PARAM -DupdateSiteRoot=$1"
+  shift
+fi
+
+if [ "-a" == "$1" ]; then
+  shift
+  echo "Setting archivePrefix to $1"
+  SITE_PARAM="$SITE_PARAM -DarchivePrefix=$1"
+  shift
+fi
+
+
+#
+# -- Configuration directory --
+#
+
+# The "configuration directory" will hold the workspace for this build.
+# If it contains old data the build may fail so we need to clean it first
+# and create it if it doesn't exist.
+CONFIG_DIR="../../../out/eclipse-configuration-$BUILD_VERSION"
+[ -d "$CONFIG_DIR" ] && rm -rfv "$CONFIG_DIR"
+mkdir -p "$CONFIG_DIR"
+
+# The "buildConfig" directory contains our customized ant rules
+BUILDCONFIG="$PWD/buildConfig"
+
+
+#
+# -- Find Eclipse Launcher --
+#
+
+# Get the Eclipse launcher and build script to use
+function findFirst() {
+  for i in "$@"; do
+    if [ -f "$i" ]; then
+      echo "$i"
+      return
+    fi
+  done
+}
+
+LAUNCHER=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.equinox.launcher_*.jar`
+BUILDFILE=`findFirst "$ECLIPSE_HOME"/plugins/org.eclipse.pde.build_*/scripts/build.xml`
+
+# make sure we found valid files
+if [ ! -f "$LAUNCHER" ]; then
+  echo "Installation Error: Eclipse plugin org.eclipse.equinox.launcher...jar not detected. " \
+       "Found '$LAUNCHER'. Aborting."
+  exit 1
+fi
+if [ ! -f "$BUILDFILE" ]; then
+  echo "Installation Error: Eclipse build file org.eclipse.pde.build_.../scripts/build.xml " \
+       "not detected. Found '$BUILDFILE'. Aborting."
+  exit 1
+fi
+
+
+#
+# -- Print configuration used and actually execute the build --
+#
+
+echo "Eclipse configuration found:"
+echo "  Eclipse Home: $ECLIPSE_HOME"
+echo "  Launcher:     $LAUNCHER"
+echo "  Build File:   $BUILDFILE"
+echo "  Build Config: $BUILDCONFIG"
+echo "  Config Dir:   $CONFIG_DIR"
+
+# clean input directories to make sure there's nothing left from previous run
+
+rm -fv *.properties *.xml
+find . -name "@*" | xargs rm -rfv
+
+# Now execute the ant runner
+
+set +e  # don't stop on errors anymore, we want to catch there here
+
+java \
+  -jar $LAUNCHER \
+  -data "$CONFIG_DIR" \
+  -configuration "$CONFIG_DIR" \
+  -application org.eclipse.ant.core.antRunner \
+  -buildfile $BUILDFILE \
+  -Dbuilder=$BUILDCONFIG \
+  -DbuildDirectory=$PWD \
+  -DforceContextQualifier=$BUILD_VERSION \
+  -DECLIPSE_HOME=$ECLIPSE_HOME \
+  $SITE_PARAM
+RESULT=$?
+
+if [ "0" != "$RESULT" ]; then
+    echo "JAVA died with error code $RESULT"
+    echo "Dump of build config logs:"
+    for i in "$CONFIG_DIR"/*.log; do
+        if [ -f "$i" ]; then
+            echo "----------------------"
+            echo "--- $i"
+            echo "----------------------"
+            cat "$i"
+            echo
+        fi
+    done
+fi
+
+#
+# -- Cleanup
+#
+
+if [ -n "$ECLIPSE_PID" ] && [ -f "$PID_FILE" ]; then
+  rm -fv "$PID_FILE"
+  kill -9 "$ECLIPSE_PID"
+fi
+
+# we're done!
diff --git a/tools/eclipse/scripts/build_server.sh b/tools/eclipse/scripts/build_server.sh
new file mode 100755
index 0000000..39c8dcd
--- /dev/null
+++ b/tools/eclipse/scripts/build_server.sh
@@ -0,0 +1,118 @@
+#!/bin/bash
+# Entry point to build the Eclipse plugins for the build server.
+#
+# Input parameters:
+# $1: *Mandatory* destination directory. Must already exist. Cannot contain spaces.
+# $2: Optional build number. If present, will be appended to the date qualifier.
+#     The build number cannot contain spaces *nor* periods (dashes are ok.)
+# -z: Optional, prevents the final zip and leaves the udate-site directory intact.
+# -i: Optional, if present, the Google internal update site will be built. Otherwise, 
+#     the external site will be built
+# Workflow:
+# - make dx, ddms, ping
+# - create symlinks (for eclipse code reorg, for ddms, ping)
+# - call the actual builder script from Brett
+# - zip resulting stuff and move to $DEST
+# Note: currently wrap around existing shell script, reuse most of it,
+# eventually both might merge as needed.
+
+set -e  # Fail this script as soon as a command fails -- fail early, fail fast
+
+DEST_DIR=""
+BUILD_NUMBER=""
+CREATE_ZIP="1"
+INTERNAL_BUILD=""
+
+function get_params() {
+  # parse input parameters
+  while [ $# -gt 0 ]; do
+    if [ "$1" == "-z" ]; then
+      CREATE_ZIP=""
+    elif [ "$1" == "-i" ]; then
+      INTERNAL_BUILD="-i"
+    elif [ "$1" != "" ] && [ -z "$DEST_DIR" ]; then
+      DEST_DIR="$1"
+    elif [ "$1" != "" ] && [ -z "$BUILD_NUMBER" ]; then
+      BUILD_NUMBER="$1"
+    fi
+    shift
+  done
+}
+
+function die() {
+  echo "Error:" $*
+  echo "Aborting"
+  exit 1
+}
+
+function check_params() {
+  # This needs to run from the top android directory
+  # Automatically CD to the top android directory, whatever its name
+  D=`dirname "$0"`
+  cd "$D/../../../../" && echo "Switched to directory $PWD"
+
+  # The current Eclipse build has some Linux dependency in its config files
+  [ `uname` == "Linux" ] || die "This must run from a Linux box."
+
+  # Check dest dir exists
+  [ -n "$DEST_DIR" ] || die "Usage: $0 <destination-directory> [build-number]"
+  [ -d "$DEST_DIR" ] || die "Destination directory $DEST_DIR must exist."
+}
+
+function build_libs() {
+  MAKE_OPT="-j8"
+  echo "*** Building: make $MAKE_OPT dx ping ddms jarutils androidprefs layoutlib_api ninepatch sdklib sdkuilib"
+  make $MAKE_OPT dx ping ddms jarutils androidprefs layoutlib_api layoutlib_utils ninepatch sdklib sdkuilib
+}
+
+function build_plugin {
+  development/tools/eclipse/scripts/create_all_symlinks.sh
+
+  # Qualifier is "v" followed by date/time in YYYYMMDDHHSS format and the optional
+  # build number.
+  DATE=`date +v%Y%m%d%H%M`
+  QUALIFIER="$DATE"
+  [ -n "$BUILD_NUMBER" ] && QUALIFIER="${QUALIFIER}-${BUILD_NUMBER}"
+
+  # Compute the final directory name and remove any leftovers from previous
+  # runs if any.
+  BUILD_PREFIX="android-eclipse"  
+  if [ "$INTERNAL_BUILD" ]; then
+    # append 'eng' signifier to end of archive name to denote internal build
+    BUILD_PREFIX="${BUILD_PREFIX}-eng"
+  fi  
+
+  # exclude date from build-zip name so it can be auto-calculated by continuous
+  # test process unless there's no build number, in which case the date is
+  # still used (useful for testing)
+  ZIP_NAME="${BUILD_PREFIX}-${BUILD_NUMBER:-$DATE}.zip"
+  [ -d "$DEST_DIR/$BUILD_PREFIX" ] || rm -rfv "$DEST_DIR/$BUILD_PREFIX"
+
+  # Perform the Eclipse build and move the result in $DEST_DIR/android-build
+  development/tools/eclipse/scripts/build_plugins.sh $QUALIFIER $INTERNAL_BUILD -d "$DEST_DIR" -a "$BUILD_PREFIX"
+
+  # Cleanup
+  [ -d "$QUALIFIER" ] && rm -rfv "$QUALIFIER"
+
+  if [ "$CREATE_ZIP" ]; then
+    # The result is a full update-site under $DEST_DIR/BUILD_PREFIX
+    # Zip it and remove the directory.
+    echo "**** Package in $DEST_DIR"
+    [ -d "$DEST_DIR/$BUILD_PREFIX" ] || \
+      die "Build failed to produce $DEST_DIR/$BUILD_PREFIX"
+    cd "$DEST_DIR"
+    [ -f "$ZIP_NAME" ] && rm -rfv "$ZIP_NAME"
+    cd "$BUILD_PREFIX"
+    zip -9r "../$ZIP_NAME" *
+    cd .. # back to $DEST_DIR
+    rm -rfv "$BUILD_PREFIX"  # removes the directory, not the zip
+    echo "ZIP of Update site available at $DEST_DIR/${ZIP_NAME}"
+  else
+    echo "Update site available in $DEST_DIR/$BUILD_PREFIX"
+  fi
+}
+
+get_params "$@"
+check_params
+build_libs
+build_plugin
diff --git a/tools/eclipse/scripts/build_update_site.sh b/tools/eclipse/scripts/build_update_site.sh
new file mode 100755
index 0000000..5998756
--- /dev/null
+++ b/tools/eclipse/scripts/build_update_site.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Entry point to build the Eclipse plugins for local deployment.
+#
+# Input parameters:
+# $1: Optional build number. If present, will be appended to the date qualifier.
+#     The build number cannot contain spaces *nor* periods (dashes are ok.)
+# -i: Optional, if present, the Google internal update site will be built. Otherwise, 
+#     the external site will be built
+#
+# Workflow:
+# - calls buildserver with /home/$USER/www/no_crawl and -z
+#   to build and create the update size but do not zip it in the destination directory.
+
+set -e  # Fail this script as soon as a command fails -- fail early, fail fast
+
+D=`dirname $0`
+BUILD_NUMBER=""
+INTERNAL_BUILD=""
+# parse input parameters
+while [ $# -gt 0 ]; do
+  if [ "$1" == "-i" ]; then
+    INTERNAL_BUILD="-i"
+  elif [ "$1" != "" ]; then
+    BUILD_NUMBER="$1"
+  fi
+  shift
+done
+
+DEST_DIR="$HOME"
+[ -z "$DEST_DIR" ] && [ -n "$USER" ] && DEST_DIR="/home/$USER"
+[ -z "$DEST_DIR" ] && DEST_DIR="~"
+DEST_DIR="$DEST_DIR/www/no_crawl"
+
+"$D/build_server.sh" "$DEST_DIR" "$BUILD_NUMBER" -z "$INTERNAL_BUILD"
diff --git a/tools/eclipse/scripts/collect_sources_for_sdk.sh b/tools/eclipse/scripts/collect_sources_for_sdk.sh
new file mode 100644
index 0000000..4824da7
--- /dev/null
+++ b/tools/eclipse/scripts/collect_sources_for_sdk.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+function usage() {
+    cat <<EOF
+ Description:
+   This script collects all framework Java sources from the current android
+   source code and places them in a source folder suitable for the eclipse ADT
+   plugin.
+
+ Usage:
+   $0 [-n] <android-git-repo root> <sdk/platforms/xyz/sources>
+ 
+ The source and destination directories must already exist.
+ Use -n for a dry-run.
+
+EOF
+}
+
+DRY=""
+if [ "-n" == "$1" ]; then
+    DRY="echo"
+    shift
+fi
+
+DIR="frameworks"
+if [ "-s" == "$1" ]; then
+    shift
+    DIR="$1"
+    shift
+fi
+
+SRC="$1"
+DST="$2"
+
+if [ -z "$SRC" ] || [ -z "$DST" ] || [ ! -d "$SRC" ] || [ ! -d "$DST" ]; then
+    usage
+    exit 1
+fi
+
+function process() {
+    echo "Examine" $1
+}
+
+N=0
+E=0
+for i in `find -L "${SRC}/${DIR}" -name "*.java"`; do
+    if [ -f "$i" ]; then
+        # look for ^package (android.view.blah);$
+        PACKAGE=`sed -n '/^package [^ ;]\+; */{s/[^ ]* *\([^ ;]*\).*/\1/p;q}' "$i"`
+        if [ -n "$PACKAGE" ]; then
+            PACKAGE=${PACKAGE//./\/}    # e.g. android.view => android/view
+            JAVA=`basename "$i"`        # e.g. View.java
+            [ -z $DRY ] && [ ! -d "$DST/$PACKAGE" ] && mkdir -p -v "$DST/$PACKAGE"
+            $DRY cp -v "$i" "$DST/$PACKAGE/$JAVA"
+            N=$((N+1))
+        else
+            echo "Warning: $i does not have a Java package."
+            E=$((E+1))
+        fi
+    fi
+done
+
+echo "$N java files copied"
+[ $E -gt 0 ] && echo "$E warnings"
+
diff --git a/tools/eclipse/scripts/create_adt_symlinks.sh b/tools/eclipse/scripts/create_adt_symlinks.sh
new file mode 100755
index 0000000..557c4d9
--- /dev/null
+++ b/tools/eclipse/scripts/create_adt_symlinks.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+function die() {
+    echo "Error: $*"
+    exit 1
+}
+
+set -e # fail early
+
+# CD to the top android directory
+D=`dirname "$0"`
+cd "$D/../../../../"
+
+DEST="development/tools/eclipse/plugins/com.android.ide.eclipse.adt"
+# computes "../.." from DEST to here (in /android)
+BACK=`echo $DEST | sed 's@[^/]*@..@g'`
+
+LIBS="sdkstats jarutils androidprefs layoutlib_api layoutlib_utils ninepatch sdklib sdkuilib"
+
+echo "make java libs ..."
+make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS."
+
+echo "Copying java libs to $DEST"
+
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+    for LIB in $LIBS; do
+        ln -svf $BACK/out/host/linux-x86/framework/$LIB.jar "$DEST/"
+    done
+    ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar "$DEST/"
+  
+elif [ "$HOST" == "Darwin" ]; then
+    for LIB in $LIBS; do
+        ln -svf $BACK/out/host/darwin-x86/framework/$LIB.jar "$DEST/"
+    done
+    ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar "$DEST/"
+
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+    for LIB in $LIBS; do
+        cp -vf  out/host/windows-x86/framework/$LIB.jar "$DEST/"
+    done
+
+    if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then
+        cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/"
+    fi
+
+    chmod -v a+rx "$DEST"/*.jar
+else
+    echo "Unsupported platform ($HOST). Nothing done."
+fi
+
diff --git a/tools/eclipse/scripts/create_all_symlinks.sh b/tools/eclipse/scripts/create_all_symlinks.sh
new file mode 100755
index 0000000..8508343
--- /dev/null
+++ b/tools/eclipse/scripts/create_all_symlinks.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+echo "### $0 executing"
+
+function die() {
+    echo "Error: $*"
+    exit 1
+}
+
+# CD to the top android directory
+D=`dirname "$0"`
+cd "$D/../../../../"
+
+DEST="development/tools/eclipse/scripts"
+
+set -e # fail early
+
+echo ; echo "### ADT ###" ; echo
+$DEST/create_adt_symlinks.sh "$*"
+echo ; echo "### DDMS ###" ; echo
+$DEST/create_ddms_symlinks.sh "$*"
+echo ; echo "### TEST ###" ; echo
+$DEST/create_test_symlinks.sh "$*"
+echo ; echo "### BRIDGE ###" ; echo
+$DEST/create_bridge_symlinks.sh "$*"
+
+echo "### $0 done"
diff --git a/tools/eclipse/scripts/create_bridge_symlinks.sh b/tools/eclipse/scripts/create_bridge_symlinks.sh
new file mode 100755
index 0000000..605ef63
--- /dev/null
+++ b/tools/eclipse/scripts/create_bridge_symlinks.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+function die() {
+    echo "Error: $*"
+    exit 1
+}
+
+set -e # fail early
+
+# CD to the top android directory
+D=`dirname "$0"`
+cd "$D/../../../../"
+
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+    echo # nothing to do
+
+elif [ "$HOST" == "Darwin" ]; then
+    echo # nothing to do
+
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+    if [ "x$1" == "x" ] || [ `basename "$1"` != "layoutlib.jar" ]; then
+        echo "Usage: $0 sdk/platforms/xxx/data/layoutlib.jar"
+        echo "Argument 1 should be the path to the layoutlib.jar that should be updated."
+        exit 1
+    fi
+
+    LIBS="layoutlib ninepatch"
+    echo "Make java libs: $LIBS"
+    make -j3 showcommands $LIBS || die "Bridge: Failed to build one of $LIBS."
+
+    echo "Updating your SDK in $1"
+    cp -vf  "out/host/windows-x86/framework/layoutlib.jar" "$1"
+    chmod -v a+rx "$1"
+
+else
+    echo "Unsupported platform ($HOST). Nothing done."
+fi
+
diff --git a/tools/eclipse/scripts/create_ddms_symlinks.sh b/tools/eclipse/scripts/create_ddms_symlinks.sh
new file mode 100755
index 0000000..276cf9b
--- /dev/null
+++ b/tools/eclipse/scripts/create_ddms_symlinks.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+#----------------------------------------------------------------------------|
+# Creates the links to use ddm{ui}lib in the eclipse-ide plugin.
+# Run this from device/tools/eclipse/scripts
+#----------------------------------------------------------------------------|
+
+set -e
+
+HOST=`uname`
+if [ "${HOST:0:6}" == "CYGWIN" ]; then
+    # We can't use symlinks under Cygwin
+
+    function cpfile { # $1=dest $2=source
+        cp -fv $2 $1/
+    }
+
+    function cpdir() { # $1=dest $2=source
+        rsync -avW --delete-after $2 $1
+    }
+
+else
+    # For all other systems which support symlinks
+
+    # computes the "reverse" path, e.g. "a/b/c" => "../../.."
+    function back() {
+        echo $1 | sed 's@[^/]*@..@g'
+    }
+
+    function cpfile { # $1=dest $2=source
+        ln -svf `back $1`/$2 $1/
+    }
+
+    function cpdir() { # $1=dest $2=source
+        ln -svf `back $1`/$2 $1
+    }
+fi
+
+# CD to the top android directory
+D=`dirname "$0"`
+cd "$D/../../../../"
+
+
+BASE="development/tools/eclipse/plugins/com.android.ide.eclipse.ddms"
+
+DEST=$BASE/libs
+mkdir -p $DEST
+for i in prebuilt/common/jfreechart/*.jar; do
+  cpfile $DEST $i
+done
+
+DEST=$BASE/src/com/android
+mkdir -p $DEST
+for i in development/tools/ddms/libs/ddmlib/src/com/android/ddmlib \
+         development/tools/ddms/libs/ddmuilib/src/com/android/ddmuilib ; do
+  cpdir $DEST $i
+done
+
+DEST=$BASE/icons
+mkdir -p $DEST
+for i in \
+    add.png \
+    backward.png \
+    clear.png \
+    d.png debug-attach.png debug-error.png debug-wait.png delete.png device.png down.png \
+    e.png edit.png empty.png emulator.png \
+    forward.png \
+    gc.png \
+    heap.png halt.png \
+    i.png importBug.png \
+    load.png \
+    pause.png play.png pull.png push.png \
+    save.png \
+    thread.png \
+    up.png \
+    v.png \
+    w.png warning.png ; do
+  cpfile $DEST development/tools/ddms/libs/ddmuilib/src/resources/images/$i
+done
+
diff --git a/tools/eclipse/scripts/create_test_symlinks.sh b/tools/eclipse/scripts/create_test_symlinks.sh
new file mode 100755
index 0000000..931dce8
--- /dev/null
+++ b/tools/eclipse/scripts/create_test_symlinks.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+set -e
+
+# CD to the top android directory
+D=`dirname "$0"`
+cd "$D/../../../../"
+
+# computes relative ".." paths from $1 to here (in /android)
+function back() {
+  echo $1 | sed 's@[^/]*@..@g'
+}
+
+HOST=`uname`
+if [ "${HOST:0:6}" == "CYGWIN" ]; then
+    # We can't use symlinks under Cygwin
+    function cpdir() { # $1=dest $2=source
+        rsync -avW --delete-after $2 $1
+    }
+
+else
+    # For all other systems which support symlinks
+    function cpdir() { # $1=dest $2=source
+        ln -svf `back $1`/$2 $1
+    }
+fi
+
+BASE="development/tools/eclipse/plugins/com.android.ide.eclipse.tests"
+DEST=$BASE
+BACK=`back $DEST`
+
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+    ln -svf $BACK/out/host/linux-x86/framework/kxml2-2.3.0.jar "$DEST/"
+
+elif [ "$HOST" == "Darwin" ]; then
+    ln -svf $BACK/out/host/darwin-x86/framework/kxml2-2.3.0.jar "$DEST/"
+
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+
+    if [ ! -f "$DEST/kxml2-2.3.0.jar" ]; then
+        cp -v "prebuilt/common/kxml2/kxml2-2.3.0.jar" "$DEST/"
+        chmod -v a+rx "$DEST"/*.jar
+    fi
+
+else
+    echo "Unsupported platform ($HOST). Nothing done."
+fi
+
+# create link to ddmlib tests
+DEST=$BASE/unittests/com/android
+BACK=`back $DEST`
+cpdir $DEST development/tools/ddms/libs/ddmlib/tests/src/com/android/ddmlib
+
diff --git a/tools/eclipse/scripts/gen_icon.py b/tools/eclipse/scripts/gen_icon.py
new file mode 100755
index 0000000..f6274e1
--- /dev/null
+++ b/tools/eclipse/scripts/gen_icon.py
@@ -0,0 +1,71 @@
+#!/usr/bin/python
+
+import sys
+import StringIO
+try:
+    import Image, ImageDraw, ImageFont
+except ImportError, e:
+    print str(e)
+    print "Are you missing the Python Imaging Library? (apt-get install python-imaging)"
+    sys.exit(1)
+
+FONT_PATH = "/usr/share/fonts/truetype/msttcorefonts/arial.ttf"
+
+class Args(object):
+    def __init__(self, dest_name, size, circle_color, border_color,
+                 letter_color, letter):
+        self.dest_name = dest_name
+        self.size = size
+        self.circle_color = circle_color
+        self.border_color = border_color
+        self.letter_color = letter_color
+        self.letter = letter
+
+def main(args):
+    data = process_args(args)
+    if data:
+        createImage(data)
+
+def process_args(args):
+    if not args or len(args) != 6:
+        usage()
+    return Args(*args)
+    
+def usage():
+    print """Usage: %s <file_name> <size> <circle-color> <border-color> <letter-color> <letter>""" % sys.argv[0]
+    sys.exit(1)
+
+def createImage(data):
+    zoom = 4
+    rmin = -zoom/2
+    rmax = zoom/2
+    if zoom > 1:
+        r = range(-zoom/2, zoom/2+1)
+    else:
+        r = [ 0 ]
+    sz = int(data.size)
+    sz4 = sz * zoom
+    
+    img = Image.new("RGBA", (sz4, sz4), (255,255,255,0))
+    draw = ImageDraw.Draw(img)
+
+    draw.ellipse((0, 0, sz4-zoom, sz4-zoom),
+                     fill=data.circle_color, outline=None)
+    for i in r:
+        draw.ellipse((i, i, sz4-i-zoom, sz4-i-zoom),
+                     fill=None, outline=data.border_color)
+
+    font = ImageFont.truetype(FONT_PATH, int(sz4 * .75))
+    tsx, tsy = draw.textsize(data.letter, font=font)
+
+    ptx = (sz4 - tsx) / 2
+    pty = (sz4 - tsy) / 2
+    for i in r:
+        draw.text((ptx + i, pty), data.letter, font=font, fill=data.letter_color)
+
+    img = img.resize((sz, sz), Image.BICUBIC)
+    img.save(data.dest_name, "PNG")
+    print "Saved", data.dest_name
+
+if __name__ == "__main__":
+    main(sys.argv[1:])
diff --git a/tools/eclipse/scripts/setup_eclipse.sh b/tools/eclipse/scripts/setup_eclipse.sh
new file mode 100755
index 0000000..5143e23
--- /dev/null
+++ b/tools/eclipse/scripts/setup_eclipse.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Quick script used to setup Eclipse for the ADT plugin build.
+#
+# usage:
+#   setup_eclipse.sh <dest_dir>
+#
+# Workflow:
+# - downloads & unpack Eclipse if necessary
+# - *runs* it once
+
+
+#-----------------
+#
+# Note: right now this is invoked by //device/tools/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
+}
+
+if [ "-p" == "$1" ]; then
+  GET_PID="-p"
+  shift
+fi
+
+BASE_DIR="$1"
+
+[ -n "$1" ] || die "Usage: $0 <dest-dir>"
+
+# URL for 3.4.0 RCP Linux 32 Bits. Includes GEF, WTP as needed.
+DOWNLOAD_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"
+
+BIN="$BASE_DIR/eclipse/eclipse"           # path to installed binary
+TARGZ="$BASE_DIR/eclipse-rcp-ganymede-linux-gtk.tar.gz"
+
+if [ ! -f "$BIN" ]; then   
+  echo "Downloading and installing Eclipse in $BASE_DIR."
+  mkdir -p "$BASE_DIR"
+  wget --continue --no-verbose --output-document="$TARGZ" "$DOWNLOAD_URL"
+  echo "Unpacking $TARGZ"
+  (cd "$BASE_DIR" && tar xzf "$TARGZ")
+    
+  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
diff --git a/tools/eclipse/scripts/update_version.sh b/tools/eclipse/scripts/update_version.sh
new file mode 100644
index 0000000..a288965
--- /dev/null
+++ b/tools/eclipse/scripts/update_version.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+OLD="$1"
+NEW="$2"
+
+# sanity check in input args
+if [ -z "$OLD" ] || [ -z "$NEW" ]; then
+    cat <<EOF
+Usage: $0 <old> <new>
+Changes the ADT plugin revision number.
+Example:
+  cd tools/eclipse
+  scripts/update_version.sh 0.1.2 0.2.3
+EOF
+    exit 1
+fi
+
+# sanity check on current dir
+if [ `basename "$PWD"` != "eclipse" ]; then
+    echo "Please run this from tools/eclipse."
+    exit 1
+fi
+
+# quote dots for regexps
+OLD="${OLD//./\.}"
+NEW="${NEW//./\.}"
+
+# Find all the files with the old pattern, except changes.txt and
+# p4 edit them. Skip that if there's no p4 in path.
+if which g4 1>/dev/null 2>/dev/null ; then
+    grep -rl "$OLD" * | grep -E "\.xml$|\.MF$" | xargs -n 5 g4 edit
+fi
+
+# Now find the same files but this time use sed to replace in-place with
+# the new pattern. Old files get backuped with the .old extension.
+grep -rl "$OLD" * | grep -E "\.xml$|\.MF$" | xargs -n 1 sed -i.old "s/$OLD/$NEW/g"
+