OSDN Git Service

Merge "Update tools to r13" into tools_r13
[android-x86/sdk.git] / sdkmanager / app / etc / android.bat
1 @echo off\r
2 rem Copyright (C) 2007 The Android Open Source Project\r
3 rem\r
4 rem Licensed under the Apache License, Version 2.0 (the "License");\r
5 rem you may not use this file except in compliance with the License.\r
6 rem You may obtain a copy of the License at\r
7 rem\r
8 rem      http://www.apache.org/licenses/LICENSE-2.0\r
9 rem\r
10 rem Unless required by applicable law or agreed to in writing, software\r
11 rem distributed under the License is distributed on an "AS IS" BASIS,\r
12 rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 rem See the License for the specific language governing permissions and\r
14 rem limitations under the License.\r
15 \r
16 rem Useful links:\r
17 rem Command-line reference:\r
18 rem   http://technet.microsoft.com/en-us/library/bb490890.aspx\r
19 \r
20 rem don't modify the caller's environment\r
21 setlocal\r
22 \r
23 rem Set up prog to be the path of this script, including following symlinks,\r
24 rem and set up progdir to be the fully-qualified pathname of its directory.\r
25 set prog=%~f0\r
26 \r
27 rem Grab current directory before we change it\r
28 set work_dir="%cd%"\r
29 \r
30 rem Change current directory and drive to where the script is, to avoid\r
31 rem issues with directories containing whitespaces.\r
32 cd /d %~dp0\r
33 \r
34 \r
35 rem Check we have a valid Java.exe in the path.\r
36 set java_exe=\r
37 call lib\find_java.bat\r
38 if not defined java_exe goto :EOF\r
39 \r
40 set jar_path=lib\sdkmanager.jar;lib\swtmenubar.jar\r
41 \r
42 rem Set SWT.Jar path based on current architecture (x86 or x86_64)\r
43 for /f %%a in ('%java_exe% -jar lib\archquery.jar') do set swt_path=lib\%%a\r
44 \r
45 if "%1 %2"=="update sdk" goto StartUi\r
46 if not "%1"=="" goto EndTempCopy\r
47 :StartUi\r
48     rem Starting Android SDK and AVD Manager UI\r
49 \r
50     rem We're now going to create a temp dir to hold all the Jar files needed\r
51     rem to run the android tool, copy them in the temp dir and finally execute\r
52     rem from that path. We do this only when the launcher is run without\r
53     rem arguments, to display the SDK Updater UI. This allows the updater to\r
54     rem update the tools directory where the updater itself is located.\r
55 \r
56     set tmp_dir=%TEMP%\temp-android-tool\r
57     xcopy %swt_path% %tmp_dir%\%swt_path% /I /E /C /G /R /Y /Q > nul\r
58     copy /B /D /Y lib\androidprefs.jar   %tmp_dir%\lib\        > nul\r
59     copy /B /D /Y lib\org.eclipse.*      %tmp_dir%\lib\        > nul\r
60     copy /B /D /Y lib\sdk*               %tmp_dir%\lib\        > nul\r
61     copy /B /D /Y lib\common.jar         %tmp_dir%\lib\        > nul\r
62     copy /B /D /Y lib\commons-compress*  %tmp_dir%\lib\        > nul\r
63 \r
64     rem jar_path and swt_path are relative to PWD so we don't need to adjust them, just change dirs.\r
65     set tools_dir=%cd%\r
66     cd /d %tmp_dir%\r
67 \r
68 :EndTempCopy\r
69 \r
70 rem The global ANDROID_SWT always override the SWT.Jar path\r
71 if defined ANDROID_SWT set swt_path=%ANDROID_SWT%\r
72 \r
73 if exist %swt_path% goto SetPath\r
74     echo ERROR: SWT folder '%swt_path%' does not exist.\r
75     echo Please set ANDROID_SWT to point to the folder containing swt.jar for your platform.\r
76     goto :EOF\r
77 \r
78 :SetPath\r
79 rem Finally exec the java program and end here.\r
80 call %java_exe% -Dcom.android.sdkmanager.toolsdir="%tools_dir%" -Dcom.android.sdkmanager.workdir=%work_dir% -classpath "%jar_path%;%swt_path%\swt.jar" com.android.sdkmanager.Main %*\r
81 \r
82 rem EOF\r