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

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

Issue 2726783002: echo analysis options information if dartanalyzer --verbose is specified (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/command_line/arguments.dart ('k') | pkg/analyzer_cli/lib/src/driver.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 ea35756ee2f1f635e97ae7156921bda2acd83d18..0bd531e4e9e197ddc57593fad45b9cafe9a96c34 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -366,9 +366,17 @@ class ContextBuilder {
/**
* Return the analysis options that should be used to analyze code in the
- * directory with the given [path].
- */
- AnalysisOptions getAnalysisOptions(String path) {
+ * directory with the given [path]. Use [verbosePrint] to echo verbose
+ * information about the analysis options selection process.
+ */
+ AnalysisOptions getAnalysisOptions(String path,
+ {void verbosePrint(String text)}) {
+ void verbose(String text) {
+ if (verbosePrint != null) {
+ verbosePrint(text);
+ }
+ }
+
// TODO(danrubel) restructure so that we don't create a workspace
// both here and in createSourceFactory
Workspace workspace = createWorkspace(path);
@@ -383,8 +391,10 @@ class ContextBuilder {
if (optionsFile != null) {
try {
optionMap = optionsProvider.getOptionsFromFile(optionsFile);
- } catch (_) {
+ verbose('Loaded analysis options from ${optionsFile.path}');
+ } catch (e) {
// Ignore exceptions thrown while trying to load the options file.
+ verbose('Exception: $e\n when loading ${optionsFile.path}');
}
} else {
// Search for the default analysis options
@@ -401,8 +411,10 @@ class ContextBuilder {
if (source.exists()) {
try {
optionMap = optionsProvider.getOptionsFromSource(source);
- } catch (_) {
+ verbose('Loaded analysis options from ${source.fullName}');
+ } catch (e) {
// Ignore exceptions thrown while trying to load the options file.
+ verbose('Exception: $e\n when loading ${source.fullName}');
}
}
}
@@ -410,12 +422,16 @@ class ContextBuilder {
if (optionMap != null) {
applyToAnalysisOptions(options, optionMap);
if (builderOptions.argResults != null) {
- applyAnalysisOptionFlags(options, builderOptions.argResults);
+ applyAnalysisOptionFlags(options, builderOptions.argResults,
+ verbosePrint: verbosePrint);
// If lints turned on but none specified, then enable default lints
if (options.lint && options.lintRules.isEmpty) {
options.lintRules = Registry.ruleRegistry.defaultRules;
+ verbose('Using default lint rules');
}
}
+ } else {
+ verbose('Using default analysis options');
}
return options;
}
« no previous file with comments | « pkg/analyzer/lib/src/command_line/arguments.dart ('k') | pkg/analyzer_cli/lib/src/driver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698