Clean Xcode project before analyzing and testing (#6842)

On macOS 14, caching seems to be more aggressive with swiftmodules and can cause conflicts between tests. To mitigate this, use `xcodebuild clean` (cleans Derived Data for the project) as part of `xcodebuild analyze` and `xcodebuild test`.

Fixes https://github.com/flutter/flutter/issues/149270. Fixes https://github.com/flutter/flutter/issues/149266.
This commit is contained in:
Victoria Ashworth
2024-06-04 10:32:05 -05:00
committed by GitHub
parent bb8c7b2bfd
commit 5e88f948b8
4 changed files with 18 additions and 5 deletions

View File

@ -111,7 +111,9 @@ class XcodeAnalyzeCommand extends PackageLoopingCommand {
print('Running $platform tests and analyzer for $examplePath...');
final int exitCode = await _xcode.runXcodeBuild(
example.directory,
actions: <String>['analyze'],
// Clean before analyzing to remove cached swiftmodules from previous
// runs, which can cause conflicts.
actions: <String>['clean', 'analyze'],
workspace: '${platform.toLowerCase()}/Runner.xcworkspace',
scheme: 'Runner',
configuration: 'Debug',