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

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

Issue 2678633002: fix dartanalyzer sdk setup (Closed)
Patch Set: merge 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/analyzer_cli/test/data/strong_sdk/main.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) 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' as io; 9 import 'dart:io' as io;
10 10
(...skipping 15 matching lines...) Expand all
26 import 'package:analyzer/src/generated/constant.dart'; 26 import 'package:analyzer/src/generated/constant.dart';
27 import 'package:analyzer/src/generated/engine.dart'; 27 import 'package:analyzer/src/generated/engine.dart';
28 import 'package:analyzer/src/generated/interner.dart'; 28 import 'package:analyzer/src/generated/interner.dart';
29 import 'package:analyzer/src/generated/java_engine.dart'; 29 import 'package:analyzer/src/generated/java_engine.dart';
30 import 'package:analyzer/src/generated/sdk.dart'; 30 import 'package:analyzer/src/generated/sdk.dart';
31 import 'package:analyzer/src/generated/source.dart'; 31 import 'package:analyzer/src/generated/source.dart';
32 import 'package:analyzer/src/generated/source_io.dart'; 32 import 'package:analyzer/src/generated/source_io.dart';
33 import 'package:analyzer/src/generated/utilities_general.dart' 33 import 'package:analyzer/src/generated/utilities_general.dart'
34 show PerformanceTag; 34 show PerformanceTag;
35 import 'package:analyzer/src/lint/registry.dart'; 35 import 'package:analyzer/src/lint/registry.dart';
36 import 'package:analyzer/src/services/lint.dart';
37 import 'package:analyzer/src/source/source_resource.dart'; 36 import 'package:analyzer/src/source/source_resource.dart';
38 import 'package:analyzer/src/summary/idl.dart'; 37 import 'package:analyzer/src/summary/idl.dart';
39 import 'package:analyzer/src/summary/package_bundle_reader.dart'; 38 import 'package:analyzer/src/summary/package_bundle_reader.dart';
40 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; 39 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk;
41 import 'package:analyzer/src/task/options.dart'; 40 import 'package:analyzer/src/task/options.dart';
42 import 'package:analyzer_cli/src/analyzer_impl.dart'; 41 import 'package:analyzer_cli/src/analyzer_impl.dart';
43 import 'package:analyzer_cli/src/build_mode.dart'; 42 import 'package:analyzer_cli/src/build_mode.dart';
44 import 'package:analyzer_cli/src/error_formatter.dart'; 43 import 'package:analyzer_cli/src/error_formatter.dart';
45 import 'package:analyzer_cli/src/options.dart'; 44 import 'package:analyzer_cli/src/options.dart';
46 import 'package:analyzer_cli/src/perf_report.dart'; 45 import 'package:analyzer_cli/src/perf_report.dart';
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // TODO(paulberry): diet parse 'package:' imports when we don't want 356 // TODO(paulberry): diet parse 'package:' imports when we don't want
358 // diagnostics. (Full parse is still needed for "self" packages.) 357 // diagnostics. (Full parse is still needed for "self" packages.)
359 return true; 358 return true;
360 } 359 }
361 }; 360 };
362 } 361 }
363 362
364 /// Decide on the appropriate method for resolving URIs based on the given 363 /// Decide on the appropriate method for resolving URIs based on the given
365 /// [options] and [customUrlMappings] settings, and return a 364 /// [options] and [customUrlMappings] settings, and return a
366 /// [SourceFactory] that has been configured accordingly. 365 /// [SourceFactory] that has been configured accordingly.
366 /// When [includeSdkResolver] is `false`, return a temporary [SourceFactory]
367 /// for the purpose of resolved analysis options file `include:` directives.
368 /// In this situation, [analysisOptions] is ignored and can be `null`.
367 SourceFactory _chooseUriResolutionPolicy( 369 SourceFactory _chooseUriResolutionPolicy(
368 CommandLineOptions options, 370 CommandLineOptions options,
369 Map<file_system.Folder, YamlMap> embedderMap, 371 Map<file_system.Folder, YamlMap> embedderMap,
370 _PackageInfo packageInfo, 372 _PackageInfo packageInfo,
371 SummaryDataStore summaryDataStore) { 373 SummaryDataStore summaryDataStore,
374 bool includeSdkResolver,
375 AnalysisOptions analysisOptions) {
372 // Create a custom package resolver if one has been specified. 376 // Create a custom package resolver if one has been specified.
373 if (packageResolverProvider != null) { 377 if (packageResolverProvider != null) {
374 file_system.Folder folder = resourceProvider.getResource('.'); 378 file_system.Folder folder = resourceProvider.getResource('.');
375 UriResolver resolver = packageResolverProvider(folder); 379 UriResolver resolver = packageResolverProvider(folder);
376 if (resolver != null) { 380 if (resolver != null) {
377 UriResolver sdkResolver = new DartUriResolver(sdk);
378
379 // TODO(brianwilkerson) This doesn't handle sdk extensions. 381 // TODO(brianwilkerson) This doesn't handle sdk extensions.
380 List<UriResolver> resolvers = <UriResolver>[ 382 List<UriResolver> resolvers = <UriResolver>[];
381 sdkResolver, 383 if (includeSdkResolver) {
382 new InSummaryUriResolver(resourceProvider, summaryDataStore), 384 resolvers.add(new DartUriResolver(sdk));
383 resolver, 385 }
384 new file_system.ResourceUriResolver(resourceProvider) 386 resolvers
385 ]; 387 .add(new InSummaryUriResolver(resourceProvider, summaryDataStore));
388 resolvers.add(resolver);
389 resolvers.add(new file_system.ResourceUriResolver(resourceProvider));
386 return new SourceFactory(resolvers); 390 return new SourceFactory(resolvers);
387 } 391 }
388 } 392 }
389 393
390 UriResolver packageUriResolver; 394 UriResolver packageUriResolver;
391 395
392 if (options.packageRootPath != null) { 396 if (options.packageRootPath != null) {
393 ContextBuilderOptions builderOptions = new ContextBuilderOptions(); 397 ContextBuilderOptions builderOptions = new ContextBuilderOptions();
394 builderOptions.defaultPackagesDirectoryPath = options.packageRootPath; 398 builderOptions.defaultPackagesDirectoryPath = options.packageRootPath;
395 ContextBuilder builder = new ContextBuilder(resourceProvider, null, null, 399 ContextBuilder builder = new ContextBuilder(resourceProvider, null, null,
(...skipping 21 matching lines...) Expand all
417 } 421 }
418 } 422 }
419 } 423 }
420 424
421 // Now, build our resolver list. 425 // Now, build our resolver list.
422 List<UriResolver> resolvers = []; 426 List<UriResolver> resolvers = [];
423 427
424 // 'dart:' URIs come first. 428 // 'dart:' URIs come first.
425 429
426 // Setup embedding. 430 // Setup embedding.
427 EmbedderSdk embedderSdk = new EmbedderSdk(resourceProvider, embedderMap); 431 if (includeSdkResolver) {
428 if (embedderSdk.libraryMap.size() == 0) { 432 EmbedderSdk embedderSdk = new EmbedderSdk(resourceProvider, embedderMap);
429 // The embedder uri resolver has no mappings. Use the default Dart SDK 433 if (embedderSdk.libraryMap.size() == 0) {
430 // uri resolver. 434 // The embedder uri resolver has no mappings. Use the default Dart SDK
431 resolvers.add(new DartUriResolver(sdk)); 435 // uri resolver.
432 } else { 436 resolvers.add(new DartUriResolver(sdk));
433 // The embedder uri resolver has mappings, use it instead of the default 437 } else {
434 // Dart SDK uri resolver. 438 // The embedder uri resolver has mappings, use it instead of the default
435 embedderSdk.analysisOptions = _context.analysisOptions; 439 // Dart SDK uri resolver.
436 resolvers.add(new DartUriResolver(embedderSdk)); 440 embedderSdk.analysisOptions = analysisOptions;
441 resolvers.add(new DartUriResolver(embedderSdk));
442 }
437 } 443 }
438 444
439 // Next SdkExts. 445 // Next SdkExts.
440 if (packageInfo.packageMap != null) { 446 if (packageInfo.packageMap != null) {
441 resolvers.add(new SdkExtUriResolver(packageInfo.packageMap)); 447 resolvers.add(new SdkExtUriResolver(packageInfo.packageMap));
442 } 448 }
443 449
444 // Then package URIs from summaries. 450 // Then package URIs from summaries.
445 resolvers.add(new InSummaryUriResolver(resourceProvider, summaryDataStore)); 451 resolvers.add(new InSummaryUriResolver(resourceProvider, summaryDataStore));
446 452
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 if (_canContextBeReused(options)) { 508 if (_canContextBeReused(options)) {
503 return; 509 return;
504 } 510 }
505 _previousOptions = options; 511 _previousOptions = options;
506 512
507 // Save stats from previous context before clobbering it. 513 // Save stats from previous context before clobbering it.
508 if (_context != null) { 514 if (_context != null) {
509 _analyzedFileCount += _context.sources.length; 515 _analyzedFileCount += _context.sources.length;
510 } 516 }
511 517
512 // Create a context.
513 _context = AnalysisEngine.instance.createAnalysisContext();
514
515 // Find package info. 518 // Find package info.
516 _PackageInfo packageInfo = _findPackages(options); 519 _PackageInfo packageInfo = _findPackages(options);
517 520
518 // Process embedders. 521 // Process embedders.
519 Map<file_system.Folder, YamlMap> embedderMap = 522 Map<file_system.Folder, YamlMap> embedderMap =
520 new EmbedderYamlLocator(packageInfo.packageMap).embedderYamls; 523 new EmbedderYamlLocator(packageInfo.packageMap).embedderYamls;
521 524
522 // Scan for SDK extenders. 525 // Scan for SDK extenders.
523 bool hasSdkExt = _hasSdkExt(packageInfo.packageMap?.values); 526 bool hasSdkExt = _hasSdkExt(packageInfo.packageMap?.values);
524 527
525 // No summaries in the presence of embedders or extenders. 528 // No summaries in the presence of embedders or extenders.
526 bool useSummaries = embedderMap.isEmpty && !hasSdkExt; 529 bool useSummaries = embedderMap.isEmpty && !hasSdkExt;
527 530
528 if (!useSummaries && options.buildSummaryInputs.isNotEmpty) { 531 if (!useSummaries && options.buildSummaryInputs.isNotEmpty) {
529 throw new _DriverError( 532 throw new _DriverError(
530 'Summaries are not yet supported when using Flutter.'); 533 'Summaries are not yet supported when using Flutter.');
531 } 534 }
532 535
533 // Read any input summaries. 536 // Read any input summaries.
534 SummaryDataStore summaryDataStore = new SummaryDataStore( 537 SummaryDataStore summaryDataStore = new SummaryDataStore(
535 useSummaries ? options.buildSummaryInputs : <String>[]); 538 useSummaries ? options.buildSummaryInputs : <String>[]);
536 539
540 // Create a temporary source factory without an SDK resolver
541 // for resolving "include:" directives in analysis options files.
542 SourceFactory tempSourceFactory = _chooseUriResolutionPolicy(
543 options, embedderMap, packageInfo, summaryDataStore, false, null);
544
545 AnalysisOptionsImpl analysisOptions =
546 createAnalysisOptions(resourceProvider, tempSourceFactory, options);
547 analysisOptions.analyzeFunctionBodiesPredicate =
548 _chooseDietParsingPolicy(options);
549
537 // Once options and embedders are processed, setup the SDK. 550 // Once options and embedders are processed, setup the SDK.
538 _setupSdk(options, useSummaries); 551 _setupSdk(options, useSummaries, analysisOptions);
539 552
540 PackageBundle sdkBundle = sdk.getLinkedBundle(); 553 PackageBundle sdkBundle = sdk.getLinkedBundle();
541 if (sdkBundle != null) { 554 if (sdkBundle != null) {
542 summaryDataStore.addBundle(null, sdkBundle); 555 summaryDataStore.addBundle(null, sdkBundle);
543 } 556 }
544 557
545 // Choose a package resolution policy and a diet parsing policy based on 558 // Choose a package resolution policy and a diet parsing policy based on
546 // the command-line options. 559 // the command-line options.
547 SourceFactory sourceFactory = _chooseUriResolutionPolicy( 560 SourceFactory sourceFactory = _chooseUriResolutionPolicy(options,
548 options, embedderMap, packageInfo, summaryDataStore); 561 embedderMap, packageInfo, summaryDataStore, true, analysisOptions);
549 562
550 AnalyzeFunctionBodiesPredicate dietParsingPolicy = 563 // Create a context.
551 _chooseDietParsingPolicy(options); 564 _context = AnalysisEngine.instance.createAnalysisContext();
552 setAnalysisContextOptions( 565 setupAnalysisContext(_context, options, analysisOptions);
553 resourceProvider, sourceFactory, _context, options,
554 (AnalysisOptionsImpl contextOptions) {
555 contextOptions.analyzeFunctionBodiesPredicate = dietParsingPolicy;
556 });
557
558 _context.sourceFactory = sourceFactory; 566 _context.sourceFactory = sourceFactory;
559 567
560 if (options.enableNewAnalysisDriver) { 568 if (options.enableNewAnalysisDriver) {
561 PerformanceLog log = new PerformanceLog(null); 569 PerformanceLog log = new PerformanceLog(null);
562 AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log); 570 AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log);
563 analysisDriver = new AnalysisDriver( 571 analysisDriver = new AnalysisDriver(
564 scheduler, 572 scheduler,
565 log, 573 log,
566 resourceProvider, 574 resourceProvider,
567 analysisDriverByteStore, 575 analysisDriverByteStore,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 ErrorSeverity errorSeverity = await analyzer.analyze(); 687 ErrorSeverity errorSeverity = await analyzer.analyze();
680 if (errorSeverity == ErrorSeverity.ERROR) { 688 if (errorSeverity == ErrorSeverity.ERROR) {
681 io.exitCode = errorSeverity.ordinal; 689 io.exitCode = errorSeverity.ordinal;
682 } 690 }
683 if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) { 691 if (options.warningsAreFatal && errorSeverity == ErrorSeverity.WARNING) {
684 io.exitCode = errorSeverity.ordinal; 692 io.exitCode = errorSeverity.ordinal;
685 } 693 }
686 return errorSeverity; 694 return errorSeverity;
687 } 695 }
688 696
689 void _setupSdk(CommandLineOptions options, bool useSummaries) { 697 void _setupSdk(CommandLineOptions options, bool useSummaries,
698 AnalysisOptions analysisOptions) {
690 if (sdk == null) { 699 if (sdk == null) {
691 if (options.dartSdkSummaryPath != null) { 700 if (options.dartSdkSummaryPath != null) {
692 sdk = new SummaryBasedDartSdk( 701 sdk = new SummaryBasedDartSdk(
693 options.dartSdkSummaryPath, options.strongMode); 702 options.dartSdkSummaryPath, options.strongMode);
694 } else { 703 } else {
695 String dartSdkPath = options.dartSdkPath; 704 String dartSdkPath = options.dartSdkPath;
696 FolderBasedDartSdk dartSdk = new FolderBasedDartSdk(resourceProvider, 705 FolderBasedDartSdk dartSdk = new FolderBasedDartSdk(resourceProvider,
697 resourceProvider.getFolder(dartSdkPath), options.strongMode); 706 resourceProvider.getFolder(dartSdkPath), options.strongMode);
698 dartSdk.useSummary = useSummaries && 707 dartSdk.useSummary = useSummaries &&
699 options.sourceFiles.every((String sourcePath) { 708 options.sourceFiles.every((String sourcePath) {
700 sourcePath = path.absolute(sourcePath); 709 sourcePath = path.absolute(sourcePath);
701 sourcePath = path.normalize(sourcePath); 710 sourcePath = path.normalize(sourcePath);
702 return !path.isWithin(dartSdkPath, sourcePath); 711 return !path.isWithin(dartSdkPath, sourcePath);
703 }); 712 });
704 713 dartSdk.analysisOptions = analysisOptions;
705 dartSdk.analysisOptions = context.analysisOptions;
706 sdk = dartSdk; 714 sdk = dartSdk;
707 } 715 }
708 } 716 }
709 } 717 }
710 718
711 static AnalysisOptionsImpl createAnalysisOptionsForCommandLineOptions( 719 static AnalysisOptionsImpl createAnalysisOptionsForCommandLineOptions(
712 CommandLineOptions options) { 720 CommandLineOptions options) {
713 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl(); 721 AnalysisOptionsImpl contextOptions = new AnalysisOptionsImpl();
714 contextOptions.trackCacheDependencies = false; 722 contextOptions.trackCacheDependencies = false;
715 contextOptions.disableCacheFlushing = options.disableCacheFlushing; 723 contextOptions.disableCacheFlushing = options.disableCacheFlushing;
716 contextOptions.hint = !options.disableHints; 724 contextOptions.hint = !options.disableHints;
717 contextOptions.enableStrictCallChecks = options.enableStrictCallChecks; 725 contextOptions.enableStrictCallChecks = options.enableStrictCallChecks;
718 contextOptions.enableSuperMixins = options.enableSuperMixins; 726 contextOptions.enableSuperMixins = options.enableSuperMixins;
719 contextOptions.generateImplicitErrors = options.showPackageWarnings; 727 contextOptions.generateImplicitErrors = options.showPackageWarnings;
720 contextOptions.generateSdkErrors = options.showSdkWarnings; 728 contextOptions.generateSdkErrors = options.showSdkWarnings;
721 contextOptions.lint = options.lints; 729 contextOptions.lint = options.lints;
722 contextOptions.strongMode = options.strongMode; 730 contextOptions.strongMode = options.strongMode;
723 contextOptions.implicitCasts = options.implicitCasts; 731 contextOptions.implicitCasts = options.implicitCasts;
724 contextOptions.implicitDynamic = options.implicitDynamic; 732 contextOptions.implicitDynamic = options.implicitDynamic;
725 return contextOptions; 733 return contextOptions;
726 } 734 }
727 735
736 static AnalysisOptionsImpl createAnalysisOptions(
737 file_system.ResourceProvider resourceProvider,
738 SourceFactory sourceFactory,
739 CommandLineOptions options) {
740 // Prepare context options.
741 AnalysisOptionsImpl analysisOptions =
742 createAnalysisOptionsForCommandLineOptions(options);
743
744 // Process analysis options file (and notify all interested parties).
745 _processAnalysisOptions(
746 resourceProvider, sourceFactory, analysisOptions, options);
747 return analysisOptions;
748 }
749
728 static void setAnalysisContextOptions( 750 static void setAnalysisContextOptions(
729 file_system.ResourceProvider resourceProvider, 751 file_system.ResourceProvider resourceProvider,
730 SourceFactory sourceFactory, 752 SourceFactory sourceFactory,
731 AnalysisContext context, 753 AnalysisContext context,
732 CommandLineOptions options, 754 CommandLineOptions options,
733 void configureContextOptions(AnalysisOptionsImpl contextOptions)) { 755 void configureContextOptions(AnalysisOptionsImpl contextOptions)) {
756 AnalysisOptionsImpl analysisOptions =
757 createAnalysisOptions(resourceProvider, sourceFactory, options);
758 configureContextOptions(analysisOptions);
759 setupAnalysisContext(context, options, analysisOptions);
760 }
761
762 static void setupAnalysisContext(AnalysisContext context,
763 CommandLineOptions options, AnalysisOptionsImpl analysisOptions) {
734 Map<String, String> definedVariables = options.definedVariables; 764 Map<String, String> definedVariables = options.definedVariables;
735 if (definedVariables.isNotEmpty) { 765 if (definedVariables.isNotEmpty) {
736 DeclaredVariables declaredVariables = context.declaredVariables; 766 DeclaredVariables declaredVariables = context.declaredVariables;
737 definedVariables.forEach((String variableName, String value) { 767 definedVariables.forEach((String variableName, String value) {
738 declaredVariables.define(variableName, value); 768 declaredVariables.define(variableName, value);
739 }); 769 });
740 } 770 }
741 771
742 if (options.log) { 772 if (options.log) {
743 AnalysisEngine.instance.logger = new StdLogger(); 773 AnalysisEngine.instance.logger = new StdLogger();
744 } 774 }
745 775
746 // Prepare context options.
747 AnalysisOptionsImpl contextOptions =
748 createAnalysisOptionsForCommandLineOptions(options);
749 configureContextOptions(contextOptions);
750
751 // Set context options. 776 // Set context options.
752 context.analysisOptions = contextOptions; 777 context.analysisOptions = analysisOptions;
753
754 // Process analysis options file (and notify all interested parties).
755 _processAnalysisOptions(resourceProvider, sourceFactory, context, options);
756 } 778 }
757 779
758 /// Perform a deep comparison of two string lists. 780 /// Perform a deep comparison of two string lists.
759 static bool _equalLists(List<String> l1, List<String> l2) { 781 static bool _equalLists(List<String> l1, List<String> l2) {
760 if (l1.length != l2.length) { 782 if (l1.length != l2.length) {
761 return false; 783 return false;
762 } 784 }
763 for (int i = 0; i < l1.length; i++) { 785 for (int i = 0; i < l1.length; i++) {
764 if (l1[i] != l2[i]) { 786 if (l1[i] != l2[i]) {
765 return false; 787 return false;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 return file; 825 return file;
804 } 826 }
805 827
806 /// Convert [sourcePath] into an absolute path. 828 /// Convert [sourcePath] into an absolute path.
807 static String _normalizeSourcePath(String sourcePath) => 829 static String _normalizeSourcePath(String sourcePath) =>
808 path.normalize(new io.File(sourcePath).absolute.path); 830 path.normalize(new io.File(sourcePath).absolute.path);
809 831
810 static void _processAnalysisOptions( 832 static void _processAnalysisOptions(
811 file_system.ResourceProvider resourceProvider, 833 file_system.ResourceProvider resourceProvider,
812 SourceFactory sourceFactory, 834 SourceFactory sourceFactory,
813 AnalysisContext context, 835 AnalysisOptionsImpl analysisOptions,
814 CommandLineOptions options) { 836 CommandLineOptions options) {
815 file_system.File file = _getOptionsFile(resourceProvider, options); 837 file_system.File file = _getOptionsFile(resourceProvider, options);
816 838
817 AnalysisOptionsProvider analysisOptionsProvider = 839 AnalysisOptionsProvider analysisOptionsProvider =
818 new AnalysisOptionsProvider(sourceFactory); 840 new AnalysisOptionsProvider(sourceFactory);
819 Map<String, YamlNode> optionMap = 841 Map<String, YamlNode> optionMap =
820 analysisOptionsProvider.getOptionsFromFile(file); 842 analysisOptionsProvider.getOptionsFromFile(file);
821 843
822 // Fill in lint rule defaults in case lints are enabled and rules are 844 // Fill in lint rule defaults in case lints are enabled and rules are
823 // not specified in an options file. 845 // not specified in an options file.
824 if (options.lints && !containsLintRuleEntry(optionMap)) { 846 if (options.lints && !containsLintRuleEntry(optionMap)) {
825 setLints(context, Registry.ruleRegistry.defaultRules); 847 analysisOptions.lintRules = Registry.ruleRegistry.defaultRules;
826 } 848 }
827 849
828 // Ask engine to further process options. 850 // Ask engine to further process options.
829 if (optionMap != null) { 851 if (optionMap != null) {
830 applyToAnalysisOptions(context.analysisOptions, optionMap); 852 applyToAnalysisOptions(analysisOptions, optionMap);
831 } 853 }
832 } 854 }
833 } 855 }
834 856
835 /// Provides a framework to read command line options from stdin and feed them 857 /// Provides a framework to read command line options from stdin and feed them
836 /// to a callback. 858 /// to a callback.
837 class _BatchRunner { 859 class _BatchRunner {
838 /// Run the tool in 'batch' mode, receiving command lines through stdin and 860 /// Run the tool in 'batch' mode, receiving command lines through stdin and
839 /// returning pass/fail status through stdout. This feature is intended for 861 /// returning pass/fail status through stdout. This feature is intended for
840 /// use in unit testing. 862 /// use in unit testing.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 for (var package in packages) { 938 for (var package in packages) {
917 var packageName = path.basename(package.path); 939 var packageName = path.basename(package.path);
918 var realPath = package.resolveSymbolicLinksSync(); 940 var realPath = package.resolveSymbolicLinksSync();
919 result[packageName] = [ 941 result[packageName] = [
920 PhysicalResourceProvider.INSTANCE.getFolder(realPath) 942 PhysicalResourceProvider.INSTANCE.getFolder(realPath)
921 ]; 943 ];
922 } 944 }
923 return result; 945 return result;
924 } 946 }
925 } 947 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer_cli/test/data/strong_sdk/main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698