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

Unified Diff: pkg/analyzer/lib/src/context/builder.dart

Issue 2666693002: detect flutter and use default analysis options for flutter (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/workspace.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/context/builder.dart
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 1c9c3c2b8d676612dfc805b0c4249ba38ca35e7b..98e5effaff71de30dbb70cd8291fb9affb69127d 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -403,9 +403,16 @@ class ContextBuilder {
}
} else {
// Search for the default analysis options
- // TODO(danrubel) check for flutter and use default flutter options
- Source source =
- sourceFactory.forUri('package:dart.analysis_options/default.yaml');
+ Source source;
+ // TODO(danrubel) determine if bazel or gn project depends upon flutter
+ if (workspace.hasFlutterDependency) {
+ source =
+ sourceFactory.forUri('package:flutter/analysis_options_user.yaml');
+ }
+ if (source == null || !source.exists()) {
+ source =
+ sourceFactory.forUri('package:dart.analysis_options/default.yaml');
+ }
if (source.exists()) {
try {
optionMap = optionsProvider.getOptionsFromSource(source);
@@ -734,6 +741,10 @@ class _BasicWorkspace extends Workspace {
return _packageMap;
}
+ @override
+ // Alternately, we could check the pubspec for "sdk: flutter"
Brian Wilkerson 2017/01/30 20:40:47 Personally, I think checking the package map is be
danrubel 2017/01/30 20:47:11 Agreed.
+ bool get hasFlutterDependency => packageMap.containsKey('flutter');
+
Packages get packages {
_packages ??= _builder.createPackageMap(root);
return _packages;
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/workspace.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698