OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 import 'package:analyzer/src/generated/interner.dart'; | 25 import 'package:analyzer/src/generated/interner.dart'; |
26 import 'package:analyzer/src/generated/java_engine.dart'; | 26 import 'package:analyzer/src/generated/java_engine.dart'; |
27 import 'package:analyzer/src/generated/sdk.dart'; | 27 import 'package:analyzer/src/generated/sdk.dart'; |
28 import 'package:analyzer/src/generated/source.dart'; | 28 import 'package:analyzer/src/generated/source.dart'; |
29 import 'package:analyzer/src/generated/source_io.dart'; | 29 import 'package:analyzer/src/generated/source_io.dart'; |
30 import 'package:analyzer/src/generated/utilities_general.dart' | 30 import 'package:analyzer/src/generated/utilities_general.dart' |
31 show PerformanceTag; | 31 show PerformanceTag; |
32 import 'package:analyzer/src/lint/registry.dart'; | 32 import 'package:analyzer/src/lint/registry.dart'; |
33 import 'package:analyzer/src/services/lint.dart'; | 33 import 'package:analyzer/src/services/lint.dart'; |
34 import 'package:analyzer/src/source/source_resource.dart'; | 34 import 'package:analyzer/src/source/source_resource.dart'; |
| 35 import 'package:analyzer/src/summary/idl.dart'; |
35 import 'package:analyzer/src/summary/package_bundle_reader.dart'; | 36 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
36 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; | 37 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk; |
37 import 'package:analyzer/src/task/options.dart'; | 38 import 'package:analyzer/src/task/options.dart'; |
38 import 'package:analyzer_cli/src/analyzer_impl.dart'; | 39 import 'package:analyzer_cli/src/analyzer_impl.dart'; |
39 import 'package:analyzer_cli/src/build_mode.dart'; | 40 import 'package:analyzer_cli/src/build_mode.dart'; |
40 import 'package:analyzer_cli/src/error_formatter.dart'; | 41 import 'package:analyzer_cli/src/error_formatter.dart'; |
41 import 'package:analyzer_cli/src/options.dart'; | 42 import 'package:analyzer_cli/src/options.dart'; |
42 import 'package:analyzer_cli/src/perf_report.dart'; | 43 import 'package:analyzer_cli/src/perf_report.dart'; |
43 import 'package:analyzer_cli/starter.dart'; | 44 import 'package:analyzer_cli/starter.dart'; |
44 import 'package:linter/src/rules.dart' as linter; | 45 import 'package:linter/src/rules.dart' as linter; |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 'Summaries are not yet supported when using Flutter.'); | 510 'Summaries are not yet supported when using Flutter.'); |
510 } | 511 } |
511 | 512 |
512 // Read any input summaries. | 513 // Read any input summaries. |
513 SummaryDataStore summaryDataStore = new SummaryDataStore( | 514 SummaryDataStore summaryDataStore = new SummaryDataStore( |
514 useSummaries ? options.buildSummaryInputs : <String>[]); | 515 useSummaries ? options.buildSummaryInputs : <String>[]); |
515 | 516 |
516 // Once options and embedders are processed, setup the SDK. | 517 // Once options and embedders are processed, setup the SDK. |
517 _setupSdk(options, useSummaries); | 518 _setupSdk(options, useSummaries); |
518 | 519 |
| 520 PackageBundle sdkBundle = sdk.getLinkedBundle(); |
| 521 if (sdkBundle != null) { |
| 522 summaryDataStore.addBundle(null, sdkBundle); |
| 523 } |
| 524 |
519 // Choose a package resolution policy and a diet parsing policy based on | 525 // Choose a package resolution policy and a diet parsing policy based on |
520 // the command-line options. | 526 // the command-line options. |
521 SourceFactory sourceFactory = _chooseUriResolutionPolicy( | 527 SourceFactory sourceFactory = _chooseUriResolutionPolicy( |
522 options, embedderMap, packageInfo, summaryDataStore); | 528 options, embedderMap, packageInfo, summaryDataStore); |
523 | 529 |
524 AnalyzeFunctionBodiesPredicate dietParsingPolicy = | 530 AnalyzeFunctionBodiesPredicate dietParsingPolicy = |
525 _chooseDietParsingPolicy(options); | 531 _chooseDietParsingPolicy(options); |
526 setAnalysisContextOptions( | 532 setAnalysisContextOptions( |
527 resourceProvider, sourceFactory, _context, options, | 533 resourceProvider, sourceFactory, _context, options, |
528 (AnalysisOptionsImpl contextOptions) { | 534 (AnalysisOptionsImpl contextOptions) { |
529 contextOptions.analyzeFunctionBodiesPredicate = dietParsingPolicy; | 535 contextOptions.analyzeFunctionBodiesPredicate = dietParsingPolicy; |
530 }); | 536 }); |
531 | 537 |
532 _context.sourceFactory = sourceFactory; | 538 _context.sourceFactory = sourceFactory; |
533 _context.resultProvider = | 539 if (sdkBundle != null) { |
534 new InputPackagesResultProvider(_context, summaryDataStore); | 540 _context.resultProvider = |
| 541 new InputPackagesResultProvider(_context, summaryDataStore); |
| 542 } |
535 } | 543 } |
536 | 544 |
537 /// Return discovered packagespec, or `null` if none is found. | 545 /// Return discovered packagespec, or `null` if none is found. |
538 Packages _discoverPackagespec(Uri root) { | 546 Packages _discoverPackagespec(Uri root) { |
539 try { | 547 try { |
540 Packages packages = pkg_discovery.findPackagesFromFile(root); | 548 Packages packages = pkg_discovery.findPackagesFromFile(root); |
541 if (packages != Packages.noPackages) { | 549 if (packages != Packages.noPackages) { |
542 return packages; | 550 return packages; |
543 } | 551 } |
544 } catch (_) { | 552 } catch (_) { |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 for (var package in packages) { | 877 for (var package in packages) { |
870 var packageName = path.basename(package.path); | 878 var packageName = path.basename(package.path); |
871 var realPath = package.resolveSymbolicLinksSync(); | 879 var realPath = package.resolveSymbolicLinksSync(); |
872 result[packageName] = [ | 880 result[packageName] = [ |
873 PhysicalResourceProvider.INSTANCE.getFolder(realPath) | 881 PhysicalResourceProvider.INSTANCE.getFolder(realPath) |
874 ]; | 882 ]; |
875 } | 883 } |
876 return result; | 884 return result; |
877 } | 885 } |
878 } | 886 } |
OLD | NEW |