am 24d28782: Merge change 5913 into donut

Merge commit '24d287822ff025d65f1767de6ce1d1350e5948f9'

* commit '24d287822ff025d65f1767de6ce1d1350e5948f9':
  SDK Updater: Make it possible for tools to update themselves.
This commit is contained in:
Android (Google) Code Review
2009-07-02 15:23:35 -07:00
committed by The Android Open Source Project

View File

@@ -27,28 +27,32 @@ rem Change current directory and drive to where the script is, to avoid
rem issues with directories containing whitespaces. rem issues with directories containing whitespaces.
cd /d %~dp0 cd /d %~dp0
set jarfile=sdkmanager.jar set jarpath=lib\sdkmanager.jar
set frameworkdir=
if exist %frameworkdir%%jarfile% goto JarFileOk rem Set SWT.Jar path based on current architecture (x86 or x86_64)
set frameworkdir=lib\ for /f %%a in ('java -jar lib\archquery.jar') do set swt_path=lib\%%a
if exist %frameworkdir%%jarfile% goto JarFileOk if not "%1"=="" goto EndTempCopy
set frameworkdir=..\framework\ echo Starting Android SDK Updater
:JarFileOk rem We're now going to create a temp dir to hold all the Jar files needed
rem to run the android tool, copy them in the temp dir and finally adjust
rem the paths accordingly. We do this only when the launcher is run without
rem arguments, to display the SDK Updater UI. This allows the updater to
rem update the tools directory where the updater itself is located.
set jarpath=%frameworkdir%%jarfile% set tmpdir=%TEMP%\temp-android-tool
xcopy lib\x86 %tmpdir%\lib\x86 /I /E /C /G /R /O /Y /Q > nul
copy /B /D /Y lib\androidprefs.jar %tmpdir%\lib\ > nul
copy /B /D /Y lib\org.eclipse.* %tmpdir%\lib\ > nul
copy /B /D /Y lib\sdk* %tmpdir%\lib\ > nul
set jarpath=%tmpdir%\%jarpath%
set swt_path=%tmpdir%\%swt_path%
if not defined ANDROID_SWT goto QueryArch :EndTempCopy
set swt_path=%ANDROID_SWT%
goto SwtDone rem The global ANDROID_SWT always override the SWT.Jar path
if defined ANDROID_SWT set swt_path=%ANDROID_SWT%
:QueryArch
for /f %%a in ('java -jar %frameworkdir%archquery.jar') do set swt_path=%frameworkdir%%%a
:SwtDone
if exist %swt_path% goto SetPath if exist %swt_path% goto SetPath
echo SWT folder '%swt_path%' does not exist. echo SWT folder '%swt_path%' does not exist.
@@ -56,6 +60,6 @@ if exist %swt_path% goto SetPath
exit /B exit /B
:SetPath :SetPath
set javaextdirs=%swt_path%;%frameworkdir% set javaextdirs=%swt_path%;lib\
call java -Djava.ext.dirs=%javaextdirs% -Dcom.android.sdkmanager.toolsdir= -Dcom.android.sdkmanager.workdir="%workdir%" -jar %jarpath% %* call java -Djava.ext.dirs=%javaextdirs% -Dcom.android.sdkmanager.toolsdir= -Dcom.android.sdkmanager.workdir="%workdir%" -jar %jarpath% %*