| 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 'package:front_end/src/fasta/kernel/utils.dart'; | |
| 10 import 'ticker.dart' show Ticker; | |
| 11 | |
| 12 import 'dart:io' show exitCode; | 9 import 'dart:io' show exitCode; |
| 13 | 10 |
| 14 import 'compiler_command_line.dart' show CompilerCommandLine; | 11 import 'compiler_command_line.dart' show CompilerCommandLine; |
| 15 | 12 |
| 16 import 'compiler_context.dart' show CompilerContext; | 13 import 'compiler_context.dart' show CompilerContext; |
| 17 | 14 |
| 15 import 'dill/dill_target.dart' show DillTarget; |
| 16 |
| 18 import 'errors.dart' show InputError; | 17 import 'errors.dart' show InputError; |
| 19 | 18 |
| 20 import 'kernel/kernel_target.dart' show KernelTarget; | 19 import 'kernel/kernel_target.dart' show KernelTarget; |
| 21 | 20 |
| 22 import 'dill/dill_target.dart' show DillTarget; | 21 import 'kernel/utils.dart' show printProgramText, writeProgramToFile; |
| 22 |
| 23 import 'ticker.dart' show Ticker; |
| 23 | 24 |
| 24 import 'translate_uri.dart' show TranslateUri; | 25 import 'translate_uri.dart' show TranslateUri; |
| 25 | 26 |
| 26 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); | 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); |
| 27 | 28 |
| 28 Future mainEntryPoint(List<String> arguments) async { | 29 Future mainEntryPoint(List<String> arguments) async { |
| 29 for (int i = 0; i < iterations; i++) { | 30 for (int i = 0; i < iterations; i++) { |
| 30 if (i > 0) { | 31 if (i > 0) { |
| 31 print("\n"); | 32 print("\n"); |
| 32 } | 33 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 63 ticker.logMs("Parsed arguments"); | 64 ticker.logMs("Parsed arguments"); |
| 64 if (ticker.isVerbose) { | 65 if (ticker.isVerbose) { |
| 65 print("Generating outline of $patchedSdk into $outlineOutput"); | 66 print("Generating outline of $patchedSdk into $outlineOutput"); |
| 66 print("Compiling $patchedSdk to $fullOutput"); | 67 print("Compiling $patchedSdk to $fullOutput"); |
| 67 } | 68 } |
| 68 | 69 |
| 69 TranslateUri uriTranslator = | 70 TranslateUri uriTranslator = |
| 70 await TranslateUri.parse(c.fileSystem, patchedSdk, c.options.packages); | 71 await TranslateUri.parse(c.fileSystem, patchedSdk, c.options.packages); |
| 71 ticker.logMs("Read packages file"); | 72 ticker.logMs("Read packages file"); |
| 72 | 73 |
| 73 DillTarget dillTarget = new DillTarget(ticker, uriTranslator); | 74 DillTarget dillTarget = |
| 75 new DillTarget(ticker, uriTranslator, c.options.target); |
| 74 KernelTarget kernelTarget = new KernelTarget(c.fileSystem, dillTarget, | 76 KernelTarget kernelTarget = new KernelTarget(c.fileSystem, dillTarget, |
| 75 uriTranslator, c.options.strongMode, c.uriToSource); | 77 uriTranslator, c.options.strongMode, c.uriToSource); |
| 76 | 78 |
| 77 kernelTarget.read(Uri.parse("dart:core")); | 79 kernelTarget.read(Uri.parse("dart:core")); |
| 78 await dillTarget.buildOutlines(); | 80 await dillTarget.buildOutlines(); |
| 79 var outline = await kernelTarget.buildOutlines(); | 81 var outline = await kernelTarget.buildOutlines(); |
| 80 | 82 |
| 81 await writeProgramToFile(outline, outlineOutput); | 83 await writeProgramToFile(outline, outlineOutput); |
| 82 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); | 84 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); |
| 83 | 85 |
| 84 if (exitCode != 0) return null; | 86 if (exitCode != 0) return null; |
| 85 | 87 |
| 86 var program = await kernelTarget.buildProgram(verify: c.options.verify); | 88 var program = await kernelTarget.buildProgram(verify: c.options.verify); |
| 87 if (c.options.dumpIr) printProgramText(program); | 89 if (c.options.dumpIr) printProgramText(program); |
| 88 await writeProgramToFile(program, fullOutput); | 90 await writeProgramToFile(program, fullOutput); |
| 89 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); | 91 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); |
| 90 await kernelTarget.writeDepsFile(fullOutput, deps); | 92 await kernelTarget.writeDepsFile(fullOutput, deps); |
| 91 } | 93 } |
| OLD | NEW |