| 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.build_mode; | 5 library analyzer_cli.src.build_mode; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Prepare URIs of unlinked units that should be linked. | 216 // Prepare URIs of unlinked units that should be linked. |
| 217 var unlinkedUris = new Set<String>(); | 217 var unlinkedUris = new Set<String>(); |
| 218 for (var bundle in unlinkedBundles) { | 218 for (var bundle in unlinkedBundles) { |
| 219 unlinkedUris.addAll(bundle.unlinkedUnitUris); | 219 unlinkedUris.addAll(bundle.unlinkedUnitUris); |
| 220 } | 220 } |
| 221 for (var src in explicitSources) { | 221 for (var src in explicitSources) { |
| 222 unlinkedUris.add('${src.uri}'); | 222 unlinkedUris.add('${src.uri}'); |
| 223 } | 223 } |
| 224 // Perform linking. | 224 // Perform linking. |
| 225 _computeLinkedLibraries(unlinkedUris); | 225 _computeLinkedLibraries(unlinkedUris); |
| 226 assembler.recordDependencies(summaryDataStore); | |
| 227 } | 226 } |
| 228 | 227 |
| 229 // Write the whole package bundle. | 228 // Write the whole package bundle. |
| 230 PackageBundleBuilder bundle = assembler.assemble(); | 229 PackageBundleBuilder bundle = assembler.assemble(); |
| 231 if (options.buildSummaryOutput != null) { | 230 if (options.buildSummaryOutput != null) { |
| 232 io.File file = new io.File(options.buildSummaryOutput); | 231 io.File file = new io.File(options.buildSummaryOutput); |
| 233 file.writeAsBytesSync(bundle.toBuffer(), | 232 file.writeAsBytesSync(bundle.toBuffer(), |
| 234 mode: io.FileMode.WRITE_ONLY); | 233 mode: io.FileMode.WRITE_ONLY); |
| 235 } | 234 } |
| 236 if (options.buildSummaryOutputSemantic != null) { | 235 if (options.buildSummaryOutputSemantic != null) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 maxSeverity = maxSeverity.max(processedSeverity); | 286 maxSeverity = maxSeverity.max(processedSeverity); |
| 288 } | 287 } |
| 289 } | 288 } |
| 290 } | 289 } |
| 291 } | 290 } |
| 292 return maxSeverity; | 291 return maxSeverity; |
| 293 } | 292 } |
| 294 | 293 |
| 295 void _createAnalysisDriver() { | 294 void _createAnalysisDriver() { |
| 296 // Read the summaries. | 295 // Read the summaries. |
| 297 summaryDataStore = new SummaryDataStore(<String>[], | 296 summaryDataStore = new SummaryDataStore(<String>[]); |
| 298 recordDependencyInfo: _shouldOutputSummary); | |
| 299 | 297 |
| 300 // Adds a bundle at `path` to `summaryDataStore`. | 298 // Adds a bundle at `path` to `summaryDataStore`. |
| 301 PackageBundle addBundle(String path) { | 299 PackageBundle addBundle(String path) { |
| 302 var bundle = | 300 var bundle = |
| 303 new PackageBundle.fromBuffer(new io.File(path).readAsBytesSync()); | 301 new PackageBundle.fromBuffer(new io.File(path).readAsBytesSync()); |
| 304 summaryDataStore.addBundle(path, bundle); | 302 summaryDataStore.addBundle(path, bundle); |
| 305 return bundle; | 303 return bundle; |
| 306 } | 304 } |
| 307 | 305 |
| 308 int numInputs = options.buildSummaryInputs.length + | 306 int numInputs = options.buildSummaryInputs.length + |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 * Build the inverse mapping of [uriToSourceMap]. | 497 * Build the inverse mapping of [uriToSourceMap]. |
| 500 */ | 498 */ |
| 501 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { | 499 static Map<String, Uri> _computePathToUriMap(Map<Uri, File> uriToSourceMap) { |
| 502 Map<String, Uri> pathToUriMap = <String, Uri>{}; | 500 Map<String, Uri> pathToUriMap = <String, Uri>{}; |
| 503 uriToSourceMap.forEach((Uri uri, File file) { | 501 uriToSourceMap.forEach((Uri uri, File file) { |
| 504 pathToUriMap[file.path] = uri; | 502 pathToUriMap[file.path] = uri; |
| 505 }); | 503 }); |
| 506 return pathToUriMap; | 504 return pathToUriMap; |
| 507 } | 505 } |
| 508 } | 506 } |
| OLD | NEW |