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

Side by Side Diff: pkg/compiler/tool/generate_kernel.dart

Issue 2999553002: Fix compile_from_dill test. (Closed)
Patch Set: Created 3 years, 4 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 | no next file » | 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 /// Helper to run fasta with the right target configuration to build dart2js 5 /// Helper to run fasta with the right target configuration to build dart2js
6 /// applications using the dart2js platform libraries. 6 /// applications using the dart2js platform libraries.
7 // TODO(sigmund): delete this file once we can configure fasta directly on the 7 // TODO(sigmund): delete this file once we can configure fasta directly on the
8 // command line. 8 // command line.
9 library compiler.tool.generate_kernel; 9 library compiler.tool.generate_kernel;
10 10
11 import 'dart:io'; 11 import 'dart:io';
12 12
13 import 'package:args/args.dart'; 13 import 'package:args/args.dart';
14 import 'package:compiler/src/kernel/dart2js_target.dart'; 14 import 'package:compiler/src/kernel/dart2js_target.dart';
15 import 'package:front_end/front_end.dart'; 15 import 'package:front_end/front_end.dart';
16 import 'package:front_end/src/fasta/util/relativize.dart'; 16 import 'package:front_end/src/fasta/util/relativize.dart';
17 import 'package:kernel/kernel.dart'; 17 import 'package:kernel/kernel.dart';
18 import 'package:kernel/target/targets.dart'; 18 import 'package:kernel/target/targets.dart';
19 19
20 main(List<String> args) async { 20 main(List<String> args) async {
21 ArgResults flags = _argParser.parse(args); 21 ArgResults flags = _argParser.parse(args);
22 var options = new CompilerOptions() 22 var options = new CompilerOptions()
23 ..target = new Dart2jsTarget(new TargetFlags()) 23 ..target = new Dart2jsTarget(new TargetFlags())
24 ..packagesFileUri = Uri.base.resolve('.packages') 24 ..packagesFileUri = Uri.base.resolve('.packages')
25 ..compileSdk = true
26 ..setExitCodeOnProblem = true 25 ..setExitCodeOnProblem = true
27 ..linkedDependencies = [Uri.base.resolve(flags['platform'])]; 26 ..linkedDependencies = [Uri.base.resolve(flags['platform'])];
28 27
29 if (flags.rest.isEmpty) { 28 if (flags.rest.isEmpty) {
30 var script = relativizeUri(Platform.script); 29 var script = relativizeUri(Platform.script);
31 var platform = relativizeUri(Uri.base.resolve(flags['platform'])); 30 var platform = relativizeUri(Uri.base.resolve(flags['platform']));
32 print('usage: ${Platform.executable} $script ' 31 print('usage: ${Platform.executable} $script '
33 '[--platform=$platform] [--out=out.dill] program.dart'); 32 '[--platform=$platform] [--out=out.dill] program.dart');
34 exit(1); 33 exit(1);
35 } 34 }
36 35
37 Uri entry = Uri.base.resolve(flags.rest.first); 36 Uri entry = Uri.base.resolve(flags.rest.first);
38 var program = await kernelForProgram(entry, options); 37 var program = await kernelForProgram(entry, options);
39 await writeProgramToBinary(program, flags['out']); 38 await writeProgramToBinary(program, flags['out']);
40 } 39 }
41 40
42 ArgParser _argParser = new ArgParser() 41 ArgParser _argParser = new ArgParser()
43 ..addOption('platform', 42 ..addOption('platform',
44 help: 'location of the precompiled dart2js sdk', 43 help: 'location of the precompiled dart2js sdk',
45 defaultsTo: _defaultPlatform) 44 defaultsTo: _defaultPlatform)
46 ..addOption('out', 45 ..addOption('out',
47 abbr: 'o', help: 'output location', defaultsTo: 'out.dill'); 46 abbr: 'o', help: 'output location', defaultsTo: 'out.dill');
48 47
49 String _defaultPlatform = Uri 48 String _defaultPlatform = Uri
50 .parse(Platform.resolvedExecutable) 49 .parse(Platform.resolvedExecutable)
51 .resolve('patched_dart2js_sdk/platform.dill') 50 .resolve('patched_dart2js_sdk/platform.dill')
52 .toString(); 51 .toString();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698