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/kernel/bin/dartk.dart

Issue 2668893004: VM: [Kernel] Add --embedder-entry-points-manifest to dartk/transform and pass it to the treeshaker (Closed)
Patch Set: Add missing bin/util.dart Created 3 years, 10 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/kernel/bin/transform.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 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'batch_util.dart'; 9 import 'batch_util.dart';
10 import 'util.dart';
10 11
11 import 'package:args/args.dart'; 12 import 'package:args/args.dart';
12 import 'package:kernel/analyzer/loader.dart'; 13 import 'package:kernel/analyzer/loader.dart';
13 import 'package:kernel/application_root.dart'; 14 import 'package:kernel/application_root.dart';
14 import 'package:kernel/verifier.dart'; 15 import 'package:kernel/verifier.dart';
15 import 'package:kernel/kernel.dart'; 16 import 'package:kernel/kernel.dart';
16 import 'package:kernel/log.dart'; 17 import 'package:kernel/log.dart';
17 import 'package:kernel/target/targets.dart'; 18 import 'package:kernel/target/targets.dart';
18 import 'package:path/path.dart' as path; 19 import 'package:path/path.dart' as path;
19 20
(...skipping 29 matching lines...) Expand all
49 defaultsTo: 'vm') 50 defaultsTo: 'vm')
50 ..addFlag('strong', 51 ..addFlag('strong',
51 help: 'Load .dart files in strong mode.\n' 52 help: 'Load .dart files in strong mode.\n'
52 'Does not affect loading of binary files. Strong mode support is very\ n' 53 'Does not affect loading of binary files. Strong mode support is very\ n'
53 'unstable and not well integrated yet.') 54 'unstable and not well integrated yet.')
54 ..addFlag('link', abbr: 'l', help: 'Link the whole program into one file.') 55 ..addFlag('link', abbr: 'l', help: 'Link the whole program into one file.')
55 ..addFlag('no-output', negatable: false, help: 'Do not output any files.') 56 ..addFlag('no-output', negatable: false, help: 'Do not output any files.')
56 ..addOption('url-mapping', 57 ..addOption('url-mapping',
57 allowMultiple: true, 58 allowMultiple: true,
58 help: 'A custom url mapping of the form `<scheme>:<name>::<uri>`.') 59 help: 'A custom url mapping of the form `<scheme>:<name>::<uri>`.')
60 ..addOption('embedder-entry-points-manifest',
61 allowMultiple: true,
62 help: 'A path to a file describing entrypoints '
63 '(lines of the form `<library>,<class>,<member>`).')
59 ..addFlag('verbose', 64 ..addFlag('verbose',
60 abbr: 'v', 65 abbr: 'v',
61 negatable: false, 66 negatable: false,
62 help: 'Print internal warnings and diagnostics to stderr.') 67 help: 'Print internal warnings and diagnostics to stderr.')
63 ..addFlag('print-metrics', 68 ..addFlag('print-metrics',
64 negatable: false, help: 'Print performance metrics.') 69 negatable: false, help: 'Print performance metrics.')
65 ..addOption('write-dependencies', 70 ..addOption('write-dependencies',
66 help: 'Write all the .dart that were loaded to the given file.') 71 help: 'Write all the .dart that were loaded to the given file.')
67 ..addFlag('verify-ir', help: 'Perform slow internal correctness checks.') 72 ..addFlag('verify-ir', help: 'Perform slow internal correctness checks.')
68 ..addFlag('tolerant', 73 ..addFlag('tolerant',
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 String file = options.rest.single; 278 String file = options.rest.single;
274 checkIsFile(file, option: 'Input file'); 279 checkIsFile(file, option: 'Input file');
275 file = new File(file).absolute.path; 280 file = new File(file).absolute.path;
276 Uri fileUri = new Uri(scheme: 'file', path: file); 281 Uri fileUri = new Uri(scheme: 'file', path: file);
277 282
278 String format = options['format'] ?? defaultFormat(); 283 String format = options['format'] ?? defaultFormat();
279 String outputFile = options['out'] ?? defaultOutput(); 284 String outputFile = options['out'] ?? defaultOutput();
280 285
281 List<String> urlMapping = options['url-mapping'] as List<String>; 286 List<String> urlMapping = options['url-mapping'] as List<String>;
282 var customUriMappings = parseCustomUriMappings(urlMapping); 287 var customUriMappings = parseCustomUriMappings(urlMapping);
288
289 List<String> embedderEntryPointManifests =
290 options['embedder-entry-points-manifest'] as List<String>;
291 List<ProgramRoot> programRoots =
292 parseProgramRoots(embedderEntryPointManifests);
293
283 var repository = new Repository(); 294 var repository = new Repository();
284 295
285 Program program; 296 Program program;
286 297
287 var watch = new Stopwatch()..start(); 298 var watch = new Stopwatch()..start();
288 List<String> loadedFiles; 299 List<String> loadedFiles;
289 Function getLoadedFiles; 300 Function getLoadedFiles;
290 List errors = const []; 301 List errors = const [];
291 TargetFlags targetFlags = new TargetFlags(strongMode: options['strong']); 302 TargetFlags targetFlags = new TargetFlags(
303 strongMode: options['strong'], programRoots: programRoots);
292 Target target = getTarget(options['target'], targetFlags); 304 Target target = getTarget(options['target'], targetFlags);
293 305
294 var declaredVariables = <String, String>{}; 306 var declaredVariables = <String, String>{};
295 declaredVariables.addAll(target.extraDeclaredVariables); 307 declaredVariables.addAll(target.extraDeclaredVariables);
296 for (String define in options['D']) { 308 for (String define in options['D']) {
297 int separator = define.indexOf('='); 309 int separator = define.indexOf('=');
298 if (separator == -1) { 310 if (separator == -1) {
299 fail('Invalid define: -D$define. Format is -D<name>=<value>'); 311 fail('Invalid define: -D$define. Format is -D<name>=<value>');
300 } 312 }
301 String name = define.substring(0, separator); 313 String name = define.substring(0, separator);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 407
396 await ioFuture; 408 await ioFuture;
397 409
398 if (shouldReportMetrics) { 410 if (shouldReportMetrics) {
399 int flushTime = watch.elapsedMilliseconds - time; 411 int flushTime = watch.elapsedMilliseconds - time;
400 print('writer.flush_time = $flushTime ms'); 412 print('writer.flush_time = $flushTime ms');
401 } 413 }
402 414
403 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok; 415 return errors.length > 0 ? CompilerOutcome.Fail : CompilerOutcome.Ok;
404 } 416 }
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/bin/transform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698