OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #import('dart:io'); | 5 #import('dart:io'); |
6 #import('dart:uri'); | 6 #import('dart:uri'); |
7 | 7 |
8 #import('../../lib/compiler/implementation/util/uri_extras.dart'); | 8 #import('../../lib/compiler/implementation/util/uri_extras.dart'); |
9 #import('../../lib/compiler/implementation/filenames.dart'); | 9 #import('../../lib/compiler/implementation/filenames.dart'); |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 exit(exitCode); | 58 exit(exitCode); |
59 } | 59 } |
60 } | 60 } |
61 new Process.run('/bin/chmod', ['+x', uri.path], null, onExit); | 61 new Process.run('/bin/chmod', ['+x', uri.path], null, onExit); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 List<String> buildScript(Uri dartUri, Uri dartVmLocation, String options) { | 65 List<String> buildScript(Uri dartUri, Uri dartVmLocation, String options) { |
66 Uri dart2jsUri = dartUri.resolve('lib/compiler/implementation/dart2js.dart'); | 66 Uri dart2jsUri = dartUri.resolve('lib/compiler/implementation/dart2js.dart'); |
67 String dart2jsPath = relativize(dartVmLocation, dart2jsUri); | 67 String dart2jsPath = relativize(dartVmLocation, dart2jsUri); |
68 String libraryRoot = relativize(dartVmLocation, dartUri); | 68 String dart2jsPathWin = dart2jsPath.replaceAll("/", "\\"); |
69 libraryRoot = uriPathToNative('/../$libraryRoot'); | |
70 | 69 |
71 print('dartUri = $dartUri'); | 70 print('dartUri = $dartUri'); |
72 print('dartVmLocation = $dartVmLocation'); | 71 print('dartVmLocation = $dartVmLocation'); |
73 print('dart2jsUri = $dart2jsUri'); | 72 print('dart2jsUri = $dart2jsUri'); |
74 print('dart2jsPath = $dart2jsPath'); | 73 print('dart2jsPath = $dart2jsPath'); |
75 print('libraryRoot = $libraryRoot'); | 74 print('dart2jsPathWin = $dart2jsPathWin'); |
76 | 75 |
77 return [ | 76 return [ |
78 """ | 77 ''' |
79 #!${dartVmLocation.path}$options | 78 #!/bin/sh |
80 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 79 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
81 // for details. All rights reserved. Use of this source code is governed by a | 80 # for details. All rights reserved. Use of this source code is governed by a |
82 // BSD-style license that can be found in the LICENSE file. | 81 # BSD-style license that can be found in the LICENSE file. |
83 | 82 |
84 #import('dart:io'); | 83 BIN_DIR=`dirname \$0` |
85 | 84 exec \$BIN_DIR/dart$options \$BIN_DIR/$dart2jsPath "\$@" |
86 #import('$dart2jsPath'); | 85 ''', |
87 | |
88 void main() { | |
89 try { | |
90 String libraryRoot = @'$libraryRoot'; | |
91 String script = new Options().script; | |
92 List<String> argv = ['--library-root=\$script\$libraryRoot']; | |
93 argv.addAll(new Options().arguments); | |
94 compile(argv); | |
95 } catch (var exception, var trace) { | |
96 try { | |
97 print('Internal error: \$exception'); | |
98 } catch (var ignored) { | |
99 print('Internal error: error while printing exception'); | |
100 } | |
101 try { | |
102 print(trace); | |
103 } finally { | |
104 exit(253); // 253 is recognized as a crash by our test scripts. | |
105 } | |
106 } | |
107 } | |
108 """, | |
109 ''' | 86 ''' |
110 @echo off | 87 @echo off |
111 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 88 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
112 REM for details. All rights reserved. Use of this source code is governed by a | 89 REM for details. All rights reserved. Use of this source code is governed by a |
113 REM BSD-style license that can be found in the LICENSE file. | 90 REM BSD-style license that can be found in the LICENSE file. |
114 | 91 |
115 set SCRIPTPATH=%~dp0 | 92 set SCRIPTPATH=%~dp0 |
116 | 93 |
117 REM Does the path have a trailing slash? If so, remove it. | 94 REM Does the path have a trailing slash? If so, remove it. |
118 if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1% | 95 if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1% |
119 | 96 |
120 set arguments=%* | 97 set arguments=%* |
121 | 98 |
122 "%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%\dart2js" %arguments% | 99 "%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%$dart2jsPathWin" %arguments% |
123 '''.replaceAll('\n', '\r\n')]; | 100 '''.replaceAll('\n', '\r\n')]; |
124 } | 101 } |
OLD | NEW |