| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.src.context.context_builder; | 5 library analyzer.src.context.context_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:core'; | 8 import 'dart:core'; |
| 9 | 9 |
| 10 import 'package:analyzer/context/declared_variables.dart'; | 10 import 'package:analyzer/context/declared_variables.dart'; |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 if (optionsFile != null) { | 381 if (optionsFile != null) { |
| 382 try { | 382 try { |
| 383 optionMap = optionsProvider.getOptionsFromFile(optionsFile); | 383 optionMap = optionsProvider.getOptionsFromFile(optionsFile); |
| 384 } catch (_) { | 384 } catch (_) { |
| 385 // Ignore exceptions thrown while trying to load the options file. | 385 // Ignore exceptions thrown while trying to load the options file. |
| 386 } | 386 } |
| 387 } else { | 387 } else { |
| 388 // Search for the default analysis options | 388 // Search for the default analysis options |
| 389 Source source; | 389 Source source; |
| 390 // TODO(danrubel) determine if bazel or gn project depends upon flutter | 390 // TODO(danrubel) determine if bazel or gn project depends upon flutter |
| 391 if (workspace.hasFlutterDependency) { | 391 if (sourceFactory.hasFlutterDependency) { |
| 392 source = | 392 source = |
| 393 sourceFactory.forUri('package:flutter/analysis_options_user.yaml'); | 393 sourceFactory.forUri('package:flutter/analysis_options_user.yaml'); |
| 394 } | 394 } |
| 395 if (source == null || !source.exists()) { | 395 if (source == null || !source.exists()) { |
| 396 source = | 396 source = |
| 397 sourceFactory.forUri('package:dart.analysis_options/default.yaml'); | 397 sourceFactory.forUri('package:dart.analysis_options/default.yaml'); |
| 398 } | 398 } |
| 399 if (source.exists()) { | 399 if (source.exists()) { |
| 400 try { | 400 try { |
| 401 optionMap = optionsProvider.getOptionsFromSource(source); | 401 optionMap = optionsProvider.getOptionsFromSource(source); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 | 723 |
| 724 final ContextBuilder _builder; | 724 final ContextBuilder _builder; |
| 725 | 725 |
| 726 Map<String, List<Folder>> _packageMap; | 726 Map<String, List<Folder>> _packageMap; |
| 727 | 727 |
| 728 Packages _packages; | 728 Packages _packages; |
| 729 | 729 |
| 730 _BasicWorkspace._(this.provider, this.root, this._builder); | 730 _BasicWorkspace._(this.provider, this.root, this._builder); |
| 731 | 731 |
| 732 @override | 732 @override |
| 733 // Alternately, we could check the pubspec for "sdk: flutter" | |
| 734 bool get hasFlutterDependency => packageMap.containsKey('flutter'); | |
| 735 | |
| 736 @override | |
| 737 Map<String, List<Folder>> get packageMap { | 733 Map<String, List<Folder>> get packageMap { |
| 738 _packageMap ??= _builder.convertPackagesToMap(packages); | 734 _packageMap ??= _builder.convertPackagesToMap(packages); |
| 739 return _packageMap; | 735 return _packageMap; |
| 740 } | 736 } |
| 741 | 737 |
| 742 Packages get packages { | 738 Packages get packages { |
| 743 _packages ??= _builder.createPackageMap(root); | 739 _packages ??= _builder.createPackageMap(root); |
| 744 return _packages; | 740 return _packages; |
| 745 } | 741 } |
| 746 | 742 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 760 } | 756 } |
| 761 | 757 |
| 762 /** | 758 /** |
| 763 * Find the basic workspace that contains the given [path]. | 759 * Find the basic workspace that contains the given [path]. |
| 764 */ | 760 */ |
| 765 static _BasicWorkspace find( | 761 static _BasicWorkspace find( |
| 766 ResourceProvider resourceProvider, String path, ContextBuilder builder) { | 762 ResourceProvider resourceProvider, String path, ContextBuilder builder) { |
| 767 return new _BasicWorkspace._(resourceProvider, path, builder); | 763 return new _BasicWorkspace._(resourceProvider, path, builder); |
| 768 } | 764 } |
| 769 } | 765 } |
| OLD | NEW |