Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: dart/lib/compiler/implementation/dart2js.dart

Issue 10257004: Turn dart2js into a shell script. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/utils/compiler/build_helper.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #library('dart2js'); 5 #library('dart2js');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 #import('dart:uri'); 8 #import('dart:uri');
9 #import('dart:utf'); 9 #import('dart:utf');
10 10
11 #import('../compiler.dart', prefix: 'api'); 11 #import('../compiler.dart', prefix: 'api');
12 #import('colors.dart'); 12 #import('colors.dart');
13 #import('source_file.dart'); 13 #import('source_file.dart');
14 #import('filenames.dart'); 14 #import('filenames.dart');
15 #import('util/uri_extras.dart'); 15 #import('util/uri_extras.dart');
16 16
17 final String LIBRARY_ROOT = '../../../..';
18
17 void compile(List<String> argv) { 19 void compile(List<String> argv) {
18 Uri cwd = getCurrentDirectory(); 20 Uri cwd = getCurrentDirectory();
19 bool throwOnError = false; 21 bool throwOnError = false;
20 bool showWarnings = true; 22 bool showWarnings = true;
21 bool verbose = false; 23 bool verbose = false;
22 Uri libraryRoot = cwd; 24 Uri libraryRoot = cwd;
23 Uri out = cwd.resolve('out.js'); 25 Uri out = cwd.resolve('out.js');
24 List<String> options = new List<String>(); 26 List<String> options = new List<String>();
25 27
26 List<String> arguments = <String>[]; 28 List<String> arguments = <String>[];
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 var buffer = new List<int>(length); 129 var buffer = new List<int>(length);
128 var bytes = file.readListSync(buffer, 0, length); 130 var bytes = file.readListSync(buffer, 0, length);
129 file.closeSync(); 131 file.closeSync();
130 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest()); 132 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest());
131 } 133 }
132 134
133 void fail(String message) { 135 void fail(String message) {
134 print(message); 136 print(message);
135 exit(1); 137 exit(1);
136 } 138 }
139
140 void compilerMain(Options options) {
141 List<String> argv = ['--library-root=${options.script}/$LIBRARY_ROOT'];
142 argv.addAll(options.arguments);
143 compile(argv);
144 }
145
146 void main() {
147 try {
148 compilerMain(new Options());
149 } catch (var exception, var trace) {
150 try {
151 print('Internal error: \$exception');
152 } catch (var ignored) {
153 print('Internal error: error while printing exception');
154 }
155 try {
156 print(trace);
157 } finally {
158 exit(253); // 253 is recognized as a crash by our test scripts.
159 }
160 }
161 }
OLDNEW
« no previous file with comments | « no previous file | dart/utils/compiler/build_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698