blob: d3bdbd8a0c40987288e5b622b7cdb90b9708d428 [file] [log] [blame]
Raphael Moll2ecff7c2013-03-13 17:59:03 -07001@echo off
2rem Copyright (C) 2012 The Android Open Source Project
3rem
4rem Licensed under the Apache License, Version 2.0 (the "License");
5rem you may not use this file except in compliance with the License.
6rem You may obtain a copy of the License at
7rem
8rem http://www.apache.org/licenses/LICENSE-2.0
9rem
10rem Unless required by applicable law or agreed to in writing, software
11rem distributed under the License is distributed on an "AS IS" BASIS,
12rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13rem See the License for the specific language governing permissions and
14rem limitations under the License.
15
16rem don't modify the caller's environment
17setlocal
18
19rem Set up prog to be the path of this script, including following symlinks,
20rem and set up progdir to be the fully-qualified pathname of its directory.
21set prog=%~f0
22
23rem Change current directory and drive to where the script is, to avoid
24rem issues with directories containing whitespaces.
25cd /d %~dp0
26
27rem Get the CWD as a full path with short names only (without spaces)
28for %%i in ("%cd%") do set prog_dir=%%~fsi
29
30rem Check we have a valid Java.exe in the path.
31set java_exe=
32call lib\find_java.bat
33if not defined java_exe goto :EOF
34
35set jarfile=uiautomatorviewer.jar
Scott Barta9d4302d2013-08-20 09:47:56 -070036set frameworkdir=.
Raphael Moll2ecff7c2013-03-13 17:59:03 -070037
Scott Barta9d4302d2013-08-20 09:47:56 -070038if exist %frameworkdir%\%jarfile% goto JarFileOk
39 set frameworkdir=lib
Raphael Moll2ecff7c2013-03-13 17:59:03 -070040
Scott Barta9d4302d2013-08-20 09:47:56 -070041if exist %frameworkdir%\%jarfile% goto JarFileOk
42 set frameworkdir=..\framework
Raphael Moll2ecff7c2013-03-13 17:59:03 -070043
44:JarFileOk
45
Scott Barta9d4302d2013-08-20 09:47:56 -070046set jarpath=%frameworkdir%\%jarfile%
Raphael Moll2ecff7c2013-03-13 17:59:03 -070047
48if not defined ANDROID_SWT goto QueryArch
49 set swt_path=%ANDROID_SWT%
50 goto SwtDone
51
52:QueryArch
53
Scott Barta9d4302d2013-08-20 09:47:56 -070054 for /f "delims=" %%a in ('"%java_exe%" -jar %frameworkdir%\archquery.jar') do set swt_path=%frameworkdir%\%%a
Raphael Moll2ecff7c2013-03-13 17:59:03 -070055
56:SwtDone
57
Scott Barta9d4302d2013-08-20 09:47:56 -070058if exist "%swt_path%" goto SetPath
Raphael Moll2ecff7c2013-03-13 17:59:03 -070059 echo SWT folder '%swt_path%' does not exist.
60 echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.
61 exit /B
62
63:SetPath
64set javaextdirs=%swt_path%;%frameworkdir%
65
Scott Barta9d4302d2013-08-20 09:47:56 -070066call "%java_exe%" "-Djava.ext.dirs=%javaextdirs%" "-Dcom.android.uiautomator.bindir=%prog_dir%" -jar %jarpath% %*