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

@ -139,6 +139,7 @@ void main() {
'xcrun',
<String>[
'xcodebuild',
'clean',
'test',
'-workspace',
'$platform/Runner.xcworkspace',
@ -220,7 +221,7 @@ void main() {
getMockXcodebuildListProcess(<String>['RunnerTests', 'RunnerUITests']),
// Exit code 66 from testing indicates no tests.
FakeProcessInfo(
MockProcess(exitCode: 66), <String>['xcodebuild', 'test']),
MockProcess(exitCode: 66), <String>['xcodebuild', 'clean', 'test']),
];
final List<String> output = await runCapturingPrint(
runner, <String>['native-test', '--macos', '--no-unit']);
@ -1469,11 +1470,11 @@ public class FlutterActivityTest {
getMockXcodebuildListProcess(
<String>['RunnerTests', 'RunnerUITests']), // iOS list
FakeProcessInfo(
MockProcess(), <String>['xcodebuild', 'test']), // iOS run
MockProcess(), <String>['xcodebuild', 'clean', 'test']), // iOS run
getMockXcodebuildListProcess(
<String>['RunnerTests', 'RunnerUITests']), // macOS list
FakeProcessInfo(
MockProcess(), <String>['xcodebuild', 'test']), // macOS run
MockProcess(), <String>['xcodebuild', 'clean', 'test']), // macOS run
];
final List<String> output = await runCapturingPrint(runner, <String>[