Skip to content

Eager failure when building and no XCode build settings#184726

Open
davidmartos96 wants to merge 2 commits intoflutter:masterfrom
davidmartos96:xcode_fail_if_no_build_settings
Open

Eager failure when building and no XCode build settings#184726
davidmartos96 wants to merge 2 commits intoflutter:masterfrom
davidmartos96:xcode_fail_if_no_build_settings

Conversation

@davidmartos96
Copy link
Copy Markdown
Contributor

@davidmartos96 davidmartos96 commented Apr 7, 2026

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 found simply 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-assist bot 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.

@davidmartos96 davidmartos96 requested a review from a team as a code owner April 7, 2026 17:51
@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team labels Apr 7, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/flutter_tools/lib/src/ios/mac.dart
Comment thread packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart Outdated
Comment on lines +359 to +360
fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
fileSystem: MemoryFileSystem.test(),
logger: BufferLogger.test(),
fileSystem: fileSystem,
logger: logger,

Comment thread packages/flutter_tools/test/commands.shard/hermetic/build_ios_test.dart Outdated

if (buildSettings.isEmpty) {
globals.printError(
'No XCode build settings have been found. Please check possible errors above.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What errors are printed above? Can you update your PR description with a sample output after your code change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just added some context. The full context and additional verbose output is in the linked issue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build ios shows unrelated error message if it fails to get XCode build settings

2 participants