OLD | NEW |
| (Empty) |
1 @echo off | |
2 rem #!/bin/bash --posix | |
3 rem Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
4 rem for details. All rights reserved. Use of this source code is governed by a | |
5 rem BSD-style license that can be found in the LICENSE file. | |
6 rem | |
7 rem stop if any of the steps fails | |
8 rem set -e | |
9 rem | |
10 | |
11 rem SCRIPT_DIR=$(dirname $0) | |
12 set SCRIPT_DIR=%~dp0 | |
13 if %SCRIPT_DIR:~-1%==\ set SCRIPT_DIR=%SCRIPT_DIR:~0,-1% | |
14 | |
15 rem DART_ANALYZER_HOME=$(dirname $SCRIPT_DIR) | |
16 for %%I in ("%SCRIPT_DIR%\..") do set "DART_ANALYZER_HOME=%%~fI" | |
17 if %DART_ANALYZER_HOME:~-1%==\ set DART_ANALYZER_HOME=%DART_ANALYZER_HOME:~0,-1% | |
18 | |
19 set FOUND_BATCH=0 | |
20 set FOUND_SDK=0 | |
21 for %%a in (%*) do ( | |
22 if [%%a] == [--batch] set FOUND_BATCH=1 | |
23 if [%%a] == [-b] set FOUND_BATCH=1 | |
24 if [%%a] == [--dart-sdk] set FOUND_SDK=1 | |
25 ) | |
26 | |
27 rem FOUND_BATCH=0 | |
28 rem FOUND_SDK=0 | |
29 rem for ARG in "$@" | |
30 rem do | |
31 rem case $ARG in | |
32 rem -batch|--batch) | |
33 rem FOUND_BATCH=1 | |
34 rem ;; | |
35 rem --dart-sdk) | |
36 rem FOUND_SDK=1 | |
37 rem ;; | |
38 rem *) | |
39 rem ;; | |
40 rem esac | |
41 rem done | |
42 rem | |
43 | |
44 setlocal EnableDelayedExpansion | |
45 set DART_SDK="" | |
46 if [%FOUND_SDK%] == [0] ( | |
47 if exist "%DART_ANALYZER_HOME%\lib\core\core.dart" ( | |
48 set DART_SDK=--dart-sdk "%DART_ANALYZER_HOME%" | |
49 ) else ( | |
50 for /f %%i in ('echo %DART_ANALYZER_HOME%') do set DART_SDK_HOME=%%~dpi\dart
-sdk | |
51 if exist "!DART_SDK_HOME!" ( | |
52 set DART_SDK=--dart-sdk !DART_SDK_HOME! | |
53 ) else ( | |
54 for /f %%j in ('call echo !DART_SDK_HOME!') do set DART_SDK_HOME=%%~dpj\da
rt-sdk | |
55 if exist "!DART_SDK_HOME!" ( | |
56 set DART_SDK=--dart-sdk !DART_SDK_HOME! | |
57 ) else ( | |
58 echo Couldn't find Dart SDK. Specify with --dart-sdk cmdline argument | |
59 ) | |
60 ) | |
61 ) | |
62 ) | |
63 endlocal & set "DART_SDK=%DART_SDK%" & set "DART_SDK_HOME=%DART_SDK_HOME%" | |
64 | |
65 rem DART_SDK="" | |
66 rem if [ $FOUND_SDK = 0 ] ; then | |
67 rem if [ -f $DART_ANALYZER_HOME/lib/core/core.dart ] ; then | |
68 rem DART_SDK="--dart-sdk $DART_ANALYZER_HOME" | |
69 rem else | |
70 rem DART_SDK_HOME=$(dirname $DART_ANALYZER_HOME)/dart-sdk | |
71 rem if [ -d $DART_SDK_HOME ] ; then | |
72 rem DART_SDK="--dart-sdk $DART_SDK_HOME" | |
73 rem else | |
74 rem DART_SDK_HOME=$(dirname $DART_SDK_HOME)/dart-sdk | |
75 rem if [ -d $DART_SDK_HOME ] ; then | |
76 rem DART_SDK="--dart-sdk $DART_SDK_HOME" | |
77 rem else | |
78 rem echo "Couldn't find Dart SDK. Specify with --dart-sdk cmdline argume
nt" | |
79 rem fi | |
80 rem fi | |
81 rem fi | |
82 rem fi | |
83 rem | |
84 | |
85 if exist "%DART_SDK_HOME%\util\analyzer\dart_analyzer.jar" ( | |
86 set DART_ANALYZER_LIBS=%DART_SDK_HOME%\util\analyzer | |
87 ) else if exist "%DART_ANALYZER_HOME%\util\analyzer\dart_analyzer.jar" ( | |
88 set DART_ANALYZER_LIBS=%DART_ANALYZER_HOME%\util\analyzer | |
89 ) else ( | |
90 echo Configuration problem. Couldn't find dart_analyzer.jar. | |
91 exit /b 1 | |
92 ) | |
93 | |
94 rem if [ -f $DART_SDK_HOME/util/analyzer/dart_analyzer.jar ] ; then | |
95 rem DART_ANALYZER_LIBS=$DART_SDK_HOME/util/analyzer | |
96 rem elif [ -f $DART_ANALYZER_HOME/util/analyzer/dart_analyzer.jar ] ; then | |
97 rem DART_ANALYZER_LIBS=$DART_ANALYZER_HOME/util/analyzer | |
98 rem else | |
99 rem echo "Configuration problem. Couldn't find dart_analyzer.jar." | |
100 rem exit 1 | |
101 rem fi | |
102 | |
103 rem | |
104 rem if [ -x /usr/libexec/java_home ]; then | |
105 rem export JAVA_HOME=$(/usr/libexec/java_home -v '1.6+') | |
106 rem fi | |
107 rem | |
108 | |
109 setlocal EnableDelayedExpansion | |
110 set EXTRA_JVMARGS=-Xss2M | |
111 if [%FOUND_BATCH%] == [1] ( | |
112 set EXTRA_JVMARGS=!EXTRA_JVMARGS! -client | |
113 ) | |
114 endlocal & set "EXTRA_JVMARGS=%EXTRA_JVMARGS%" | |
115 | |
116 rem EXTRA_JVMARGS="-Xss2M " | |
117 rem OS=`uname | tr [A-Z] [a-z]` | |
118 rem if [ "$OS" == "darwin" ] ; then | |
119 rem # Bump up the heap on Mac VMs, some of which default to 128M or less. | |
120 rem # Users can specify DART_JVMARGS in the environment to override | |
121 rem # this setting. Force to 32 bit client vm. 64 bit and server VM make for | |
122 rem # poor performance. | |
123 rem EXTRA_JVMARGS+=" -Xmx256M -client -d32 " | |
124 rem else | |
125 rem # On other architectures | |
126 rem # -batch invocations will do better with a server vm | |
127 rem # invocations for analyzing a single file do better with a client vm | |
128 rem if [ $FOUND_BATCH = 0 ] ; then | |
129 rem EXTRA_JVMARGS+=" -client " | |
130 rem fi | |
131 rem fi | |
132 rem | |
133 | |
134 java %EXTRA_JVMARGS% %DART_JVMARGS% -ea -classpath "@CLASSPATH@" ^ | |
135 com.google.dart.compiler.DartCompiler %DART_SDK% %* | |
136 | |
137 rem exec java $EXTRA_JVMARGS $DART_JVMARGS -ea -classpath "@CLASSPATH@" \ | |
138 rem com.google.dart.compiler.DartCompiler ${DART_SDK} $@ | |
139 rem | |
OLD | NEW |