Commit 14016523 authored by Mikkel Nygaard Ravn's avatar Mikkel Nygaard Ravn Committed by GitHub

Ensure snapshot rebuild logic takes main path into account (#11924)

parent 39680ebf
...@@ -286,25 +286,25 @@ Future<String> _buildAotSnapshot( ...@@ -286,25 +286,25 @@ Future<String> _buildAotSnapshot(
genSnapshotCmd.add(mainPath); genSnapshotCmd.add(mainPath);
final SnapshotType snapshotType = new SnapshotType(platform, buildMode); final SnapshotType snapshotType = new SnapshotType(platform, buildMode);
final File checksumFile = fs.file('$dependencies.checksum'); final File fingerprintFile = fs.file('$dependencies.fingerprint');
final List<File> checksumFiles = <File>[checksumFile, fs.file(dependencies)] final List<File> fingerprintFiles = <File>[fingerprintFile, fs.file(dependencies)]
..addAll(inputPaths.map(fs.file)) ..addAll(inputPaths.map(fs.file))
..addAll(outputPaths.map(fs.file)); ..addAll(outputPaths.map(fs.file));
if (checksumFiles.every((File file) => file.existsSync())) { if (fingerprintFiles.every((File file) => file.existsSync())) {
try { try {
final String json = await checksumFile.readAsString(); final String json = await fingerprintFile.readAsString();
final Checksum oldChecksum = new Checksum.fromJson(json); final Fingerprint oldFingerprint = new Fingerprint.fromJson(json);
final Set<String> snapshotInputPaths = await readDepfile(dependencies) final Set<String> snapshotInputPaths = await readDepfile(dependencies)
..add(mainPath) ..add(mainPath)
..addAll(outputPaths); ..addAll(outputPaths);
final Checksum newChecksum = new Checksum.fromFiles(snapshotType, mainPath, snapshotInputPaths); final Fingerprint newFingerprint = Snapshotter.createFingerprint(snapshotType, mainPath, snapshotInputPaths);
if (oldChecksum == newChecksum) { if (oldFingerprint == newFingerprint) {
printTrace('Skipping AOT snapshot build. Checksums match.'); printStatus('Skipping AOT snapshot build. Fingerprint match.');
return outputPath; return outputPath;
} }
} catch (e) { } catch (e) {
// Log exception and continue, this step is a performance improvement only. // Log exception and continue, this step is a performance improvement only.
printTrace('Rebuilding snapshot due to checksum validation error: $e'); printTrace('Rebuilding snapshot due to fingerprint check error: $e');
} }
} }
...@@ -370,16 +370,16 @@ Future<String> _buildAotSnapshot( ...@@ -370,16 +370,16 @@ Future<String> _buildAotSnapshot(
await runCheckedAsync(linkCommand); await runCheckedAsync(linkCommand);
} }
// Compute and record checksums. // Compute and record build fingerprint.
try { try {
final Set<String> snapshotInputPaths = await readDepfile(dependencies) final Set<String> snapshotInputPaths = await readDepfile(dependencies)
..add(mainPath) ..add(mainPath)
..addAll(outputPaths); ..addAll(outputPaths);
final Checksum checksum = new Checksum.fromFiles(snapshotType, mainPath, snapshotInputPaths); final Fingerprint fingerprint = Snapshotter.createFingerprint(snapshotType, mainPath, snapshotInputPaths);
await checksumFile.writeAsString(checksum.toJson()); await fingerprintFile.writeAsString(fingerprint.toJson());
} catch (e, s) { } catch (e, s) {
// Log exception and continue, this step is a performance improvement only. // Log exception and continue, this step is a performance improvement only.
printTrace('Error during AOT snapshot checksum output: $e\n$s'); printStatus('Error during AOT snapshot fingerprinting: $e\n$s');
} }
return outputPath; return outputPath;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment