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

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

Issue 1830463002: Change analyzer_cli's "package mode" into a "build mode". (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
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'; 9 import 'dart:io';
10 10
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 _processPlugins(); 118 _processPlugins();
119 119
120 // Parse commandline options. 120 // Parse commandline options.
121 CommandLineOptions options = CommandLineOptions.parse(args); 121 CommandLineOptions options = CommandLineOptions.parse(args);
122 122
123 // Cache options of interest to inform analysis. 123 // Cache options of interest to inform analysis.
124 _setupEnv(options); 124 _setupEnv(options);
125 125
126 // Do analysis. 126 // Do analysis.
127 if (options.packageMode) { 127 if (options.buildMode) {
128 ErrorSeverity severity = _analyzePackage(options); 128 ErrorSeverity severity = _buildModeAnalyze(options);
129 // In case of error propagate exit code. 129 // In case of error propagate exit code.
130 if (severity == ErrorSeverity.ERROR) { 130 if (severity == ErrorSeverity.ERROR) {
131 exitCode = severity.ordinal; 131 exitCode = severity.ordinal;
132 } 132 }
133 } else if (_isBatch) { 133 } else if (_isBatch) {
134 _BatchRunner.runAsBatch(args, (List<String> args) { 134 _BatchRunner.runAsBatch(args, (List<String> args) {
135 CommandLineOptions options = CommandLineOptions.parse(args); 135 CommandLineOptions options = CommandLineOptions.parse(args);
136 return _analyzeAll(options); 136 return _analyzeAll(options);
137 }); 137 });
138 } else { 138 } else {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 } 234 }
235 } 235 }
236 236
237 if (!options.machineFormat) { 237 if (!options.machineFormat) {
238 stats.print(outSink); 238 stats.print(outSink);
239 } 239 }
240 240
241 return allResult; 241 return allResult;
242 } 242 }
243 243
244 /// Perform package analysis according to the given [options]. 244 /// Perform analysis in build mode according to the given [options].
245 ErrorSeverity _analyzePackage(CommandLineOptions options) { 245 ErrorSeverity _buildModeAnalyze(CommandLineOptions options) {
246 return _analyzeAllTag.makeCurrentWhile(() { 246 return _analyzeAllTag.makeCurrentWhile(() {
247 return new PackageAnalyzer(options, stats).analyze(); 247 return new BuildMode(options, stats).analyze();
248 }); 248 });
249 } 249 }
250 250
251 /// Determine whether the context created during a previous call to 251 /// Determine whether the context created during a previous call to
252 /// [_analyzeAll] can be re-used in order to analyze using [options]. 252 /// [_analyzeAll] can be re-used in order to analyze using [options].
253 bool _canContextBeReused(CommandLineOptions options) { 253 bool _canContextBeReused(CommandLineOptions options) {
254 // TODO(paulberry): add a command-line option that disables context re-use. 254 // TODO(paulberry): add a command-line option that disables context re-use.
255 if (_context == null) { 255 if (_context == null) {
256 return false; 256 return false;
257 } 257 }
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 for (var package in packages) { 772 for (var package in packages) {
773 var packageName = path.basename(package.path); 773 var packageName = path.basename(package.path);
774 var realPath = package.resolveSymbolicLinksSync(); 774 var realPath = package.resolveSymbolicLinksSync();
775 result[packageName] = [ 775 result[packageName] = [
776 PhysicalResourceProvider.INSTANCE.getFolder(realPath) 776 PhysicalResourceProvider.INSTANCE.getFolder(realPath)
777 ]; 777 ];
778 } 778 }
779 return result; 779 return result;
780 } 780 }
781 } 781 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698