Skip to content

Commit a161297

Browse files
authored
Skip delete for SDK summary and deps file (#3573)
Fixes #2995 When the summary file is determined to be invalid, regenerate it and overwrite it without deleting. This resolves a race condition where multiple resolvers could try to delete the same file. The invalid content will not be read, because we will regenerate the file before moving on to the rest of the build.
1 parent 9fa21b9 commit a161297

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

build_resolvers/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.3.2
2+
3+
- Skip file delete for SDK summary and deps file. This will only impact behavior
4+
for usage in `build_test` where there may be multiple resolvers used
5+
concurrently.
6+
17
## 2.3.1
28

39
- Fix a bug in the transitive digest builder, ensure we check if assets are

build_resolvers/lib/src/sdk_summary.dart

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,12 @@ Future<String> defaultSdkSummaryGenerator() async {
5353
package: await packagePath(package),
5454
};
5555

56-
// Invalidate existing summary/version/analyzer files if present.
57-
if (await depsFile.exists()) {
58-
if (!await _checkDeps(depsFile, currentDeps)) {
59-
await depsFile.delete();
60-
if (await summaryFile.exists()) await summaryFile.delete();
61-
}
62-
} else if (await summaryFile.exists()) {
63-
// Fallback for cases where we could not do a proper version check.
64-
await summaryFile.delete();
65-
}
56+
final needsRebuild = !await summaryFile.exists() ||
57+
!await depsFile.exists() ||
58+
!await _checkDeps(depsFile, currentDeps);
6659

6760
// Generate the summary and version files if necessary.
68-
if (!await summaryFile.exists()) {
61+
if (needsRebuild) {
6962
var watch = Stopwatch()..start();
7063
_logger.info('Generating SDK summary...');
7164
await summaryFile.create(recursive: true);

build_resolvers/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build_resolvers
2-
version: 2.3.1
2+
version: 2.3.2
33
description: Resolve Dart code in a Builder
44
repository: https://github.com/dart-lang/build/tree/master/build_resolvers
55

0 commit comments

Comments
 (0)