aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorRaphael Moll <raphael@google.com>2012-01-25 13:33:57 -0800
committerRaphael <raphael@google.com>2012-03-21 21:32:47 -0700
commitd9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b (patch)
tree2c74ef27ea01816b773ee916d8b30807892b6680 /eclipse
parent7a795b5291224e2b85885f4d1f4d7ac097e96d3c (diff)
downloadsdk-d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b.zip
sdk-d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b.tar.gz
sdk-d9b2cbd3378a671d924c5ad6c5db5ef96ea6cf3b.tar.bz2
Build Monitor RCP as part of SDK (Mac, Linux and Win)
This adds a new SDK/tools/monitor[.bat] wrapper as well as SDK/tools/lib/monitor-x86[_64]/ directories that contain the actual RCP application. The monitor shell wrappers + bat have not been properly tested yet. The goal of this CL is just to build the RCP. In a following CL we'll adjust the wrapper and the actual binary location in the SDK. Cross-dependency: Requires build.git change Ifb31e2e3. Change-Id: I7afbd63badfb81fd5d3d899de672e02525a49bc2
Diffstat (limited to 'eclipse')
-rwxr-xr-xeclipse/scripts/create_all_symlinks.sh101
-rw-r--r--eclipse/scripts/rcp/Android.mk41
-rwxr-xr-xeclipse/scripts/rcp/monitor38
-rwxr-xr-xeclipse/scripts/rcp/monitor.bat27
4 files changed, 179 insertions, 28 deletions
diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh
index b274ed3..25dce68 100755
--- a/eclipse/scripts/create_all_symlinks.sh
+++ b/eclipse/scripts/create_all_symlinks.sh
@@ -1,43 +1,81 @@
#!/bin/bash
+# See usage() below for the description.
+
+function usage() {
+ cat <<EOF
# This script copies the .jar files that each plugin depends on into the plugins libs folder.
# By default, on Mac & Linux, this script creates symlinks from the libs folder to the jar file.
# Since Windows does not support symlinks, the jar files are copied.
-# Use option "-f" to copy files rather than creating symlinks on the Mac/Linux platforms.
+#
+# Options:
+# -f : to copy files rather than creating symlinks on the Mac/Linux platforms.
+# -d : print make dependencies instead of running make; doesn't copy files.
+# -c : copy files expected after make dependencies (reported by -d) have been built.
+#
+# The purpose of -d/-c is to include the workflow in a make file:
+# - the make rule should depend on \$(shell create_all_symlinks -d)
+# - the rule body should perform \$(shell create_all_symlinks -c [-f])
+EOF
+}
-echo "## Running $0"
# CD to the top android directory
PROG_DIR=`dirname "$0"`
cd "${PROG_DIR}/../../../"
HOST=`uname`
-USE_COPY="" # force copy dependent jar files rather than creating symlinks
+USE_COPY="" # force copy dependent jar files rather than creating symlinks
+ONLY_SHOW_DEPS="" # only report make dependencies but don't build them nor copy.
+ONLY_COPY_DEPS="" # only copy dependencies built by make; uses -f as needed.
function die() {
- echo "Error: $*"
+ echo "Error: $*" >/dev/stderr
exit 1
}
+function warn() {
+ # Only print something if not in show-deps mode
+ if [[ -z $ONLY_SHOW_DEPS ]]; then
+ echo "$*"
+ fi
+}
+
## parse arguments
while [ $# -gt 0 ]; do
- if [ "$1" == "-f" ]; then
- USE_COPY="1"
- fi
+ case "$1" in
+ "-f" )
+ USE_COPY="1"
+ ;;
+ "-d" )
+ ONLY_SHOW_DEPS="1"
+ ;;
+ "-c" )
+ ONLY_COPY_DEPS="1"
+ ;;
+ * )
+ usage
+ exit 2
+ esac
shift
done
-if [ "$HOST" == "Linux" ]; then
+warn "## Running $0"
+
+if [[ "${HOST:0:6}" == "CYGWIN" || "$USE_MINGW" == "1" ]]; then
+ # This is either Cygwin or Linux/Mingw cross-compiling to Windows.
+ PLATFORM="windows-x86"
+ if [[ "${HOST:0:6}" == "CYGWIN" ]]; then
+ # We can't use symlinks under Cygwin
+ USE_COPY="1"
+ fi
+elif [[ "$HOST" == "Linux" ]]; then
PLATFORM="linux-x86"
-elif [ "$HOST" == "Darwin" ]; then
+elif [[ "$HOST" == "Darwin" ]]; then
PLATFORM="darwin-x86"
-elif [ "${HOST:0:6}" == "CYGWIN" ]; then
- USE_COPY="1" # We can't use symlinks under Cygwin
- PLATFORM="windows-x86"
else
- echo "Unsupported platform ($HOST). Aborting."
- exit 1
+ die "Unsupported platform ($HOST). Aborting."
fi
-if [ "$USE_COPY" == "1" ]; then
+if [[ "$USE_COPY" == "1" ]]; then
function cpfile { # $1=source $2=dest
cp -fv $1 $2/
}
@@ -167,25 +205,32 @@ if [[ $PLATFORM != "windows-x86" ]]; then
CP_FILES="$CP_FILES @:$GLD_DEST $GLD_LIBS $GLD_PREBUILTS"
fi
-# Make sure we have lunch sdk-<something>
-if [[ ! "$TARGET_PRODUCT" ]]; then
- echo "## TARGET_PRODUCT is not set, running build/envsetup.sh"
- . build/envsetup.sh
- echo "## lunch sdk-eng"
- lunch sdk-eng
+# In the mode to only echo dependencies, output them and we're done
+if [[ -n $ONLY_SHOW_DEPS ]]; then
+ echo $LIBS
+ exit 0
fi
-# Run make on all libs
+if [[ -z $ONLY_COPY_DEPS ]]; then
+ # Make sure we have lunch sdk-<something>
+ if [[ ! "$TARGET_PRODUCT" ]]; then
+ warn "## TARGET_PRODUCT is not set, running build/envsetup.sh"
+ . build/envsetup.sh
+ warn "## lunch sdk-eng"
+ lunch sdk-eng
+ fi
-J="4"
-[[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ')
-[[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l)
+ # Run make on all libs
-echo "## Building libs: make -j$J $LIBS"
-make -j${J} $LIBS
+ J="4"
+ [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ')
+ [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l)
-# Copy resulting files
+ warn "## Building libs: make -j$J $LIBS"
+ make -j${J} $LIBS
+fi
+# Copy resulting files
DEST=""
for SRC in $CP_FILES; do
if [[ "${SRC:0:2}" == "@:" ]]; then
diff --git a/eclipse/scripts/rcp/Android.mk b/eclipse/scripts/rcp/Android.mk
new file mode 100644
index 0000000..18302c2
--- /dev/null
+++ b/eclipse/scripts/rcp/Android.mk
@@ -0,0 +1,41 @@
+# Copyright 2012 The Android Open Source Project
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := monitor
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE_TAGS := optional
+LOCAL_IS_HOST_MODULE := true
+include $(BUILD_SYSTEM)/base_rules.mk
+
+RCP_MONITOR_DIR := $(TOPDIR)out/host/eclipse/rcp/build/I.RcpBuild
+
+define mk-rcp-monitor-atree-file
+ srczip=$(RCP_MONITOR_DIR)/RcpBuild-$(1).$(2).zip && \
+ dstdir=$(HOST_OUT)/eclipse/monitor-$(1).$(2) && \
+ rm -rf $(V) $$dstdir && \
+ mkdir -p $$dstdir && \
+ unzip -q $$srczip -d $$dstdir
+endef
+
+# The RCP monitor. It is referenced by build/target/products/sdk.mk
+$(LOCAL_BUILT_MODULE) : $(TOPDIR)sdk/eclipse/scripts/rcp/monitor \
+ $(TOPDIR)sdk/eclipse/scripts/rcp/build.xml \
+ $(TOPDIR)sdk/eclipse/scripts/rcp/build.properties \
+ $(shell $(TOPDIR)sdk/eclipse/scripts/create_all_symlinks.sh -d)
+ @mkdir -p $(dir $@)
+ $(hide)$(TOPDIR)sdk/eclipse/scripts/create_all_symlinks.sh -c
+ $(hide)cd $(TOPDIR)sdk/eclipse/scripts/rcp && ant -DbuildFor=$(HOST_OS)
+ $(hide)cp $(V) $(TOPDIR)sdk/eclipse/scripts/rcp/monitor $@
+ $(hide)if [[ $(HOST_OS) == "linux" ]]; then \
+ $(call mk-rcp-monitor-atree-file,linux.gtk,x86) ; \
+ $(call mk-rcp-monitor-atree-file,linux.gtk,x86_64) ; \
+ fi
+ $(hide)if [[ $(HOST_OS) == "darwin" ]]; then \
+ $(call mk-rcp-monitor-atree-file,macosx.cocoa,x86_64) ; \
+ fi
+ $(hide)if [[ $(HOST_OS) == "windows" ]]; then \
+ $(call mk-rcp-monitor-atree-file,win32.win32,x86) ; \
+ $(call mk-rcp-monitor-atree-file,win32.win32,x86_64) ; \
+ fi
diff --git a/eclipse/scripts/rcp/monitor b/eclipse/scripts/rcp/monitor
new file mode 100755
index 0000000..be4a1cd
--- /dev/null
+++ b/eclipse/scripts/rcp/monitor
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Copyright 2012, The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up prog to be the path of this script, including following symlinks,
+# and set up progdir to be the fully-qualified pathname of its directory.
+prog="$0"
+while [ -h "${prog}" ]; do
+ newProg=`/bin/ls -ld "${prog}"`
+ newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+ if expr "x${newProg}" : 'x/' >/dev/null; then
+ prog="${newProg}"
+ else
+ progdir=`dirname "${prog}"`
+ prog="${progdir}/${newProg}"
+ fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+
+javaCmd="java"
+
+vmarch=`${javaCmd} -jar tools/lib/archquery.jar`
+
+exec tools/lib/monitor-${vmarch}/monitor
+
diff --git a/eclipse/scripts/rcp/monitor.bat b/eclipse/scripts/rcp/monitor.bat
new file mode 100755
index 0000000..bc69849
--- /dev/null
+++ b/eclipse/scripts/rcp/monitor.bat
@@ -0,0 +1,27 @@
+@echo off
+rem Copyright (C) 2012 The Android Open Source Project
+rem
+rem Licensed under the Apache License, Version 2.0 (the "License");
+rem you may not use this file except in compliance with the License.
+rem You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+rem don't modify the caller's environment
+setlocal
+
+rem Change current directory and drive to where the script is, to avoid
+rem issues with directories containing whitespaces.
+cd /d %~dp0
+
+:QueryArch
+for /f %%a in ('%java_exe% -jar tools\lib\archquery.jar') do set vmarch=%%a
+
+call tools\lib\monitor-%vmarch%\monitor
+