OSDN Git Service

Fix dx.bat to match the new SDK structure.
[android-x86/dalvik.git] / dx / etc / dx.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 don't modify the caller's environment\r
17 setlocal\r
18 \r
19 REM Locate dx.jar in the directory where dx.bat was found and start it.\r
20 \r
21 REM Set up prog to be the path of this script, including following symlinks,\r
22 REM and set up progdir to be the fully-qualified pathname of its directory.\r
23 set prog=%~f0\r
24 \r
25 REM Change current directory to where dx is, to avoid issues with directories\r
26 REM containing whitespaces.\r
27 cd /d %~dp0\r
28 \r
29 rem Check we have a valid Java.exe in the path.\r
30 set java_exe=\r
31 if exist    ..\tools\lib\find_java.bat call    ..\tools\lib\find_java.bat\r
32 if exist ..\..\tools\lib\find_java.bat call ..\..\tools\lib\find_java.bat\r
33 if not defined java_exe goto :EOF\r
34 \r
35 set jarfile=dx.jar\r
36 set frameworkdir=\r
37 \r
38 if exist %frameworkdir%%jarfile% goto JarFileOk\r
39     set frameworkdir=lib\\r
40 \r
41 if exist %frameworkdir%%jarfile% goto JarFileOk\r
42     set frameworkdir=..\framework\\r
43 \r
44 :JarFileOk\r
45 \r
46 set jarpath=%frameworkdir%%jarfile%\r
47 \r
48 set javaOpts=\r
49 set args=\r
50 \r
51 REM By default, give dx a max heap size of 1 gig and a stack size of 1meg.\r
52 rem This can be overridden by using "-JXmx..." and "-JXss..." options below.\r
53 set defaultXmx=-Xmx1024M\r
54 set defaultXss=-Xss1m\r
55 \r
56 REM Capture all arguments that are not -J options.\r
57 REM Note that when reading the input arguments with %1, the cmd.exe\r
58 REM automagically converts --name=value arguments into 2 arguments "--name"\r
59 REM followed by "value". Dx has been changed to know how to deal with that.\r
60 set params=\r
61 \r
62 :firstArg\r
63 if [%1]==[] goto endArgs\r
64 set a=%~1\r
65 \r
66     if [%defaultXmx%]==[] goto notXmx\r
67     if %a:~0,5% NEQ -JXmx goto notXmx\r
68         set defaultXmx=\r
69     :notXmx\r
70 \r
71     if [%defaultXss%]==[] goto notXss\r
72     if %a:~0,5% NEQ -JXss goto notXss\r
73         set defaultXss=\r
74     :notXss\r
75 \r
76     if %a:~0,2% NEQ -J goto notJ\r
77         set javaOpts=%javaOpts% -%a:~2%\r
78         shift /1\r
79         goto firstArg\r
80 \r
81     :notJ\r
82     set params=%params% %1\r
83     shift /1\r
84     goto firstArg\r
85 \r
86 :endArgs\r
87 \r
88 set javaOpts=%javaOpts% %defaultXmx% %defaultXss%\r
89 \r
90 call %java_exe% %javaOpts% -Djava.ext.dirs=%frameworkdir% -jar %jarpath% %params%\r