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

Side by Side Diff: tools/full-coverage.dart

Issue 51043004: Remove uses of Options from tools directory. Fix platform_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tools/dom/docs/bin/docs.dart ('k') | tools/line_doc_comments.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 import "dart:async"; 5 import "dart:async";
6 import "dart:convert"; 6 import "dart:convert";
7 import "dart:io"; 7 import "dart:io";
8 import "dart:isolate"; 8 import "dart:isolate";
9 import "dart:mirrors"; 9 import "dart:mirrors";
10 10
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 static const int WORK = 3; 293 static const int WORK = 3;
294 294
295 final int type; 295 final int type;
296 final payload; 296 final payload;
297 297
298 Message(this.type, this.payload); 298 Message(this.type, this.payload);
299 } 299 }
300 300
301 final env = new Environment(); 301 final env = new Environment();
302 302
303 main() { 303 main(List<String> arguments) {
304 parseArgs(); 304 parseArgs(arguments);
305 305
306 List files = filesToProcess(env.input); 306 List files = filesToProcess(env.input);
307 int filesPerWorker = files.length ~/ env.workers; 307 int filesPerWorker = files.length ~/ env.workers;
308 List workerPorts = []; 308 List workerPorts = [];
309 int doneCnt = 0; 309 int doneCnt = 0;
310 310
311 List failedResolves = []; 311 List failedResolves = [];
312 List failedLoads = []; 312 List failedLoads = [];
313 Map globalHitmap = {}; 313 Map globalHitmap = {};
314 int start = new DateTime.now().millisecondsSinceEpoch; 314 int start = new DateTime.now().millisecondsSinceEpoch;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // off by at max (#workers - 1). 392 // off by at max (#workers - 1).
393 var p = spawnFunction(worker); 393 var p = spawnFunction(worker);
394 workerPorts.add(p); 394 workerPorts.add(p);
395 p.send(new Message(Message.WORK, [sharedEnv, files]), port.toSendPort()); 395 p.send(new Message(Message.WORK, [sharedEnv, files]), port.toSendPort());
396 396
397 return 0; 397 return 0;
398 } 398 }
399 399
400 /// Checks the validity of the provided arguments. Does not initialize actual 400 /// Checks the validity of the provided arguments. Does not initialize actual
401 /// processing. 401 /// processing.
402 parseArgs() { 402 parseArgs(List<String> arguments) {
403 var parser = new ArgParser(); 403 var parser = new ArgParser();
404 404
405 parser.addOption("sdk-root", abbr: "s", 405 parser.addOption("sdk-root", abbr: "s",
406 help: "path to the SDK root"); 406 help: "path to the SDK root");
407 parser.addOption("package-root", abbr: "p", 407 parser.addOption("package-root", abbr: "p",
408 help: "path to the package root"); 408 help: "path to the package root");
409 parser.addOption("in", abbr: "i", 409 parser.addOption("in", abbr: "i",
410 help: "input(s): may be file or directory"); 410 help: "input(s): may be file or directory");
411 parser.addOption("out", abbr: "o", 411 parser.addOption("out", abbr: "o",
412 help: "output: may be file or stdout", 412 help: "output: may be file or stdout",
413 defaultsTo: "stdout"); 413 defaultsTo: "stdout");
414 parser.addOption("workers", abbr: "j", 414 parser.addOption("workers", abbr: "j",
415 help: "number of workers", 415 help: "number of workers",
416 defaultsTo: "1"); 416 defaultsTo: "1");
417 parser.addFlag("pretty-print", abbr: "r", 417 parser.addFlag("pretty-print", abbr: "r",
418 help: "convert coverage data to pretty print format", 418 help: "convert coverage data to pretty print format",
419 negatable: false); 419 negatable: false);
420 parser.addFlag("lcov", abbr :"l", 420 parser.addFlag("lcov", abbr :"l",
421 help: "convert coverage data to lcov format", 421 help: "convert coverage data to lcov format",
422 negatable: false); 422 negatable: false);
423 parser.addFlag("verbose", abbr :"v", 423 parser.addFlag("verbose", abbr :"v",
424 help: "verbose output", 424 help: "verbose output",
425 negatable: false); 425 negatable: false);
426 parser.addFlag("help", abbr: "h", 426 parser.addFlag("help", abbr: "h",
427 help: "show this help", 427 help: "show this help",
428 negatable: false); 428 negatable: false);
429 429
430 var args = parser.parse(new Options().arguments); 430 var args = parser.parse(arguments);
431 431
432 printUsage() { 432 printUsage() {
433 print("Usage: dart full-coverage.dart [OPTION...]\n"); 433 print("Usage: dart full-coverage.dart [OPTION...]\n");
434 print(parser.getUsage()); 434 print(parser.getUsage());
435 } 435 }
436 436
437 fail(String msg) { 437 fail(String msg) {
438 print("\n$msg\n"); 438 print("\n$msg\n");
439 printUsage(); 439 printUsage();
440 exit(1); 440 exit(1);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 493 }
494 494
495 try { 495 try {
496 env.workers = int.parse("${args["workers"]}"); 496 env.workers = int.parse("${args["workers"]}");
497 } catch (e) { 497 } catch (e) {
498 fail("Invalid worker count: $e"); 498 fail("Invalid worker count: $e");
499 } 499 }
500 500
501 env.verbose = args["verbose"]; 501 env.verbose = args["verbose"];
502 } 502 }
OLDNEW
« no previous file with comments | « tools/dom/docs/bin/docs.dart ('k') | tools/line_doc_comments.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698