Skip to content

Commit 1084ca1

Browse files
scheglovCommit Queue
authored andcommitted
Fine. Read summary bundle bytes if its requirements are satisfied.
Similarly, read diagnostics from bytes if requirements are still satisfied. Note, not all requirements are recorded yet, so if enabled now, we might get stale diagnostics. But I believe that with time the implementation can be worked to the point when we record all necessary requirements. Change-Id: Ie81a1c4aa5d41cba3e181e85a30970f2beb97f58 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405820 Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Johnni Winther <[email protected]>
1 parent 6b6b587 commit 1084ca1

28 files changed

+9962
-199
lines changed

pkg/analyzer/lib/dart/sdk/build_sdk_summary.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ Future<Uint8List> buildSdkSummary({
5151
var logger = PerformanceLog(StringBuffer());
5252
var scheduler = AnalysisDriverScheduler(logger);
5353
var optionsMap = AnalysisOptionsMap.forSharedOptions(AnalysisOptionsImpl());
54+
var byteStore = MemoryByteStore();
5455
var analysisDriver = AnalysisDriver(
5556
scheduler: scheduler,
5657
logger: logger,
5758
resourceProvider: resourceProvider,
58-
byteStore: MemoryByteStore(),
59+
byteStore: byteStore,
5960
sourceFactory: SourceFactory([
6061
DartUriResolver(sdk),
6162
]),

pkg/analyzer/lib/src/clients/build_resolvers/build_resolvers.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ AnalysisDriverForPackageBuild createAnalysisDriver({
5959
dataStore.addBundle('', sdkBundle);
6060

6161
var logger = PerformanceLog(null);
62+
byteStore ??= MemoryByteStore();
6263
var scheduler = AnalysisDriverScheduler(logger);
6364
var sharedOptions = analysisOptions as AnalysisOptionsImpl;
6465
var optionsMap = AnalysisOptionsMap.forSharedOptions(sharedOptions);
6566
var driver = AnalysisDriver(
6667
scheduler: scheduler,
6768
logger: logger,
6869
resourceProvider: resourceProvider,
69-
byteStore: byteStore ?? MemoryByteStore(),
70+
byteStore: byteStore,
7071
sourceFactory: sourceFactory,
7172
analysisOptionsMap: optionsMap,
7273
fileContentCache: fileContentCache,

pkg/analyzer/lib/src/dart/analysis/analysis_context_collection.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:analyzer/src/dart/analysis/driver.dart';
1515
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
1616
import 'package:analyzer/src/dart/analysis/file_content_cache.dart';
1717
import 'package:analyzer/src/dart/analysis/info_declaration_store.dart';
18+
import 'package:analyzer/src/dart/analysis/library_context.dart';
1819
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
1920
import 'package:analyzer/src/dart/analysis/unlinked_unit_store.dart';
2021
import 'package:analyzer/src/generated/sdk.dart';
@@ -90,12 +91,19 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
9091
optionsFile: optionsFile,
9192
packagesFile: packagesFile,
9293
);
94+
95+
byteStore ??= MemoryByteStore();
96+
var linkedBundleProvider = LinkedBundleProvider(
97+
byteStore: byteStore,
98+
);
99+
93100
var contextBuilder = ContextBuilderImpl(
94101
resourceProvider: this.resourceProvider,
95102
);
96103
for (var root in roots) {
97104
var context = contextBuilder.createContext(
98105
byteStore: byteStore,
106+
linkedBundleProvider: linkedBundleProvider,
99107
contextRoot: root,
100108
definedOptionsFile: optionsFile != null,
101109
declaredVariables: DeclaredVariables.fromMap(declaredVariables ?? {}),

pkg/analyzer/lib/src/dart/analysis/context_builder.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import 'package:analyzer/src/dart/analysis/driver.dart'
2323
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
2424
import 'package:analyzer/src/dart/analysis/file_content_cache.dart';
2525
import 'package:analyzer/src/dart/analysis/info_declaration_store.dart';
26+
import 'package:analyzer/src/dart/analysis/library_context.dart';
2627
import 'package:analyzer/src/dart/analysis/performance_logger.dart'
2728
show PerformanceLog;
2829
import 'package:analyzer/src/dart/analysis/unlinked_unit_store.dart';
@@ -89,9 +90,13 @@ class ContextBuilderImpl {
8990
InfoDeclarationStore? infoDeclarationStore,
9091
OwnedFiles? ownedFiles,
9192
bool enableLintRuleTiming = false,
93+
LinkedBundleProvider? linkedBundleProvider,
9294
}) {
9395
byteStore ??= MemoryByteStore();
9496
performanceLog ??= PerformanceLog(null);
97+
linkedBundleProvider ??= LinkedBundleProvider(
98+
byteStore: byteStore,
99+
);
95100

96101
if (scheduler == null) {
97102
scheduler = AnalysisDriverScheduler(performanceLog);
@@ -145,6 +150,7 @@ class ContextBuilderImpl {
145150
logger: performanceLog,
146151
resourceProvider: resourceProvider,
147152
byteStore: byteStore,
153+
linkedBundleProvider: linkedBundleProvider,
148154
sourceFactory: sourceFactory,
149155
analysisOptionsMap: analysisOptionsMap,
150156
packages: _createPackageMap(

0 commit comments

Comments
 (0)