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

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

Issue 2781483007: Report error if the same uri appears in multiple summaries. (Closed)
Patch Set: Refactor and check in analyzer cli Created 3 years, 8 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.build_mode; 5 library analyzer_cli.src.build_mode;
6 6
7 import 'dart:core'; 7 import 'dart:core';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit; 10 import 'package:analyzer/dart/ast/ast.dart' show CompilationUnit;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // BuildMode expects sourceFiles in the format "<uri>|<filepath>", 162 // BuildMode expects sourceFiles in the format "<uri>|<filepath>",
163 // but the rest of the code base does not understand this format. 163 // but the rest of the code base does not understand this format.
164 // Rewrite sourceFiles, stripping the "<uri>|" prefix, so that it 164 // Rewrite sourceFiles, stripping the "<uri>|" prefix, so that it
165 // does not cause problems with code that does not expect this format. 165 // does not cause problems with code that does not expect this format.
166 options.rewriteSourceFiles(options.sourceFiles 166 options.rewriteSourceFiles(options.sourceFiles
167 .map((String uriPipePath) => 167 .map((String uriPipePath) =>
168 uriPipePath.substring(uriPipePath.indexOf('|') + 1)) 168 uriPipePath.substring(uriPipePath.indexOf('|') + 1))
169 .toList()); 169 .toList());
170 170
171 // Prepare the analysis context. 171 // Prepare the analysis context.
172 _createContext(); 172 try {
173 _createContext();
174 } on ConflictingSummaryException catch (e) {
175 errorSink.writeln('$e');
176 io.exitCode = ErrorSeverity.ERROR.ordinal;
177 return ErrorSeverity.ERROR;
178 }
173 179
174 // Add sources. 180 // Add sources.
175 ChangeSet changeSet = new ChangeSet(); 181 ChangeSet changeSet = new ChangeSet();
176 for (Uri uri in uriToFileMap.keys) { 182 for (Uri uri in uriToFileMap.keys) {
177 File file = uriToFileMap[uri]; 183 File file = uriToFileMap[uri];
178 if (!file.exists) { 184 if (!file.exists) {
179 errorSink.writeln('File not found: ${file.path}'); 185 errorSink.writeln('File not found: ${file.path}');
180 io.exitCode = ErrorSeverity.ERROR.ordinal; 186 io.exitCode = ErrorSeverity.ERROR.ordinal;
181 return ErrorSeverity.ERROR; 187 return ErrorSeverity.ERROR;
182 } 188 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 * Build the inverse mapping of [uriToSourceMap]. 426 * Build the inverse mapping of [uriToSourceMap].
421 */ 427 */
422 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { 428 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) {
423 Map<String, Uri> pathToUriMap = <String, Uri>{}; 429 Map<String, Uri> pathToUriMap = <String, Uri>{};
424 uriToSourceMap.forEach((Uri uri, File file) { 430 uriToSourceMap.forEach((Uri uri, File file) {
425 pathToUriMap[file.path] = uri; 431 pathToUriMap[file.path] = uri;
426 }); 432 });
427 return pathToUriMap; 433 return pathToUriMap;
428 } 434 }
429 } 435 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/package_bundle_reader.dart ('k') | pkg/dev_compiler/lib/sdk/ddc_sdk.sum » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698