From 546a85f120427d9b905c7b0576041ee6916c700e Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Thu, 5 Dec 2024 15:55:01 -0600 Subject: [PATCH] fix(flutter_tool): remove stale shorebird build artifacts --- .../lib/src/build_system/targets/ios.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/build_system/targets/ios.dart b/packages/flutter_tools/lib/src/build_system/targets/ios.dart index bb00faab0333b..14cf999092c16 100644 --- a/packages/flutter_tools/lib/src/build_system/targets/ios.dart +++ b/packages/flutter_tools/lib/src/build_system/targets/ios.dart @@ -132,14 +132,20 @@ abstract class AotAssemblyBase extends Target { skipMissingInputs: true, ); + // If the shorebird directory exists, delete it first. + final Directory shorebirdDir = environment.fileSystem.directory(environment.fileSystem.path.join(getIosBuildDirectory(), 'shorebird')); + if (shorebirdDir.existsSync()) { + shorebirdDir.deleteSync(recursive: true); + } + // Copy the class table link information (generated by gen_snapshot) from the buildOutputPath to the iOS build directory. final File classTableLink = environment.fileSystem.file(environment.fileSystem.path.join(buildOutputPath, 'App.ct.link')); final File classTableLinkDebug = environment.fileSystem.file(environment.fileSystem.path.join(buildOutputPath, 'App.class_table.json')); if (classTableLink.existsSync()) { - classTableLink.copySync(environment.fileSystem.path.join(getIosBuildDirectory(), 'shorebird', 'App.ct.link')); + classTableLink.copySync(environment.fileSystem.path.join(shorebirdDir.path, 'App.ct.link')); } if (classTableLinkDebug.existsSync()) { - classTableLinkDebug.copySync(environment.fileSystem.path.join(getIosBuildDirectory(), 'shorebird', 'App.class_table.json')); + classTableLinkDebug.copySync(environment.fileSystem.path.join(shorebirdDir.path, 'App.class_table.json')); } } }