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

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

Issue 2722223006: Move all main methods to tool/. (Closed)
Patch Set: Update tools/patch_sdk.dart. Created 3 years, 9 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 | « pkg/front_end/lib/src/fasta/bin/run.dart ('k') | pkg/front_end/lib/src/fasta/outline.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 'kernel/verifier.dart' show verifyProgram; 9 import 'kernel/verifier.dart' show verifyProgram;
10 10
11 import 'ticker.dart' show Ticker; 11 import 'ticker.dart' show Ticker;
12 12
13 import 'dart:io' show exitCode; 13 import 'dart:io' show exitCode;
14 14
15 import 'compiler_command_line.dart' show CompilerCommandLine; 15 import 'compiler_command_line.dart' show CompilerCommandLine;
16 16
17 import 'compiler_context.dart' show CompilerContext; 17 import 'compiler_context.dart' show CompilerContext;
18 18
19 import 'errors.dart' show InputError; 19 import 'errors.dart' show InputError;
20 20
21 import 'kernel/kernel_target.dart' show KernelTarget; 21 import 'kernel/kernel_target.dart' show KernelTarget;
22 22
23 import 'dill/dill_target.dart' show DillTarget; 23 import 'dill/dill_target.dart' show DillTarget;
24 24
25 import 'translate_uri.dart' show TranslateUri; 25 import 'translate_uri.dart' show TranslateUri;
26 26
27 Future main(List<String> arguments) async { 27 const int iterations = const int.fromEnvironment("iterations", defaultValue: 1);
28 Ticker ticker = new Ticker(); 28
29 try { 29 Future mainEntryPoint(List<String> arguments) async {
30 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments, 30 for (int i = 0; i < iterations; i++) {
31 (CompilerContext c) => compilePlatform(c, ticker)); 31 if (i > 0) {
32 } on InputError catch (e) { 32 print("\n");
33 exitCode = 1; 33 }
34 print(e.format()); 34 Ticker ticker = new Ticker();
35 return null; 35 try {
36 await CompilerCommandLine.withGlobalOptions("compile_platform", arguments,
37 (CompilerContext c) => compilePlatform(c, ticker));
38 } on InputError catch (e) {
39 exitCode = 1;
40 print(e.format());
41 return null;
42 }
36 } 43 }
37 } 44 }
38 45
39 Future compilePlatform(CompilerContext c, Ticker ticker) async { 46 Future compilePlatform(CompilerContext c, Ticker ticker) async {
40 ticker.isVerbose = c.options.verbose; 47 ticker.isVerbose = c.options.verbose;
41 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1])); 48 Uri output = Uri.base.resolveUri(new Uri.file(c.options.arguments[1]));
42 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0])); 49 Uri patchedSdk = Uri.base.resolveUri(new Uri.file(c.options.arguments[0]));
43 ticker.logMs("Parsed arguments"); 50 ticker.logMs("Parsed arguments");
44 if (ticker.isVerbose) { 51 if (ticker.isVerbose) {
45 print("Compiling $patchedSdk to $output"); 52 print("Compiling $patchedSdk to $output");
(...skipping 22 matching lines...) Expand all
68 ticker.logMs("Verified program"); 75 ticker.logMs("Verified program");
69 } catch (e, s) { 76 } catch (e, s) {
70 exitCode = 1; 77 exitCode = 1;
71 print("Verification of program failed: $e"); 78 print("Verification of program failed: $e");
72 if (s != null && c.options.verbose) { 79 if (s != null && c.options.verbose) {
73 print(s); 80 print(s);
74 } 81 }
75 } 82 }
76 } 83 }
77 } 84 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/bin/run.dart ('k') | pkg/front_end/lib/src/fasta/outline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698