aboutsummaryrefslogtreecommitdiffstats
path: root/uiautomatorviewer
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2012-08-06 16:22:33 -0700
committerSiva Velusamy <vsiva@google.com>2012-08-06 16:22:33 -0700
commit0c1e6a006742ab5841acee756db74ecc7acdf048 (patch)
tree6d5241f0523a9a5403c334fd60cec00d85284fcf /uiautomatorviewer
parente68867b12b200d82c80d8e2f77bbe11478027152 (diff)
downloadsdk-0c1e6a006742ab5841acee756db74ecc7acdf048.zip
sdk-0c1e6a006742ab5841acee756db74ecc7acdf048.tar.gz
sdk-0c1e6a006742ab5841acee756db74ecc7acdf048.tar.bz2
uiautomator: fix launch script
Change-Id: I9bc5007f1267dddaae351e8003d14d89f1fd26c9
Diffstat (limited to 'uiautomatorviewer')
-rw-r--r--uiautomatorviewer/etc/manifest.txt2
-rwxr-xr-xuiautomatorviewer/etc/uiautomatorviewer36
-rw-r--r--uiautomatorviewer/src/com/android/uiautomator/DebugBridge.java2
3 files changed, 22 insertions, 18 deletions
diff --git a/uiautomatorviewer/etc/manifest.txt b/uiautomatorviewer/etc/manifest.txt
index a606962..1ca57cc 100644
--- a/uiautomatorviewer/etc/manifest.txt
+++ b/uiautomatorviewer/etc/manifest.txt
@@ -1,2 +1,2 @@
-Main-Class: com.android.uiautomatorviewer.UiAutomatorViewer
+Main-Class: com.android.uiautomator.UiAutomatorViewer
Class-Path: org.eclipse.jface_3.6.2.M20110210-1200.jar org.eclipse.core.commands_3.6.0.I20100512-1500.jar org.eclipse.equinox.common_3.6.0.v20100503.jar
diff --git a/uiautomatorviewer/etc/uiautomatorviewer b/uiautomatorviewer/etc/uiautomatorviewer
index 605b81c..79faf5a 100755
--- a/uiautomatorviewer/etc/uiautomatorviewer
+++ b/uiautomatorviewer/etc/uiautomatorviewer
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+#
# Copyright 2012, The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,7 +16,6 @@
# 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}"`
@@ -29,15 +29,15 @@ while [ -h "${prog}" ]; do
done
oldwd=`pwd`
progdir=`dirname "${prog}"`
+progname=`basename "${prog}"`
cd "${progdir}"
progdir=`pwd`
-prog="${progdir}"/`basename "${prog}"`
+prog="${progdir}"/"${progname}"
cd "${oldwd}"
jarfile=uiautomatorviewer.jar
frameworkdir="$progdir"
libdir="$progdir"
-
if [ ! -r "$frameworkdir/$jarfile" ]
then
frameworkdir=`dirname "$progdir"`/tools/lib
@@ -50,23 +50,29 @@ then
fi
if [ ! -r "$frameworkdir/$jarfile" ]
then
- echo `basename "$prog"`": can't find $jarfile"
+ echo "${progname}: can't find $jarfile"
exit 1
fi
javaCmd="java"
-# Mac OS X needs an additional arg, or you get an "illegal thread" complaint.
-if [ `uname` = "Darwin" ]; then
- os_opts="-XstartOnFirstThread"
+os=`uname`
+if [ $os == 'Darwin' ]; then
+ javaOpts="-Xmx1600M -XstartOnFirstThread"
else
- os_opts=
+ javaOpts="-Xmx1600M"
fi
if [ `uname` = "Linux" ]; then
export GDK_NATIVE_WINDOWS=true
fi
+while expr "x$1" : 'x-J' >/dev/null; do
+ opt=`expr "x$1" : 'x-J\(.*\)'`
+ javaOpts="${javaOpts} -${opt}"
+ shift
+done
+
jarpath="$frameworkdir/$jarfile"
# Figure out the path to the swt.jar for the current architecture.
@@ -86,15 +92,13 @@ else
fi
fi
-if [ ! -d "$swtpath" ]; then
+# Combine the swtpath and the framework dir path.
+if [ -d "$swtpath" ]; then
+ frameworkdir="${swtpath}:${frameworkdir}"
+else
echo "SWT folder '${swtpath}' does not exist."
echo "Please export ANDROID_SWT to point to the folder containing swt.jar for your platform."
exit 1
fi
-# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
-# might need more memory, e.g. -Xmx128M
-exec "$javaCmd" \
- -Xmx512M $os_opts $java_debug \
- -classpath "$jarpath:$swtpath/swt.jar" \
- com.android.uiautomator.UiAutomatorViewer "$@"
+exec "${javaCmd}" $javaOpts -Djava.ext.dirs="$frameworkdir" -Dcom.android.uiautomator.bindir="$progdir" -jar "$jarpath" "$@"
diff --git a/uiautomatorviewer/src/com/android/uiautomator/DebugBridge.java b/uiautomatorviewer/src/com/android/uiautomator/DebugBridge.java
index 09272bc..986c5e4 100644
--- a/uiautomatorviewer/src/com/android/uiautomator/DebugBridge.java
+++ b/uiautomatorviewer/src/com/android/uiautomator/DebugBridge.java
@@ -43,7 +43,7 @@ public class DebugBridge {
}
// check if adb is present in the tools directory
- adb = new File(sdk, SdkConstants.FN_ADB);
+ adb = new File(toolsDir, SdkConstants.FN_ADB);
if (adb.exists()) {
return adb.getAbsolutePath();
}