fixed flutter run for projects containing a watchOS companion #54959
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.
Description
As reported by @Henrik-glt in #51126 , when running a flutter app with a watchOS companion app on a physical iOS device using the
flutter run
command, the build currently breaks, although it works for simulated devices. The reason for this behaviour is, that when building for a physical device, the following parameters are set for xcodebuild:Consequently
xcodebuild
will attempt to build the watchOS companion for the architecture of the iOS device, which is not possible. This PR fixes the issue by not setting the ARCHS parameter if a watchOS companion app is detected in the ios project.Upon further investigation it seems that using
ONLY_ACTIVE_ARCH=YES
in combination with ARCHS is not an intended use case. See also the xcode build system guide. So I would propose to drop setting ARCHS for the build path havingONLY_ACTIVE_ARCH=YES
. I performed just a few tests, but so far settingONLY_ACTIVE_ARCH=YES
was sufficient to limit the build to the architecture of the target device. Because more intensive tests might be required for this change, it could also be made in a separate PR.Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read [Handling breaking changes].