| Index: pkg/analyzer_cli/lib/src/build_mode.dart
|
| diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
|
| index 39674b7224f569c6d5ffd939aaeb306e5a3cf915..08667cade2e0acf2cba0a05c028b84562db99253 100644
|
| --- a/pkg/analyzer_cli/lib/src/build_mode.dart
|
| +++ b/pkg/analyzer_cli/lib/src/build_mode.dart
|
| @@ -131,6 +131,7 @@ class BuildMode {
|
| InternalAnalysisContext context;
|
| Map<Uri, File> uriToFileMap;
|
| final List<Source> explicitSources = <Source>[];
|
| + final List<PackageBundle> unlinkedBundles = <PackageBundle>[];
|
|
|
| PackageBundleAssembler assembler;
|
| final Set<Source> processedSources = new Set<Source>();
|
| @@ -211,7 +212,13 @@ class BuildMode {
|
| _unlinkedUnitForUri('${src.uri}');
|
| }
|
| } else {
|
| - _serializeAstBasedSummary(explicitSources);
|
| + Set<String> unlinkedUris =
|
| + explicitSources.map((Source s) => s.uri.toString()).toSet();
|
| + for (var bundle in unlinkedBundles) {
|
| + unlinkedUris.addAll(bundle.unlinkedUnitUris);
|
| + }
|
| +
|
| + _serializeAstBasedSummary(unlinkedUris);
|
| assembler.recordDependencies(summaryDataStore);
|
| }
|
| // Write the whole package bundle.
|
| @@ -255,9 +262,39 @@ class BuildMode {
|
|
|
| void _createContext() {
|
| // Read the summaries.
|
| - summaryDataStore = new SummaryDataStore(options.buildSummaryInputs,
|
| + summaryDataStore = new SummaryDataStore(<String>[],
|
| recordDependencyInfo: _shouldOutputSummary);
|
|
|
| + // Adds a bundle at `path` to `summaryDataStore`.
|
| + PackageBundle addBundle(String path) {
|
| + var bundle =
|
| + new PackageBundle.fromBuffer(new io.File(path).readAsBytesSync());
|
| + summaryDataStore.addBundle(path, bundle);
|
| + return bundle;
|
| + }
|
| +
|
| + for (var path in options.buildSummaryInputs) {
|
| + var bundle = addBundle(path);
|
| + if (bundle.linkedLibraryUris.isEmpty &&
|
| + bundle.unlinkedUnitUris.isNotEmpty) {
|
| + throw new ArgumentError(
|
| + 'Got an unlinked summary for --build-summary-input at `$path`. '
|
| + 'Unlinked summaries should be provided with the '
|
| + '--build-summary-unlinked-input argument.');
|
| + }
|
| + }
|
| +
|
| + for (var path in options.buildSummaryUnlinkedInputs) {
|
| + var bundle = addBundle(path);
|
| + unlinkedBundles.add(bundle);
|
| + if (bundle.linkedLibraryUris.isNotEmpty) {
|
| + throw new ArgumentError(
|
| + 'Got a linked summary for --build-summary-input-unlinked at `$path`'
|
| + '. Linked bundles should be provided with the '
|
| + '--build-summary-input argument.');
|
| + }
|
| + }
|
| +
|
| DartSdk sdk;
|
| PackageBundle sdkBundle;
|
| if (options.dartSdkSummaryPath != null) {
|
| @@ -354,15 +391,12 @@ class BuildMode {
|
| * Serialize the package with the given [sources] into [assembler] using only
|
| * their ASTs and [LinkedUnit]s of input packages.
|
| */
|
| - void _serializeAstBasedSummary(List<Source> sources) {
|
| - Set<String> sourceUris =
|
| - sources.map((Source s) => s.uri.toString()).toSet();
|
| -
|
| + void _serializeAstBasedSummary(Set<String> unlinkedUris) {
|
| LinkedLibrary _getDependency(String absoluteUri) =>
|
| summaryDataStore.linkedMap[absoluteUri];
|
|
|
| Map<String, LinkedLibraryBuilder> linkResult = link(
|
| - sourceUris,
|
| + unlinkedUris,
|
| _getDependency,
|
| _unlinkedUnitForUri,
|
| context.declaredVariables.get,
|
|
|