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

Unified Diff: pkg/analyzer_cli/lib/src/build_mode.dart

Issue 2226093002: Record information about a summary's dependencies in the summary itself. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
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 23175b2430dad211bc702333617f67ee91a42e5f..a6bfe5b4b14c7d077e0b2e945789825796c77a0e 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -138,9 +138,14 @@ class BuildMode {
PackageBundleAssembler assembler;
final Set<Source> processedSources = new Set<Source>();
final Map<Uri, UnlinkedUnit> uriToUnit = <Uri, UnlinkedUnit>{};
+ PackageBundle sdkBundle;
BuildMode(this.resourceProvider, this.options, this.stats);
+ bool get _shouldOutputSummary =>
+ options.buildSummaryOutput != null ||
+ options.buildSummaryOutputSemantic != null;
+
/**
* Perform package analysis according to the given [options].
*/
@@ -189,8 +194,7 @@ class BuildMode {
assembler = new PackageBundleAssembler(
excludeHashes: options.buildSummaryExcludeInformative &&
options.buildSummaryOutputSemantic == null);
- if (options.buildSummaryOutput != null ||
- options.buildSummaryOutputSemantic != null) {
+ if (_shouldOutputSummary) {
if (options.buildSummaryOnlyAst && !options.buildSummaryFallback) {
_serializeAstBasedSummary(explicitSources);
} else {
@@ -209,21 +213,26 @@ class BuildMode {
}
}
}
+ if (!options.buildSummaryOnlyAst) {
+ // In non-AST mode, the SDK bundle wasn't added to the summaryDataStore
+ // because it is automatically loaded during analysis. However we still
+ // want the SDK bundle to be noted as a dependency, so add it now.
+ summaryDataStore.addBundle(null, sdkBundle);
+ }
// Write the whole package bundle.
- PackageBundleBuilder sdkBundle = assembler.assemble();
+ assembler.recordDependencies(summaryDataStore);
+ PackageBundleBuilder bundle = assembler.assemble();
if (options.buildSummaryExcludeInformative) {
- sdkBundle.flushInformative();
+ bundle.flushInformative();
}
if (options.buildSummaryOutput != null) {
io.File file = new io.File(options.buildSummaryOutput);
- file.writeAsBytesSync(sdkBundle.toBuffer(),
- mode: io.FileMode.WRITE_ONLY);
+ file.writeAsBytesSync(bundle.toBuffer(), mode: io.FileMode.WRITE_ONLY);
}
if (options.buildSummaryOutputSemantic != null) {
- sdkBundle.flushInformative();
+ bundle.flushInformative();
io.File file = new io.File(options.buildSummaryOutputSemantic);
- file.writeAsBytesSync(sdkBundle.toBuffer(),
- mode: io.FileMode.WRITE_ONLY);
+ file.writeAsBytesSync(bundle.toBuffer(), mode: io.FileMode.WRITE_ONLY);
}
}
@@ -255,10 +264,10 @@ class BuildMode {
void _createContext() {
// Read the summaries.
- summaryDataStore = new SummaryDataStore(options.buildSummaryInputs);
+ summaryDataStore = new SummaryDataStore(options.buildSummaryInputs,
+ recordDependencyInfo: _shouldOutputSummary);
DartSdk sdk;
- PackageBundle sdkBundle;
if (options.dartSdkSummaryPath != null) {
SummaryBasedDartSdk summarySdk = new SummaryBasedDartSdk(
options.dartSdkSummaryPath, options.strongMode);

Powered by Google App Engine
This is Rietveld 408576698