Skip to content

Commit 92720c4

Browse files
davidmorganCommit Queue
authored andcommitted
[analyzer] Accept optional FileContentCache in build_resolvers.dart.
The default `FileContentCache.ephemeral` reads files as bytes then converts them to `String` and hashes them. `build_runner` does the same, so by injecting a `FileContentCache` it can deduplicate the work. [email protected] Change-Id: Id046fee8c98263719098c77981bbe10bd1b84658 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408701 Commit-Queue: Morgan :) <[email protected]> Auto-Submit: Morgan :) <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent 1c24e58 commit 92720c4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:analyzer/src/dart/analysis/analysis_options.dart';
1313
import 'package:analyzer/src/dart/analysis/analysis_options_map.dart';
1414
import 'package:analyzer/src/dart/analysis/byte_store.dart';
1515
import 'package:analyzer/src/dart/analysis/driver.dart';
16+
import 'package:analyzer/src/dart/analysis/file_content_cache.dart';
1617
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
1718
import 'package:analyzer/src/generated/source.dart';
1819
import 'package:analyzer/src/summary/package_bundle_reader.dart';
@@ -41,6 +42,7 @@ AnalysisDriverForPackageBuild createAnalysisDriver({
4142
required ResourceProvider resourceProvider,
4243
required Uint8List sdkSummaryBytes,
4344
required AnalysisOptions analysisOptions,
45+
FileContentCache? fileContentCache,
4446
required List<UriResolver> uriResolvers,
4547
required Packages packages,
4648
ByteStore? byteStore,
@@ -67,6 +69,7 @@ AnalysisDriverForPackageBuild createAnalysisDriver({
6769
byteStore: byteStore ?? MemoryByteStore(),
6870
sourceFactory: sourceFactory,
6971
analysisOptionsMap: optionsMap,
72+
fileContentCache: fileContentCache,
7073
externalSummaries: dataStore,
7174
packages: packages,
7275
shouldReportInconsistentAnalysisException: false,

0 commit comments

Comments
 (0)