| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 fasta.compile_platform; | 5 library fasta.compile_platform; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'dart:io' show exitCode; | 9 import 'dart:io' show exitCode; |
| 10 | 10 |
| 11 import 'compiler_command_line.dart' show CompilerCommandLine; | 11 import 'compiler_command_line.dart' show CompilerCommandLine; |
| 12 | 12 |
| 13 import 'compiler_context.dart' show CompilerContext; | 13 import 'compiler_context.dart' show CompilerContext; |
| 14 | 14 |
| 15 import 'dill/dill_target.dart' show DillTarget; | 15 import 'dill/dill_target.dart' show DillTarget; |
| 16 | 16 |
| 17 import 'errors.dart' show InputError; | 17 import 'deprecated_problems.dart' show deprecated_InputError; |
| 18 | 18 |
| 19 import 'kernel/kernel_target.dart' show KernelTarget; | 19 import 'kernel/kernel_target.dart' show KernelTarget; |
| 20 | 20 |
| 21 import 'kernel/utils.dart' show printProgramText, writeProgramToFile; | 21 import 'kernel/utils.dart' show printProgramText, writeProgramToFile; |
| 22 | 22 |
| 23 import 'ticker.dart' show Ticker; | 23 import 'ticker.dart' show Ticker; |
| 24 | 24 |
| 25 import 'translate_uri.dart' show TranslateUri; | 25 import 'translate_uri.dart' show TranslateUri; |
| 26 | 26 |
| 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); | 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); |
| 28 | 28 |
| 29 Future mainEntryPoint(List<String> arguments) async { | 29 Future mainEntryPoint(List<String> arguments) async { |
| 30 for (int i = 0; i < iterations; i++) { | 30 for (int i = 0; i < iterations; i++) { |
| 31 if (i > 0) { | 31 if (i > 0) { |
| 32 print("\n"); | 32 print("\n"); |
| 33 } | 33 } |
| 34 try { | 34 try { |
| 35 await compilePlatform(arguments); | 35 await compilePlatform(arguments); |
| 36 } on InputError catch (e) { | 36 } on deprecated_InputError catch (e) { |
| 37 exitCode = 1; | 37 exitCode = 1; |
| 38 print(e.format()); | 38 print(e.deprecated_format()); |
| 39 return null; | 39 return null; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 Future compilePlatform(List<String> arguments) async { | 44 Future compilePlatform(List<String> arguments) async { |
| 45 Ticker ticker = new Ticker(); | 45 Ticker ticker = new Ticker(); |
| 46 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, | 46 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, |
| 47 (CompilerContext c) { | 47 (CompilerContext c) { |
| 48 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); | 48 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); | 84 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); |
| 85 | 85 |
| 86 if (exitCode != 0) return null; | 86 if (exitCode != 0) return null; |
| 87 | 87 |
| 88 var program = await kernelTarget.buildProgram(verify: c.options.verify); | 88 var program = await kernelTarget.buildProgram(verify: c.options.verify); |
| 89 if (c.options.dumpIr) printProgramText(program); | 89 if (c.options.dumpIr) printProgramText(program); |
| 90 await writeProgramToFile(program, fullOutput); | 90 await writeProgramToFile(program, fullOutput); |
| 91 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); | 91 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); |
| 92 await kernelTarget.writeDepsFile(fullOutput, deps); | 92 await kernelTarget.writeDepsFile(fullOutput, deps); |
| 93 } | 93 } |
| OLD | NEW |