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

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

Issue 1828903002: Fix for analyze-cli and Dart SDK options. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | « 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) 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.driver; 5 library analyzer_cli.src.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } 581 }
582 return errorSeverity; 582 return errorSeverity;
583 } 583 }
584 584
585 void _setupEnv(CommandLineOptions options) { 585 void _setupEnv(CommandLineOptions options) {
586 // In batch mode, SDK is specified on the main command line rather than in 586 // In batch mode, SDK is specified on the main command line rather than in
587 // the command lines sent to stdin. So process it before deciding whether 587 // the command lines sent to stdin. So process it before deciding whether
588 // to activate batch mode. 588 // to activate batch mode.
589 if (sdk == null) { 589 if (sdk == null) {
590 sdk = new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath)); 590 sdk = new DirectoryBasedDartSdk(new JavaFile(options.dartSdkPath));
591 sdk.analysisOptions = createAnalysisOptionsForCommandLineOptions(options);
591 } 592 }
592 _isBatch = options.shouldBatch; 593 _isBatch = options.shouldBatch;
593 } 594 }
594 595
596 static AnalysisOptionsImpl createAnalysisOptionsForCommandLineOptions(
597 CommandLineOptions options) {
598 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
599 contextOptions.hint = !options.disableHints;
600 contextOptions.enableStrictCallChecks = options.enableStrictCallChecks;
601 contextOptions.enableSuperMixins = options.enableSuperMixins;
602 contextOptions.enableConditionalDirectives =
603 options.enableConditionalDirectives;
604 contextOptions.generateImplicitErrors = options.showPackageWarnings;
605 contextOptions.generateSdkErrors = options.showSdkWarnings;
606 contextOptions.lint = options.lints;
607 contextOptions.strongMode = options.strongMode;
608 return contextOptions;
609 }
610
595 static void setAnalysisContextOptions( 611 static void setAnalysisContextOptions(
596 AnalysisContext context, 612 AnalysisContext context,
597 CommandLineOptions options, 613 CommandLineOptions options,
598 void configureContextOptions(AnalysisOptionsImpl contextOptions)) { 614 void configureContextOptions(AnalysisOptionsImpl contextOptions)) {
599 Map<String, String> definedVariables = options.definedVariables; 615 Map<String, String> definedVariables = options.definedVariables;
600 if (!definedVariables.isEmpty) { 616 if (!definedVariables.isEmpty) {
601 DeclaredVariables declaredVariables = context.declaredVariables; 617 DeclaredVariables declaredVariables = context.declaredVariables;
602 definedVariables.forEach((String variableName, String value) { 618 definedVariables.forEach((String variableName, String value) {
603 declaredVariables.define(variableName, value); 619 declaredVariables.define(variableName, value);
604 }); 620 });
605 } 621 }
606 622
607 if (options.log) { 623 if (options.log) {
608 AnalysisEngine.instance.logger = new StdLogger(); 624 AnalysisEngine.instance.logger = new StdLogger();
609 } 625 }
610 626
611 // Prepare context options. 627 // Prepare context options.
612 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); 628 AnalysisOptionsImpl contextOptions =
613 contextOptions.hint = !options.disableHints; 629 createAnalysisOptionsForCommandLineOptions(options);
614 contextOptions.enableStrictCallChecks = options.enableStrictCallChecks;
615 contextOptions.enableSuperMixins = options.enableSuperMixins;
616 contextOptions.enableConditionalDirectives =
617 options.enableConditionalDirectives;
618 contextOptions.generateImplicitErrors = options.showPackageWarnings;
619 contextOptions.generateSdkErrors = options.showSdkWarnings;
620 contextOptions.lint = options.lints;
621 contextOptions.strongMode = options.strongMode;
622 configureContextOptions(contextOptions); 630 configureContextOptions(contextOptions);
623 631
624 // Set context options. 632 // Set context options.
625 context.analysisOptions = contextOptions; 633 context.analysisOptions = contextOptions;
626 context.sourceFactory.dartSdk.context.analysisOptions = contextOptions;
627 634
628 // Process analysis options file (and notify all interested parties). 635 // Process analysis options file (and notify all interested parties).
629 _processAnalysisOptions(context, options); 636 _processAnalysisOptions(context, options);
630 } 637 }
631 638
632 /// Perform a deep comparison of two string maps. 639 /// Perform a deep comparison of two string maps.
633 static bool _equalMaps(Map<String, String> m1, Map<String, String> m2) { 640 static bool _equalMaps(Map<String, String> m1, Map<String, String> m2) {
634 if (m1.length != m2.length) { 641 if (m1.length != m2.length) {
635 return false; 642 return false;
636 } 643 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 for (var package in packages) { 779 for (var package in packages) {
773 var packageName = path.basename(package.path); 780 var packageName = path.basename(package.path);
774 var realPath = package.resolveSymbolicLinksSync(); 781 var realPath = package.resolveSymbolicLinksSync();
775 result[packageName] = [ 782 result[packageName] = [
776 PhysicalResourceProvider.INSTANCE.getFolder(realPath) 783 PhysicalResourceProvider.INSTANCE.getFolder(realPath)
777 ]; 784 ];
778 } 785 }
779 return result; 786 return result;
780 } 787 }
781 } 788 }
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