Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: pkg/front_end/lib/src/fasta/compile_platform.dart

Issue 2932513003: Add getTarget method to CompilerCommandLine (Closed)
Patch Set: Adjust CL to the changes in "master" Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/compiler_command_line.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'errors.dart' show 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 import 'package:kernel/target/targets.dart' show getTarget, TargetFlags;
28
29 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1); 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
30 28
31 Future mainEntryPoint(List<String> arguments) async { 29 Future mainEntryPoint(List<String> arguments) async {
32 for (int i = 0; i < iterations; i++) { 30 for (int i = 0; i < iterations; i++) {
33 if (i > 0) { 31 if (i > 0) {
34 print("\n"); 32 print("\n");
35 } 33 }
36 try { 34 try {
37 await compilePlatform(arguments); 35 await compilePlatform(arguments);
38 } on InputError catch (e) { 36 } on InputError catch (e) {
(...skipping 27 matching lines...) Expand all
66 ticker.logMs("Parsed arguments"); 64 ticker.logMs("Parsed arguments");
67 if (ticker.isVerbose) { 65 if (ticker.isVerbose) {
68 print("Generating outline of $patchedSdk into $outlineOutput"); 66 print("Generating outline of $patchedSdk into $outlineOutput");
69 print("Compiling $patchedSdk to $fullOutput"); 67 print("Compiling $patchedSdk to $fullOutput");
70 } 68 }
71 69
72 TranslateUri uriTranslator = await TranslateUri 70 TranslateUri uriTranslator = await TranslateUri
73 .parse(c.fileSystem, patchedSdk, packages: c.options.packages); 71 .parse(c.fileSystem, patchedSdk, packages: c.options.packages);
74 ticker.logMs("Read packages file"); 72 ticker.logMs("Read packages file");
75 73
76 DillTarget dillTarget = new DillTarget( 74 DillTarget dillTarget =
77 ticker, 75 new DillTarget(ticker, uriTranslator, c.options.target);
78 uriTranslator,
79 getTarget(
80 c.options.target, new TargetFlags(strongMode: c.options.strongMode)));
81 KernelTarget kernelTarget = 76 KernelTarget kernelTarget =
82 new KernelTarget(c.fileSystem, dillTarget, uriTranslator, c.uriToSource); 77 new KernelTarget(c.fileSystem, dillTarget, uriTranslator, c.uriToSource);
83 78
84 kernelTarget.read(Uri.parse("dart:core")); 79 kernelTarget.read(Uri.parse("dart:core"));
85 await dillTarget.buildOutlines(); 80 await dillTarget.buildOutlines();
86 var outline = await kernelTarget.buildOutlines(); 81 var outline = await kernelTarget.buildOutlines();
87 82
88 await writeProgramToFile(outline, outlineOutput); 83 await writeProgramToFile(outline, outlineOutput);
89 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}"); 84 ticker.logMs("Wrote outline to ${outlineOutput.toFilePath()}");
90 85
91 if (exitCode != 0) return null; 86 if (exitCode != 0) return null;
92 87
93 var program = await kernelTarget.buildProgram(verify: c.options.verify); 88 var program = await kernelTarget.buildProgram(verify: c.options.verify);
94 if (c.options.dumpIr) printProgramText(program); 89 if (c.options.dumpIr) printProgramText(program);
95 await writeProgramToFile(program, fullOutput); 90 await writeProgramToFile(program, fullOutput);
96 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}"); 91 ticker.logMs("Wrote program to ${fullOutput.toFilePath()}");
97 await kernelTarget.writeDepsFile(fullOutput, deps); 92 await kernelTarget.writeDepsFile(fullOutput, deps);
98 } 93 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/compiler_command_line.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698