Initial Contribution
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_server.sh b/tools/eclipse/scripts/build_server.sh
new file mode 100755
index 0000000..e30dbb8
--- /dev/null
+++ b/tools/eclipse/scripts/build_server.sh
@@ -0,0 +1,119 @@
+#!/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 //device
+ [ `basename "$PWD"` == "device" ] || \
+ die "Please execute $0 from the //device directory, not $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"
+ make $MAKE_OPT dx ping ddms jarutils androidprefs layoutlib_api layoutlib_utils
+}
+
+function build_plugin {
+ cd tools/eclipse/scripts
+ ./create_all_symlinks.sh
+ cd .. # cd back to tools/eclipse
+
+ # 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
+ ./doBuild.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/create_adt_symlinks.sh b/tools/eclipse/scripts/create_adt_symlinks.sh
new file mode 100755
index 0000000..4974432
--- /dev/null
+++ b/tools/eclipse/scripts/create_adt_symlinks.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+function die() {
+ echo "Error: $*"
+ exit 1
+}
+
+set -e # fail early
+
+# This may run either from the //device directory or from the
+# eclipse/script directory. Allow for both.
+D="device/tools/eclipse/scripts"
+[ -d "$D" ] && cd "$D"
+[ -d "../$D" ] && cd "../$D"
+
+cd ../plugins/com.android.ide.eclipse.adt
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+ ln -svf ../../../../out/host/linux-x86/framework/jarutils.jar .
+ ln -svf ../../../../out/host/linux-x86/framework/androidprefs.jar .
+elif [ "$HOST" == "Darwin" ]; then
+ ln -svf ../../../../out/host/darwin-x86/framework/jarutils.jar .
+ ln -svf ../../../../out/host/darwin-x86/framework/androidprefs.jar .
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+
+ DEVICE_DIR="../../../.."
+ echo "make java libs ..."
+ ( cd "$DEVICE_DIR" &&
+ make -j3 showcommands jarutils androidprefs ) || \
+ die "Define javac and retry."
+
+ for DIR in "$PWD" ; do
+ echo "Copying java libs to $DIR"
+ for JAR in jarutils.jar androidprefs.jar ; do
+ cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" "$DIR"
+ done
+ done
+
+ chmod a+rx *.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..fc9766f
--- /dev/null
+++ b/tools/eclipse/scripts/create_all_symlinks.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+echo "### $0 executing"
+
+function die() {
+ echo "Error: $*"
+ exit 1
+}
+
+D="device/tools/eclipse/scripts"
+if [ -d "../$D" ]; then
+ cd "../$D"
+else
+ [ "${PWD: -28}" == "$D" ] || die "Please execute this from the $D directory"
+fi
+
+set -e # fail early
+
+echo ; echo "### ADT ###" ; echo
+./create_adt_symlinks.sh "$*"
+echo ; echo "### COMMON ###" ; echo
+./create_common_symlinks.sh "$*"
+echo ; echo "### EDITORS ###" ; echo
+./create_editors_symlinks.sh "$*"
+echo ; echo "### DDMS ###" ; echo
+./create_ddms_symlinks.sh "$*"
+echo ; echo "### TEST ###" ; echo
+./create_test_symlinks.sh "$*"
+echo ; echo "### BRIDGE ###" ; echo
+./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..f01a89e
--- /dev/null
+++ b/tools/eclipse/scripts/create_bridge_symlinks.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+function die() {
+ echo "Error: $*"
+ exit 1
+}
+
+set -e # fail early
+
+# This may run either from the //device directory or from the
+# eclipse/script directory. Allow for both.
+D="device/tools/eclipse/scripts"
+[ -d "$D" ] && cd "$D"
+[ -d "../$D" ] && cd "../$D"
+
+cd ../../layoutlib
+
+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" ]; then
+ echo "Usage: $0 sdk/tools/lib/"
+ echo "Argument 1 should be the path to the jars you want to copy. "
+ echo " e.g. android_sdk_windows_NNN/tools/lib/ "
+ echo "This will be used to update layout.lib after it has been built here."
+ exit 1
+ fi
+
+ DEVICE_DIR="../../"
+ echo "make java libs ..."
+ ( cd "$DEVICE_DIR" &&
+ make -j3 showcommands layoutlib ninepatch ) || \
+ die "Define javac and retry."
+
+ for DIR in "$PWD" "$1" ; do
+ echo "Copying java libs to $DIR"
+ for JAR in ninepatch.jar layoutlib.jar ; do
+ cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" "$DIR"
+ done
+ done
+
+else
+ echo "Unsupported platform ($HOST). Nothing done."
+fi
+
diff --git a/tools/eclipse/scripts/create_common_symlinks.sh b/tools/eclipse/scripts/create_common_symlinks.sh
new file mode 100755
index 0000000..7726afc
--- /dev/null
+++ b/tools/eclipse/scripts/create_common_symlinks.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+function die() {
+ echo "Error: $*"
+ exit 1
+}
+
+set -e # fail early
+
+# This may run either from the //device directory or from the
+# eclipse/script directory. Allow for both.
+D="device/tools/eclipse/scripts"
+[ -d "$D" ] && cd "$D"
+[ -d "../$D" ] && cd "../$D"
+
+cd ../plugins/com.android.ide.eclipse.common
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+ ln -svf ../../../../out/host/linux-x86/framework/sdkstats.jar .
+ ln -svf ../../../../out/host/linux-x86/framework/androidprefs.jar .
+elif [ "$HOST" == "Darwin" ]; then
+ ln -svf ../../../../out/host/darwin-x86/framework/sdkstats.jar .
+ ln -svf ../../../../out/host/darwin-x86/framework/androidprefs.jar .
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+
+ DEVICE_DIR="../../../.."
+ echo "make java libs ..."
+ ( cd "$DEVICE_DIR" &&
+ make -j3 sdkstats androidprefs ) || \
+ die "Define javac and retry."
+
+ for DIR in "$PWD" ; do
+ echo "Copying java libs to $DIR"
+ for JAR in sdkstats.jar androidprefs.jar ; do
+ cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" "$DIR"
+ chmod a+rx "$DIR/$JAR"
+ done
+ done
+
+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..5b2e45b
--- /dev/null
+++ b/tools/eclipse/scripts/create_ddms_symlinks.sh
@@ -0,0 +1,61 @@
+#!/bin/bash
+#----------------------------------------------------------------------------|
+# Creates the links to use ddm{ui}lib in the eclipse-ide plugin.
+# Run this from device/tools/eclipse/scripts
+#----------------------------------------------------------------------------|
+
+CMD="ln -svf"
+DIR="ln -svf"
+HOST=`uname`
+if [ "${HOST:0:6}" == "CYGWIN" ]; then
+ CMD="cp -rvf"
+ DIR="rsync -avW --delete-after"
+fi
+
+cd ../plugins/com.android.ide.eclipse.ddms
+mkdir -p libs
+cd libs
+$CMD ../../../../../prebuilt/common/jfreechart/jcommon-1.0.12.jar .
+$CMD ../../../../../prebuilt/common/jfreechart/jfreechart-1.0.9.jar .
+$CMD ../../../../../prebuilt/common/jfreechart/jfreechart-1.0.9-swt.jar .
+
+cd ../src/com/android
+$DIR ../../../../../../ddms/libs/ddmlib/src/com/android/ddmlib .
+$DIR ../../../../../../ddms/libs/ddmuilib/src/com/android/ddmuilib .
+
+# goes back to the icons directory
+cd ../../../icons/
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/debug-attach.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/debug-wait.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/debug-error.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/device.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/emulator.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/heap.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/thread.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/empty.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/warning.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/d.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/e.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/i.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/v.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/w.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/add.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/delete.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/edit.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/save.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/push.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/pull.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/clear.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/up.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/down.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/gc.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/halt.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/load.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/importBug.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/play.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/pause.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/forward.png .
+$CMD ../../../../ddms/libs/ddmuilib/src/resources/images/backward.png .
+
+
+
diff --git a/tools/eclipse/scripts/create_editors_symlinks.sh b/tools/eclipse/scripts/create_editors_symlinks.sh
new file mode 100755
index 0000000..2f26ac4
--- /dev/null
+++ b/tools/eclipse/scripts/create_editors_symlinks.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+function die() {
+ echo "Error: $*"
+ exit 1
+}
+
+cd ../plugins/com.android.ide.eclipse.editors
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+ ln -svf ../../../../out/host/linux-x86/framework/layoutlib_api.jar .
+ ln -svf ../../../../out/host/linux-x86/framework/layoutlib_utils.jar .
+ ln -svf ../../../../out/host/linux-x86/framework/kxml2-2.3.0.jar .
+ ln -svf ../../../../out/host/linux-x86/framework/ninepatch.jar .
+elif [ "$HOST" == "Darwin" ]; then
+ ln -svf ../../../../out/host/darwin-x86/framework/layoutlib_api.jar .
+ ln -svf ../../../../out/host/darwin-x86/framework/layoutlib_utils.jar .
+ ln -svf ../../../../out/host/darwin-x86/framework/kxml2-2.3.0.jar .
+ ln -svf ../../../../out/host/darwin-x86/framework/ninepatch.jar .
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+ set -e # fail early
+ DEVICE_DIR="../../../../"
+ echo "make java libs ..."
+ ( cd "$DEVICE_DIR" &&
+ make -j3 showcommands layoutlib_api layoutlib_utils ninepatch ) || \
+ die "Define javac and 'make layoutlib_api ninepatch' from device."
+
+ echo "Copying java libs to $PWD"
+ for JAR in layoutlib_api.jar layoutlib_utils.jar ninepatch.jar ; do
+ cp -vf "$DEVICE_DIR/out/host/windows-x86/framework/$JAR" .
+ done
+ if [ ! -f "./kxml2-2.3.0.jar" ]; then
+ cp -v $DEVICE_DIR/prebuilt/common/kxml2/kxml2-2.3.0.jar .
+ chmod -v a+rx *.jar
+ fi
+
+else
+ echo "Unsupported platform ($HOST). Nothing done."
+fi
+
diff --git a/tools/eclipse/scripts/create_test_symlinks.sh b/tools/eclipse/scripts/create_test_symlinks.sh
new file mode 100755
index 0000000..110539a
--- /dev/null
+++ b/tools/eclipse/scripts/create_test_symlinks.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+cd ../plugins/com.android.ide.eclipse.tests
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+ ln -svf ../../../../out/host/linux-x86/framework/kxml2-2.3.0.jar .
+elif [ "$HOST" == "Darwin" ]; then
+ ln -svf ../../../../out/host/darwin-x86/framework/kxml2-2.3.0.jar .
+elif [ "${HOST:0:6}" == "CYGWIN" ]; then
+ if [ "x$1" == "x" ]; then
+ echo "Usage: $0 <path to jars>"
+ echo "Argument 1 should be the path to the jars you want to copy. "
+ echo " e.g. android_sdk_windows_NNN/tools/lib/ "
+ echo "(since you can't rebuild them under Windows, you need prebuilt ones "
+ echo " from an SDK drop or a Linux/Mac)"
+ exit 1
+ fi
+ if [ ! -f "kxml2-2.3.0.jar" ]; then
+ wget -O "kxml2-2.3.0.jar" "http://internap.dl.sourceforge.net/sourceforge/kxml/kxml2-2.3.0.jar"
+ chmod a+rx *.jar
+ fi
+else
+ echo "Unsupported platform ($HOST). Nothing done."
+fi
+
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