Roll NDK to pick std::deque patch.
[android_tools.git] / sdk / tools / hierarchyviewer
bloba0cc5f98f25ea139e6f42753e8f147daf9bc0620
1 #!/bin/sh
2 # Copyright 2008, The Android Open Source Project
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Set up prog to be the path of this script, including following symlinks,
17 # and set up progdir to be the fully-qualified pathname of its directory.
19 prog="$0"
20 while [ -h "${prog}" ]; do
21 newProg=`/bin/ls -ld "${prog}"`
22 newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
23 if expr "x${newProg}" : 'x/' >/dev/null; then
24 prog="${newProg}"
25 else
26 progdir=`dirname "${prog}"`
27 prog="${progdir}/${newProg}"
29 done
30 oldwd=`pwd`
31 progdir=`dirname "${prog}"`
32 cd "${progdir}"
33 progdir=`pwd`
34 prog="${progdir}"/`basename "${prog}"`
35 cd "${oldwd}"
37 jarfile=hierarchyviewer2.jar
38 frameworkdir="$progdir"
39 libdir="$progdir"
40 if [ ! -r "$frameworkdir/$jarfile" ]
41 then
42 frameworkdir=`dirname "$progdir"`/tools/lib
43 libdir=`dirname "$progdir"`/tools/lib
45 if [ ! -r "$frameworkdir/$jarfile" ]
46 then
47 frameworkdir=`dirname "$progdir"`/framework
48 libdir=`dirname "$progdir"`/lib
50 if [ ! -r "$frameworkdir/$jarfile" ]
51 then
52 echo `basename "$prog"`": can't find $jarfile"
53 exit 1
57 # Check args.
58 if [ debug = "$1" ]; then
59 # add this in for debugging
60 java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
61 shift 1
62 else
63 java_debug=
66 javaCmd="java"
68 # Mac OS X needs an additional arg, or you get an "illegal thread" complaint.
69 if [ `uname` = "Darwin" ]; then
70 os_opts="-XstartOnFirstThread"
71 else
72 os_opts=
75 if [ `uname` = "Linux" ]; then
76 export GDK_NATIVE_WINDOWS=true
79 jarpath="$frameworkdir/$jarfile:$frameworkdir/swtmenubar.jar"
81 # Figure out the path to the swt.jar for the current architecture.
82 # if ANDROID_SWT is defined, then just use this.
83 # else, if running in the Android source tree, then look for the correct swt folder in prebuilt
84 # else, look for the correct swt folder in the SDK under tools/lib/
85 swtpath=""
86 if [ -n "$ANDROID_SWT" ]; then
87 swtpath="$ANDROID_SWT"
88 else
89 vmarch=`${javaCmd} -jar "${frameworkdir}"/archquery.jar`
90 if [ -n "$ANDROID_BUILD_TOP" ]; then
91 osname=`uname -s | tr A-Z a-z`
92 swtpath="${ANDROID_BUILD_TOP}/prebuilts/tools/${osname}-${vmarch}/swt"
93 else
94 swtpath="${frameworkdir}/${vmarch}"
98 if [ ! -d "$swtpath" ]; then
99 echo "SWT folder '${swtpath}' does not exist."
100 echo "Please export ANDROID_SWT to point to the folder containing swt.jar for your platform."
101 exit 1
104 if [ -x $progdir/monitor ]; then
105 echo "The standalone version of hieararchyviewer is deprecated."
106 echo "Please use Android Device Monitor (tools/monitor) instead."
108 # need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
109 # might need more memory, e.g. -Xmx128M
110 exec "$javaCmd" \
111 -Xmx512M $os_opts $java_debug \
112 -Dcom.android.hierarchyviewer.bindir="$progdir" \
113 -classpath "$jarpath:$swtpath/swt.jar" \
114 com.android.hierarchyviewer.HierarchyViewerApplication "$@"