| 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, File; | 9 import 'dart:io' show exitCode, File; |
| 10 | 10 |
| 11 import '../../compiler_options.dart' show CompilerOptions; | 11 import '../../compiler_options.dart' show CompilerOptions; |
| 12 | 12 |
| 13 import '../base/processed_options.dart' show ProcessedOptions; | 13 import '../base/processed_options.dart' show ProcessedOptions; |
| 14 | 14 |
| 15 import '../kernel_generator_impl.dart' show generateKernel; | 15 import '../kernel_generator_impl.dart' show generateKernel; |
| 16 | 16 |
| 17 import 'compiler_command_line.dart' show CompilerCommandLine; | 17 import 'compiler_command_line.dart' show CompilerCommandLine; |
| 18 | 18 |
| 19 import 'compiler_context.dart' show CompilerContext; | 19 import 'compiler_context.dart' show CompilerContext; |
| 20 | 20 |
| 21 import 'deprecated_problems.dart' show deprecated_InputError; | 21 import 'deprecated_problems.dart' show deprecated_InputError; |
| 22 | 22 |
| 23 import 'kernel/utils.dart' show writeProgramToFile; | 23 import 'kernel/utils.dart' show writeProgramToFile; |
| 24 | 24 |
| 25 import 'severity.dart' show Severity; |
| 26 |
| 25 import 'ticker.dart' show Ticker; | 27 import 'ticker.dart' show Ticker; |
| 26 | 28 |
| 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); | 29 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); |
| 28 | 30 |
| 29 Future mainEntryPoint(List<String> arguments) async { | 31 Future mainEntryPoint(List<String> arguments) async { |
| 30 for (int i = 0; i < iterations; i++) { | 32 for (int i = 0; i < iterations; i++) { |
| 31 if (i > 0) { | 33 if (i > 0) { |
| 32 print("\n"); | 34 print("\n"); |
| 33 } | 35 } |
| 34 try { | 36 try { |
| 35 await compilePlatform(arguments); | 37 await compilePlatform(arguments); |
| 36 } on deprecated_InputError catch (e) { | 38 } on deprecated_InputError catch (e) { |
| 37 exitCode = 1; | 39 exitCode = 1; |
| 38 print(e.deprecated_format()); | 40 CompilerContext.current |
| 41 .report(deprecated_InputError.toMessage(e), Severity.error); |
| 39 return null; | 42 return null; |
| 40 } | 43 } |
| 41 } | 44 } |
| 42 } | 45 } |
| 43 | 46 |
| 44 Future compilePlatform(List<String> arguments) async { | 47 Future compilePlatform(List<String> arguments) async { |
| 45 Ticker ticker = new Ticker(); | 48 Ticker ticker = new Ticker(); |
| 46 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, | 49 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, |
| 47 (CompilerContext c) { | 50 (CompilerContext c) { |
| 48 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); | 51 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 77 | 80 |
| 78 var result = await generateKernel( | 81 var result = await generateKernel( |
| 79 new ProcessedOptions(options, false, [Uri.parse('dart:core')]), | 82 new ProcessedOptions(options, false, [Uri.parse('dart:core')]), |
| 80 buildSummary: true, | 83 buildSummary: true, |
| 81 buildProgram: true); | 84 buildProgram: true); |
| 82 new File.fromUri(outlineOutput).writeAsBytesSync(result.summary); | 85 new File.fromUri(outlineOutput).writeAsBytesSync(result.summary); |
| 83 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); | 86 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); |
| 84 await writeProgramToFile(result.program, fullOutput); | 87 await writeProgramToFile(result.program, fullOutput); |
| 85 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); | 88 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); |
| 86 } | 89 } |
| OLD | NEW |