Eager failure when building and no XCode build settings#184726
Eager failure when building and no XCode build settings#184726davidmartos96 wants to merge 2 commits intoflutter:masterfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements an eager failure mechanism in the iOS build process when Xcode build settings are missing, ensuring the build terminates with a clear error message. It includes a new hermetic test and updates to the mock interpreter to verify this behavior. Feedback focuses on correcting the casing of 'Xcode' for branding consistency, improving test descriptions, and using shared mock instances in tests to prevent state inconsistencies.
| fileSystem: MemoryFileSystem.test(), | ||
| logger: BufferLogger.test(), |
There was a problem hiding this comment.
The BuildCommand is being instantiated with fresh mock instances (MemoryFileSystem.test(), BufferLogger.test()), while the test setup and context overrides use the shared fileSystem and logger variables. This can lead to inconsistencies where the command and the global functions it calls are operating on different state. It's better to use the shared instances.
| fileSystem: MemoryFileSystem.test(), | |
| logger: BufferLogger.test(), | |
| fileSystem: fileSystem, | |
| logger: logger, |
|
|
||
| if (buildSettings.isEmpty) { | ||
| globals.printError( | ||
| 'No XCode build settings have been found. Please check possible errors above.', |
There was a problem hiding this comment.
What errors are printed above? Can you update your PR description with a sample output after your code change?
There was a problem hiding this comment.
I have just added some context. The full context and additional verbose output is in the linked issue
There was a problem hiding this comment.
@hellohuanlin Here would be output from right before the new guard. The user should read the :iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components.
[ +63 ms] executing: [/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj/] /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios
[ ] executing: [/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj/] /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios
[ +765 ms] Command line invocation:
/Applications/Xcode-26.3.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios
Build settings from command line:
BUILD_DIR = /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios
2026-04-06 17:36:53.692 xcodebuild[9020:45597] Writing error result bundle to /var/folders/4p/084k9rr96ld_w60n8rdr0wtm0000gn/T/ResultBundle_2026-06-04_17-36-0053.xcresult
xcodebuild: error: Could not configure request to show build settings: Unable to find a destination matching the provided destination specifier:
{ generic:1, platform:iOS }
Ineligible destinations for the "Runner" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components. }
[ ] Unexpected failure to get Xcode build settings: ProcessException: Process exited abnormally with exit code 64:
Command line invocation:
/Applications/Xcode-26.3.0.app/Contents/Developer/usr/bin/xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios
Build settings from command line:
BUILD_DIR = /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios
2026-04-06 17:36:53.692 xcodebuild[9020:45597] Writing error result bundle to /var/folders/4p/084k9rr96ld_w60n8rdr0wtm0000gn/T/ResultBundle_2026-06-04_17-36-0053.xcresult
xcodebuild: error: Could not configure request to show build settings: Unable to find a destination matching the provided destination specifier:
{ generic:1, platform:iOS }
Ineligible destinations for the "Runner" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 26.2 is not installed. Please download and install the platform from Xcode > Settings > Components. }
Command: /usr/bin/arch -arm64e xcrun xcodebuild -project /Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/ios/Runner.xcodeproj -scheme Runner -configuration Release -destination generic/platform=iOS -showBuildSettings BUILD_DIR=/Users/admin/builds/AEFj1IwjB/0/skilldevs/manabox-flutter/manabox/build/ios.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Fixes #184725
This PR makes the tool exit when building with XCode and we didn't parse any build setting. I understand that there are no cases where this map can be empty, as it includes the app bundle ID, which is required when building.
If we don't exit, it can show unrelated error messages to the users which could be confusing and hard to debug.
For instance, from the linked issue, one could end up getting:
No valid code signing certificates were foundsimply because the development team build setting was not available, despite having valid certificates installed. The automatic certificates lookup doesn't support the format"Apple Distribution: <Company> (<Team>)"Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.