OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.cmdline; | 5 library dart2js.cmdline; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io' | 8 import 'dart:io' |
9 show exit, File, FileMode, Options, Platform, RandomAccessFile; | 9 show exit, File, FileMode, Options, Platform, RandomAccessFile; |
10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 } | 306 } |
307 writeString(Uri.parse('$out.deps'), | 307 writeString(Uri.parse('$out.deps'), |
308 getDepsOutput(inputProvider.sourceFiles)); | 308 getDepsOutput(inputProvider.sourceFiles)); |
309 diagnosticHandler.info( | 309 diagnosticHandler.info( |
310 'compiled ${inputProvider.dartCharactersRead} characters Dart ' | 310 'compiled ${inputProvider.dartCharactersRead} characters Dart ' |
311 '-> $totalCharactersWritten characters $outputLanguage ' | 311 '-> $totalCharactersWritten characters $outputLanguage ' |
312 'in ${relativize(currentDirectory, out, isWindows)}'); | 312 'in ${relativize(currentDirectory, out, isWindows)}'); |
313 if (!explicitOut) { | 313 if (!explicitOut) { |
314 String input = uriPathToNative(arguments[0]); | 314 String input = uriPathToNative(arguments[0]); |
315 String output = relativize(currentDirectory, out, isWindows); | 315 String output = relativize(currentDirectory, out, isWindows); |
316 print('Dart file $input compiled to $outputLanguage: $output'); | 316 print('Dart file ($input) compiled to $outputLanguage: $output'); |
ahe
2013/09/23 17:13:42
Since I'm touching this, I figured I could fix htt
| |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 EventSink<String> outputProvider(String name, String extension) { | 320 EventSink<String> outputProvider(String name, String extension) { |
321 Uri uri; | 321 Uri uri; |
322 String sourceMapFileName; | 322 String sourceMapFileName; |
323 bool isPrimaryOutput = false; | 323 bool isPrimaryOutput = false; |
324 if (name == '') { | 324 if (name == '') { |
325 if (extension == 'js' || extension == 'dart') { | 325 if (extension == 'js' || extension == 'dart') { |
326 isPrimaryOutput = true; | 326 isPrimaryOutput = true; |
327 uri = out; | 327 uri = out; |
328 sourceMapFileName = | 328 sourceMapFileName = |
329 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1); | 329 sourceMapOut.path.substring(sourceMapOut.path.lastIndexOf('/') + 1); |
330 } else if (extension == 'precompiled.js') { | |
331 String outPath = out.path; | |
332 if (outPath.endsWith('.js')) { | |
333 outPath = outPath.substring(0, outPath.length - 3); | |
334 uri = out.resolve('$outPath.$extension'); | |
335 } else { | |
336 uri = out.resolve(extension); | |
337 } | |
338 diagnosticHandler.info( | |
339 "File ($uri) is compatible with header" | |
340 " \"Content-Security-Policy: script-src 'self'\""); | |
330 } else if (extension == 'js.map' || extension == 'dart.map') { | 341 } else if (extension == 'js.map' || extension == 'dart.map') { |
331 uri = sourceMapOut; | 342 uri = sourceMapOut; |
332 } else { | 343 } else { |
333 fail('Error: Unknown extension: $extension'); | 344 fail('Error: Unknown extension: $extension'); |
334 } | 345 } |
335 } else { | 346 } else { |
336 uri = out.resolve('$name.$extension'); | 347 uri = out.resolve('$name.$extension'); |
337 } | 348 } |
338 | 349 |
339 if (uri.scheme != 'file') { | 350 if (uri.scheme != 'file') { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
572 } | 583 } |
573 } finally { | 584 } finally { |
574 exit(253); // 253 is recognized as a crash by our test scripts. | 585 exit(253); // 253 is recognized as a crash by our test scripts. |
575 } | 586 } |
576 }); | 587 }); |
577 } | 588 } |
578 | 589 |
579 void main() { | 590 void main() { |
580 mainWithErrorHandler(new Options()); | 591 mainWithErrorHandler(new Options()); |
581 } | 592 } |
OLD | NEW |