You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fbb2656
Browse filesBrowse the repository at this point in the historyBrowse files
[flutter_tools] Handle missing Xcode gracefully in getInfo and buildMacOS (flutter#191180)
Fixesflutter#191176
### Problem
In Flutter 3.47.0 telemetry, an unhandled `ProcessException` when
invoking `xcodebuild` emerged as a top crash signature. When running
`flutter build macos` on a machine where Xcode is not installed,
incomplete, or misconfigured, `flutter_tools` crashes with an unhandled
`ProcessException` instead of providing a graceful `ToolExit` error
message.
### Root Cause
1. `buildMacOS` in
`packages/flutter_tools/lib/src/macos/build_macos.dart` lacked
pre-flight toolchain validation
(`globals.xcodeProjectInterpreter?.isInstalled != true`) before querying
Xcode project information.
2. In `XcodeProjectInterpreter.getInfo`
(`packages/flutter_tools/lib/src/ios/xcodeproj.dart`), `xcodebuild
-list` is executed with `throwOnError: true` while only allowing exit
codes 66 and 74. When `xcrun` returns exit code 72 (unable to find
utility "xcodebuild"), `_processUtils.run` throws an uncaught
`ProcessException`.
3. `buildMacOS` improperly used non-null assertions on `projectInfo!`
when resolving build schemes.
### Fix
- Added pre-flight Xcode toolchain check in `buildMacOS` to exit early
with `globals.userMessages.xcodeMissing`.
- Wrapped `XcodeProjectInterpreter.getInfo` in a `try ... on
ProcessException` block to convert unexpected process failures to
user-friendly `ToolExit` messages.
- Added safe null checks on `projectInfo` in `buildMacOS`.
0 commit comments