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 libraryRoot = relativize(dartVmLocation, dartUri); |
kasperl
2012/04/27 13:50:14
Is libraryRoot still useful to you?
ahe
2012/04/27 14:40:12
No. I removed it.
| |
69 libraryRoot = uriPathToNative('/../$libraryRoot'); | 69 libraryRoot = uriPathToNative('/../$libraryRoot'); |
70 String dart2jsPathWin = dart2jsPath.replaceAll("/", "\\"); | |
70 | 71 |
71 print('dartUri = $dartUri'); | 72 print('dartUri = $dartUri'); |
72 print('dartVmLocation = $dartVmLocation'); | 73 print('dartVmLocation = $dartVmLocation'); |
73 print('dart2jsUri = $dart2jsUri'); | 74 print('dart2jsUri = $dart2jsUri'); |
74 print('dart2jsPath = $dart2jsPath'); | 75 print('dart2jsPath = $dart2jsPath'); |
76 print('dart2jsPathWin = $dart2jsPathWin'); | |
75 print('libraryRoot = $libraryRoot'); | 77 print('libraryRoot = $libraryRoot'); |
76 | 78 |
77 return [ | 79 return [ |
78 """ | 80 ''' |
79 #!${dartVmLocation.path}$options | 81 #!/bin/sh |
80 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 82 # 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 | 83 # 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. | 84 # BSD-style license that can be found in the LICENSE file. |
83 | 85 |
84 #import('dart:io'); | 86 BIN_DIR=`dirname \$0` |
85 | 87 exec \$BIN_DIR/dart$options \$BIN_DIR/$dart2jsPath "\$@" |
86 #import('$dart2jsPath'); | 88 ''', |
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 ''' | 89 ''' |
110 @echo off | 90 @echo off |
111 REM Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 91 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 | 92 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. | 93 REM BSD-style license that can be found in the LICENSE file. |
114 | 94 |
115 set SCRIPTPATH=%~dp0 | 95 set SCRIPTPATH=%~dp0 |
116 | 96 |
117 REM Does the path have a trailing slash? If so, remove it. | 97 REM Does the path have a trailing slash? If so, remove it. |
118 if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1% | 98 if %SCRIPTPATH:~-1%==\ set SCRIPTPATH=%SCRIPTPATH:~0,-1% |
119 | 99 |
120 set arguments=%* | 100 set arguments=%* |
121 | 101 |
122 "%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%\dart2js" %arguments% | 102 "%SCRIPTPATH%\dart.exe"$options "%SCRIPTPATH%$dart2jsPathWin" %arguments% |
123 '''.replaceAll('\n', '\r\n')]; | 103 '''.replaceAll('\n', '\r\n')]; |
124 } | 104 } |
OLD | NEW |