Repository navigation
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
5de53b4 to
2d5bca4
Compare
There was a problem hiding this comment.
Code Review
This pull request updates the Flutter tools to explicitly pass the -project argument with the absolute path of the Xcode project when running xcodebuild -list and -resolvePackageDependencies. It also updates the logic for finding the Xcode project directory to prefer the default host app name (e.g., Runner) when multiple projects exist. The feedback suggests caching entity.basename in a local variable to simplify the directory search loop, and moving the early return check in prefetchSwiftPackages before the command list construction to avoid redundant allocations.
Swift package prefetch and xcodebuild -list failed when ios/ contained more than one .xcodeproj because no project was specified. Prefer Runner when resolving the host project name.
Cache entity basename in the project lookup loop and check for an in-progress Swift package fetch before building the xcodebuild command.
84d1d59 to
5620e9a
Compare
5620e9a to
843e6dc
Compare
`xcodebuild` cannot pick a project when the platform directory contains more than one `.xcodeproj` and no `-project` is passed, so it exits with code 78. That previously surfaced as an opaque crash. Treat 78 as a recognised failure and, after confirming on disk that more than one `.xcodeproj` is present, tool exit with a message that names the projects found and explains that the extra ones belong in a subdirectory, where they no longer interfere with the host app project lookup.
843e6dc to
a69ae6c
Compare
| 'Flutter identifies the host app by looking for a single .xcodeproj directly within ' | ||
| '$platformDirectory/, so xcodebuild is unable to determine which project to use.\n' | ||
| 'Move the additional Xcode project(s) into a subdirectory, such as ' | ||
| '$platformDirectory/Something/Foo.xcodeproj, and update any references to them.', |
There was a problem hiding this comment.
| 'Flutter identifies the host app by looking for a single .xcodeproj directly within ' | |
| '$platformDirectory/, so xcodebuild is unable to determine which project to use.\n' | |
| 'Move the additional Xcode project(s) into a subdirectory, such as ' | |
| '$platformDirectory/Something/Foo.xcodeproj, and update any references to them.', | |
| "Only the Flutter application's .xcodeproj (usually named Runner.xcodeproj) is allowed directly within $platformDirectory/.\n" | |
| 'Move any additional .xcodeproj directories into a subdirectory, such as ' | |
| '$platformDirectory/Foo/Foo.xcodeproj, and update any references to them.', |
| await _swiftPackageFetchStderrSubscription?.cancel(); | ||
| }); | ||
| if (exitCode != 0) { | ||
| throwToolExitIfMultipleXcodeProjects(hostAppRoot); |
There was a problem hiding this comment.
Why is this here? We shouldn't throw here indiscriminately, we should check if it's failing due to the expected reason
|
This pull request is being closed because it has not been updated in the last 21 days after a request for more information. If you are still working on this, please feel free to reopen it or file a new pull request. Thanks for your contribution. |
Addresses the failure reported in #183747 (comment) and #78839.
When an iOS or macOS platform directory contains multiple
.xcodeprojfiles,xcodebuildcommands that do not specify-projectfail with exit code 78. Automatically selecting one is unsafe because Flutter supports renamed host projects and the existing project lookup would otherwise choose the first match.Following review feedback, this change keeps the existing project-selection behavior and instead provides a guided error explaining that additional Xcode projects should be moved into subdirectories, where they no longer conflict with host app project discovery.
Summary
xcodebuild -listand confirm that the platform directory contains multiple.xcodeprojfilesios/Something/Foo.xcodeprojRunner.xcodeprojTest plan
flutter test packages/flutter_tools/test/general.shard/ios/xcodeproj_test.dart --name "getInfo"flutter test packages/flutter_tools/test/general.shard/xcode_project_test.dart --name "prefetchSwiftPackages"dart analyze packages/flutter_toolsdart format --output=none --set-exit-if-changedfor all changed files