DAS plugins: Fix entrypoint deletion bug

I recently introduced this deletion logic but was deleting the wrong
file; this was deleting the `plugin.dart` file that `plugin.aot` is
compiled from. Over the weekend I found this issue with manual testing.
I've also verified this fix with manual testing.

Change-Id: I3f570368068117e6bb952ada0707a09ee97b765c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506320
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Sam Rawlins
2026-05-26 10:13:34 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 35f6ce7bb0
commit c4d1c3a3e8
@@ -540,16 +540,17 @@ class PluginManager {
var stopwatch = Stopwatch()..start();
var depfile = entrypoint.parent.getChildAssumingFile('depfile.txt');
if (entrypoint.exists) {
var aotSnapshotFile = entrypoint.parent.getChildAssumingFile('plugin.aot');
if (aotSnapshotFile.exists) {
try {
// Delete any existing AOT snapshot. On MacOS, sometimes this file
// becomes quarantined due to a race condition with codesigning and
// overwriting the file.
entrypoint.delete();
aotSnapshotFile.delete();
} catch (e) {
instrumentationService.logInfo(
'Could not delete existing AOT plugin entrypoint at "$entrypoint": '
'$e.',
'Could not delete existing AOT plugin entrypoint at '
'"$aotSnapshotFile": $e.',
);
}
}