fix(app): pin an iOS build destination and validate prerequisites - #11793
Merged
kodjima33 merged 2 commits intoAug 18, 2026
Conversation
Two related gaps in setup.sh, both hit before any app code matters: 1. run_build_ios() never passed -d to `flutter run`, so Flutter picked a destination itself. On a machine with no iOS simulator runtime installed and only a wirelessly-paired phone visible, it silently built for macOS desktop instead — after a full pod install --repo-update and build_runner pass — and failed with an unrelated "No macOS desktop project configured" error (BasedHardware#11775). 2. setup.sh prints a prerequisite list (Xcode v16.4, CocoaPods v1.16.2, Flutter v3.44.5) but validated almost none of it — one `command -v` check in the whole script. A missing or outdated tool surfaced as a confusing downstream failure instead of a named error, unlike the dev harness's own `Cannot start; missing prerequisites:` pattern, which names each gap with a remedy. select_ios_device() enumerates iOS-platform destinations from `flutter devices --machine`, returns the one candidate directly, prompts when there are several (failing fast without a TTY, same reasoning as detect_apple_team_id's prompt), and fails with a named error instead of a silent fallback when there are none. check_ios_prerequisites() validates Flutter/Xcode/CocoaPods/jq against the versions the script already documents, listing every gap at once with its remedy. Verified live, not just in the new shell tests: ran the real `bash setup.sh ios` three ways — non-interactively with two real devices connected (correctly failed fast rather than hang), through a real pty feeding the interactive prompt (correctly built and reached `Launching lib/main.dart on iPhone 17 Pro`, the device actually chosen), and with a stubbed toolchain reporting only macOS as a destination (correctly failed with the named "no iOS device or simulator found" error instead of the original silent-fallback bug). Failure-Class: none Fixes BasedHardware#11775.
Collaborator
|
Thanks @formed2forge — reviewed head Verified against main and the head:
Non-blocking notes:
What I can't verify from here is the macOS behavior itself. Before this becomes the default by AI on behalf of David — needs one on-Mac validation run of the new |
Addresses review feedback on BasedHardware#11793: - check_ios_prerequisites() silently passed when xcodebuild is on PATH but unusable (license not accepted, components missing) — xcodebuild -version then prints nothing matching, the version guard short-circuits, and a broken Xcode install sailed through the exact gate meant to catch it. Named explicitly now, with a remedy. - select_ios_device()'s comment cited detect_apple_team_id as precedent; that function doesn't exist in setup.sh on main (it's from the separate, unmerged BasedHardware#7641). Removed the stale reference. - The CocoaPods outdated-version remedy always said `sudo gem install cocoapods`, wrong for a Homebrew-installed CocoaPods (gem-installing over a brew-managed one doesn't actually update what's on PATH). Now names both. New test confirms the broken-Xcode gap was real: fails (rc=0, silent pass) against the pre-fix check_ios_prerequisites(), passes against the fix. Failure-Class: none
Contributor
Author
|
Thanks for the thorough review, @Git-on-my-level — addressed all three notes in a follow-up commit (
On the two open questions:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related gaps in
app/setup.sh, both hit before any app code matters:run_build_ios()never pinned a target device. With no-d, Flutter picked a destination itself. On a machine with no iOS simulator runtime installed and only a wirelessly-paired phone visible, it silently built for macOS desktop instead — after a fullpod install --repo-updateandbuild_runnerpass — and failed with an unrelated "No macOS desktop project configured" error.setup.shprints a prerequisite list but validates almost none of it. Xcode v16.4, CocoaPods v1.16.2, Flutter v3.44.5 are documented in the script's own header, but the whole script has exactly onecommand -vcheck (forfastlane). A missing or outdated tool surfaces as a confusing downstream failure instead of a named error — unlike the dev harness's ownCannot start; missing prerequisites:pattern, which names each gap with a remedy.What changed
select_ios_device()enumerates iOS-platform destinations fromflutter devices --machine(viajq): returns the one candidate directly, prompts when there are several (failing fast without a TTY — same reasoning asdetect_apple_team_id's existing prompt), and fails with a named error instead of a silent fallback when there are none.check_ios_prerequisites()validates Flutter/Xcode/CocoaPods/jqagainst the versions the script already documents, listing every gap at once with a remedy, before any of the slow setup steps run.run_build_ios()now calls both before doing any real work, and passes the resolved-d <device_id>through toflutter run.Testing
app/test/shell/ios_device_selection_test.sh(single device returns directly; zero devices fails named; multiple devices with no TTY fails fast, not hangs; empty device list fails named) andapp/test/shell/ios_prerequisites_test.sh(_version_at_leastcomparisons; each of the four prerequisites individually missing/outdated with the correct remedy; all four missing at once).bash setup.sh iosthree ways:pod install/build_runnerand reachedLaunching lib/main.dart on iPhone 17 Pro in debug mode...— the exact device chosen.Failure-Class: none
Fixes #11775.