1@echo off 2rem Copyright (C) 2007 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 Useful links: 17rem Command-line reference: 18rem http://technet.microsoft.com/en-us/library/bb490890.aspx 19 20rem don't modify the caller's environment 21setlocal 22 23rem Set up prog to be the path of this script, including following symlinks, 24rem and set up progdir to be the fully-qualified pathname of its directory. 25set prog=%~f0 26 27rem Grab current directory before we change it 28set work_dir="%cd%" 29 30rem Change current directory and drive to where the script is, to avoid 31rem issues with directories containing whitespaces. 32cd /d %~dp0 33 34 35rem Check we have a valid Java.exe in the path. 36set java_exe= 37call lib\find_java.bat 38if not defined java_exe goto :EOF 39 40set jar_path=lib\sdkmanager.jar;lib\swtmenubar.jar 41 42rem Set SWT.Jar path based on current architecture (x86 or x86_64) 43for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a 44 45if "%1 %2"=="update sdk" goto StartUi 46if not "%1"=="" goto EndTempCopy 47:StartUi 48 rem Starting Android SDK and AVD Manager UI 49 50 rem We're now going to create a temp dir to hold all the Jar files needed 51 rem to run the android tool, copy them in the temp dir and finally execute 52 rem from that path. We do this only when the launcher is run without 53 rem arguments, to display the SDK Updater UI. This allows the updater to 54 rem update the tools directory where the updater itself is located. 55 56 set tmp_dir=%TEMP%\temp-android-tool 57 xcopy %swt_path% %tmp_dir%\%swt_path% /I /E /C /G /R /Y /Q > nul 58 copy /B /D /Y lib\androidprefs.jar %tmp_dir%\lib\ > nul 59 copy /B /D /Y lib\org.eclipse.* %tmp_dir%\lib\ > nul 60 copy /B /D /Y lib\sdk* %tmp_dir%\lib\ > nul 61 copy /B /D /Y lib\common.jar %tmp_dir%\lib\ > nul 62 copy /B /D /Y lib\commons-compress* %tmp_dir%\lib\ > nul 63 copy /B /D /Y lib\swtmenubar.jar %tmp_dir%\lib\ > nul 64 copy /B /D /Y lib\commons-logging* %tmp_dir%\lib\ > nul 65 copy /B /D /Y lib\commons-codec* %tmp_dir%\lib\ > nul 66 copy /B /D /Y lib\httpclient* %tmp_dir%\lib\ > nul 67 copy /B /D /Y lib\httpcore* %tmp_dir%\lib\ > nul 68 copy /B /D /Y lib\httpmime* %tmp_dir%\lib\ > nul 69 70 rem jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs. 71 set tools_dir=%cd% 72 cd /d %tmp_dir% 73 74:EndTempCopy 75 76rem The global ANDROID_SWT always override the SWT.Jar path 77if defined ANDROID_SWT set swt_path=%ANDROID_SWT% 78 79if exist %swt_path% goto SetPath 80 echo ERROR: SWT folder '%swt_path%' does not exist. 81 echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform. 82 goto :EOF 83 84:SetPath 85rem Finally exec the java program and end here. 86REM set REMOTE_DEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 87call %java_exe% %REMOTE_DEBUG% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir=%work_dir% -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %* 88 89rem EOF 90