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 'errors.dart' show 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 'ticker.dart' show Ticker; | 25 import 'ticker.dart' show Ticker; |
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 28 matching lines...) Expand all Loading... |
77 | 77 |
78 var result = await generateKernel( | 78 var result = await generateKernel( |
79 new ProcessedOptions(options, false, [Uri.parse('dart:core')]), | 79 new ProcessedOptions(options, false, [Uri.parse('dart:core')]), |
80 buildSummary: true, | 80 buildSummary: true, |
81 buildProgram: true); | 81 buildProgram: true); |
82 new File.fromUri(outlineOutput).writeAsBytesSync(result.summary); | 82 new File.fromUri(outlineOutput).writeAsBytesSync(result.summary); |
83 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); | 83 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); |
84 await writeProgramToFile(result.program, fullOutput); | 84 await writeProgramToFile(result.program, fullOutput); |
85 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); | 85 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); |
86 } | 86 } |
OLD | NEW |