OLD | NEW |
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.package_analyzer; | 5 library analyzer_cli.src.package_analyzer; |
6 | 6 |
7 import 'dart:core' hide Resource; | 7 import 'dart:core' hide Resource; |
8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
9 | 9 |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 AnalysisResult analysisResult = context.performAnalysisTask(); | 87 AnalysisResult analysisResult = context.performAnalysisTask(); |
88 if (!analysisResult.hasMoreWork) { | 88 if (!analysisResult.hasMoreWork) { |
89 break; | 89 break; |
90 } | 90 } |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 // Write summary for Dart libraries. | 94 // Write summary for Dart libraries. |
95 if (options.packageSummaryOutput != null) { | 95 if (options.packageSummaryOutput != null) { |
96 PackageBundleAssembler assembler = new PackageBundleAssembler(); | 96 PackageBundleAssembler assembler = new PackageBundleAssembler(); |
97 for (Source source in context.librarySources) { | 97 for (Source source in explicitSources) { |
| 98 if (context.computeKindOf(source) != SourceKind.LIBRARY) { |
| 99 continue; |
| 100 } |
98 if (pathos.isWithin(packageLibPath, source.fullName)) { | 101 if (pathos.isWithin(packageLibPath, source.fullName)) { |
99 LibraryElement libraryElement = context.computeLibraryElement(source); | 102 LibraryElement libraryElement = context.computeLibraryElement(source); |
100 if (libraryElement != null) { | 103 assembler.serializeLibraryElement(libraryElement); |
101 assembler.serializeLibraryElement(libraryElement); | |
102 } | |
103 } | 104 } |
104 } | 105 } |
105 // Write the whole package bundle. | 106 // Write the whole package bundle. |
106 PackageBundleBuilder sdkBundle = assembler.assemble(); | 107 PackageBundleBuilder sdkBundle = assembler.assemble(); |
107 io.File file = new io.File(options.packageSummaryOutput); | 108 io.File file = new io.File(options.packageSummaryOutput); |
108 file.writeAsBytesSync(sdkBundle.toBuffer(), mode: io.FileMode.WRITE_ONLY); | 109 file.writeAsBytesSync(sdkBundle.toBuffer(), mode: io.FileMode.WRITE_ONLY); |
109 } | 110 } |
110 | 111 |
111 if (options.packageSummaryOnly) { | 112 if (options.packageSummaryOnly) { |
112 return ErrorSeverity.NONE; | 113 return ErrorSeverity.NONE; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 sink, | 182 sink, |
182 options, | 183 options, |
183 (AnalysisError error) => | 184 (AnalysisError error) => |
184 AnalyzerImpl.processError(error, options, context)); | 185 AnalyzerImpl.processError(error, options, context)); |
185 for (Source source in explicitSources) { | 186 for (Source source in explicitSources) { |
186 AnalysisErrorInfo errorInfo = context.getErrors(source); | 187 AnalysisErrorInfo errorInfo = context.getErrors(source); |
187 formatter.formatErrors([errorInfo]); | 188 formatter.formatErrors([errorInfo]); |
188 } | 189 } |
189 } | 190 } |
190 } | 191 } |
OLD | NEW |