Make the plugin build script for for Mac OSX

The build_server script used to build the plugin zip file was Linux
specific. This changeset tweaks the scripts such that they will also
run on Mac OSX. It also adds various .gitignore filters such that the
temporary files created by the build script are ignored by git.

Change-Id: I77cfe6bfb65be86c11beb50bcab9c345433b5a8e
diff --git a/.gitignore b/.gitignore
index 268cc87..9a50b0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,18 @@
 *.pyc
 Thumbs.db
 *.class
+
+# Hide temporary files created by the build_server script
+eclipse/assemble.com.android.ide.eclipse.*.xml
+eclipse/package.com.android.ide.eclipse.*.xml
+eclipse/final*Versions*.properties
+eclipse/plugins/com.android.ide.eclipse.*/@dot*
+eclipse/plugins/com.android.*/javaCompiler...args
+eclipse/plugins/com.android.ide.eclipse.adt/build.xml
+eclipse/plugins/com.android.ide.eclipse.ddms/build.xml
+eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/build.xml
+eclipse/plugins/com.android.ide.eclipse.traceview/build.xml
+eclipse/features/com.android.ide.eclipse.*/build.xml
+eclipse/features/com.android.ide.eclipse.*/*.zip
+/eclipse/v[0-9-]*-[0-9]*
+/status-output
diff --git a/eclipse/buildConfig/build.properties b/eclipse/buildConfig/build.properties
index 45cc3c2..4466ab7 100644
--- a/eclipse/buildConfig/build.properties
+++ b/eclipse/buildConfig/build.properties
@@ -135,6 +135,7 @@
 
 baseLocation=${ECLIPSE_HOME}
 #Os/Ws/Arch/nl of the eclipse specified by baseLocation
+# Note: These default values may be overridden by the build_plugins script
 baseos=linux
 basews=gtk
 basearch=x86
diff --git a/eclipse/scripts/build_plugins.sh b/eclipse/scripts/build_plugins.sh
index 71d5533..20217b9 100755
--- a/eclipse/scripts/build_plugins.sh
+++ b/eclipse/scripts/build_plugins.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# build script for eclipse adt build on linux platform
+# build script for eclipse adt build on the Linux and Mac platforms
 #
 # Usage: sdk/eclipse/scripts/build_plugins <build_version>
 #
@@ -18,7 +18,7 @@
 # - 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
+# - Only linux and OSX are supported for now
 # - Do NOT manually invoke this script. Instead use the build_server.sh wrapper
 #   which does some extra preliminary steps (it builds a few libs needed here.)
 
@@ -59,7 +59,18 @@
 # 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"
+if [ "$HOST" == "Linux" ]; then
+  BASEOS=linux
+  BASEWS=gtk
+  BASEARCH=x86
+elif [ "$HOST" == "Darwin" ]; then
+  BASEOS=macosx
+  BASEWS=cocoa
+  BASEARCH=x86
+else
+  die "ERROR: This script is currently only supported on Linux and MacOSX."
+fi
+
 
 # Make sure this runs from the sdk/eclipse plugin.
 D=`dirname "$0"`
@@ -188,6 +199,7 @@
 
 set +e  # don't stop on errors anymore, we want to catch them here
 
+
 java \
   -jar $LAUNCHER \
   -data "$CONFIG_DIR" \
@@ -198,6 +210,9 @@
   -DbuildDirectory=$PWD \
   -DforceContextQualifier=$BUILD_VERSION \
   -DECLIPSE_HOME=$ECLIPSE_HOME \
+  -Dbaseos=$BASEOS \
+  -Dbasews=$BASEWS \
+  -Dbasearch=$BASEARCH \
   $SITE_PARAM
 RESULT=$?
 
diff --git a/eclipse/scripts/build_server.sh b/eclipse/scripts/build_server.sh
index bff14bd..4a6093d 100755
--- a/eclipse/scripts/build_server.sh
+++ b/eclipse/scripts/build_server.sh
@@ -52,7 +52,7 @@
   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."
+  [ `uname` == "Linux" -o `uname` == "Darwin" ] || die "This must run from a Linux or Mac OSX box."
 
   # Check dest dir exists
   [ -n "$DEST_DIR" ] || die "Usage: $0 <destination-directory> [build-number]"