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

Side by Side Diff: pkg/analyzer_cli/lib/src/options.dart

Issue 1859363003: allow --dart-sdk with --persisent_worker (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: code review updates Created 4 years, 8 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/analyzer_cli/lib/src/driver.dart ('k') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 analyzer_cli.src.options; 5 library analyzer_cli.src.options;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:analyzer_cli/src/driver.dart'; 9 import 'package:analyzer_cli/src/driver.dart';
10 import 'package:args/args.dart'; 10 import 'package:args/args.dart';
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 458
459 try { 459 try {
460 // TODO(scheglov) https://code.google.com/p/dart/issues/detail?id=11061 460 // TODO(scheglov) https://code.google.com/p/dart/issues/detail?id=11061
461 args = 461 args =
462 args.map((String arg) => arg == '-batch' ? '--batch' : arg).toList(); 462 args.map((String arg) => arg == '-batch' ? '--batch' : arg).toList();
463 Map<String, String> definedVariables = <String, String>{}; 463 Map<String, String> definedVariables = <String, String>{};
464 var results = parser.parse(args, definedVariables); 464 var results = parser.parse(args, definedVariables);
465 465
466 // Persistent worker. 466 // Persistent worker.
467 if (args.contains('--persistent_worker')) { 467 if (args.contains('--persistent_worker')) {
468 if (args.length != 2 || !args.contains('--build-mode')) { 468 bool validArgs;
469 if (!args.contains('--build-mode')) {
470 validArgs = false;
471 } else if (args.length == 2) {
472 validArgs = true;
473 } else if (args.length == 4 && args.contains('--dart-sdk')) {
474 validArgs = true;
475 } else {
476 validArgs = false;
477 }
478 if (!validArgs) {
469 printAndFail('The --persistent_worker flag should be used with and ' 479 printAndFail('The --persistent_worker flag should be used with and '
470 'only with the --build-mode flag.'); 480 'only with the --build-mode flag, and possibly the --dart-sdk '
481 'option. Got: $args');
471 return null; // Only reachable in testing. 482 return null; // Only reachable in testing.
472 } 483 }
473 return new CommandLineOptions._fromArgs(results, definedVariables); 484 return new CommandLineOptions._fromArgs(results, definedVariables);
474 } 485 }
475 486
476 // Help requests. 487 // Help requests.
477 if (results['help']) { 488 if (results['help']) {
478 _showUsage(parser); 489 _showUsage(parser);
479 exitHandler(0); 490 exitHandler(0);
480 return null; // Only reachable in testing. 491 return null; // Only reachable in testing.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 670
660 int _getNextFlagIndex(args, i) { 671 int _getNextFlagIndex(args, i) {
661 for (; i < args.length; ++i) { 672 for (; i < args.length; ++i) {
662 if (args[i].startsWith('--')) { 673 if (args[i].startsWith('--')) {
663 return i; 674 return i;
664 } 675 }
665 } 676 }
666 return i; 677 return i;
667 } 678 }
668 } 679 }
OLDNEW
« no previous file with comments | « pkg/analyzer_cli/lib/src/driver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698