-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Specify architecture when building for macOS #148920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
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. |
d3d4bd0 to
40c323a
Compare
|
@cbracken is this something you could review? |
FYI: Chris will likely be out of action for the next 10 days or so. |
| throwToolExit('Unable to find expected configuration in Xcode project.'); | ||
| } | ||
| // Specifying the architecture makes the destination clear to Xcode | ||
| final String arch = globals.platform.version.contains('arm64') ? 'arm64' : globals.platform.version.contains('x86_64') ? 'x86_64' : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay on this review.
Instead of string parsing, you should check OperatingSystemUtils.hostPlatform:
| final String arch = globals.platform.version.contains('arm64') ? 'arm64' : globals.platform.version.contains('x86_64') ? 'x86_64' : ''; | |
| final String arch = globals.os.hostPlatform == HostPlatform.darwin_arm64 ? 'arm64' : 'x86_64'; |
What would the empty string fallback do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The empty string fallback is just in case it's not fetched, it does nothing and keeps the behaviour before this pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using an empty string also allows the old tests to pass normally. If I switch to using globals.os.hostPlatform, I might need to modify the existing tests, as the destination parameter is hard-coded in the current tests. I'm not sure if this is an acceptable practice.
In build_macos_test.dart on line 127, '-destination', 'platform=macOS' is written as a string. I might need to modify it to pass this PR.
|
@zhibisora are you still working on this? |
Yes, I had some other things to handle before, but I will continue working on it from now on. |
40c323a to
4f06fef
Compare
312e981 to
0531557
Compare
|
Right on. Give us a shout when this is passing tests and ready for review! Thanks! |
|
Example failure: |
|
Heads up, after #152347 you'll be able to grab the |
|
Are you still working on this? Would you like any help? |
|
Converting to draft for the time being. @zhibisora is this still something you're working on? |
|
This pull request has been changed to a draft. The currently pending flutter-gold status will not be able to resolve until a new commit is pushed or the change is marked ready for review again. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
Thank you for your contribution. I'm going to close this PR for now since there are outstanding comments, just to get this off our PR review queue. Please don't hesitate to submit a new PR if you have the time to address the review comments. Thanks! |
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> This PR resolves warning when building macOS app in environments with multiple available destinations (i.e. arm Macs with Rosetta). | | Debug | Release | Profile | |---|---|---|---| | **Before** | <img width="657" alt="image" src="https://github.com/user-attachments/assets/5207f2cc-2785-4bef-8eb0-e9a5a7431c91" /> | <img width="699" alt="image" src="https://github.com/user-attachments/assets/31f38373-adf9-4797-982d-782569be0681" /> | <img width="699" alt="image" src="https://github.com/user-attachments/assets/be1432f9-0668-44b9-b75e-ae4a56c0ff6e" /> | | **After** | <img width="672" alt="image" src="https://github.com/user-attachments/assets/62f3b37b-8461-4274-b9be-53df22bec82d" /> | <img width="672" alt="image" src="https://github.com/user-attachments/assets/7c0489e7-0f7f-4498-b9d2-6d566722a05a" /> | <img width="672" alt="image" src="https://github.com/user-attachments/assets/d0a3e065-3ae7-4d53-beb5-d2a96aa01aea" /> | For release/profile builds `generic/platform=macOS` was chosen because these configurations are "fat" (includes all arches) so it is a preferred way of building device-agnostic actions such as `xcodebuild build`, as per `xcodebuild` documentation. fixes #86590 Also, kudos to @zhibisora. This PR is heavily inspired by #148920. Although, I failed to properly rebase it onto current master (you know, monorepo merge and format changes). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
<!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> This PR resolves warning when building macOS app in environments with multiple available destinations (i.e. arm Macs with Rosetta). | | Debug | Release | Profile | |---|---|---|---| | **Before** | <img width="657" alt="image" src="https://github.com/user-attachments/assets/5207f2cc-2785-4bef-8eb0-e9a5a7431c91" /> | <img width="699" alt="image" src="https://github.com/user-attachments/assets/31f38373-adf9-4797-982d-782569be0681" /> | <img width="699" alt="image" src="https://github.com/user-attachments/assets/be1432f9-0668-44b9-b75e-ae4a56c0ff6e" /> | | **After** | <img width="672" alt="image" src="https://github.com/user-attachments/assets/62f3b37b-8461-4274-b9be-53df22bec82d" /> | <img width="672" alt="image" src="https://github.com/user-attachments/assets/7c0489e7-0f7f-4498-b9d2-6d566722a05a" /> | <img width="672" alt="image" src="https://github.com/user-attachments/assets/d0a3e065-3ae7-4d53-beb5-d2a96aa01aea" /> | For release/profile builds `generic/platform=macOS` was chosen because these configurations are "fat" (includes all arches) so it is a preferred way of building device-agnostic actions such as `xcodebuild build`, as per `xcodebuild` documentation. fixes flutter#86590 Also, kudos to @zhibisora. This PR is heavily inspired by flutter#148920. Although, I failed to properly rebase it onto current master (you know, monorepo merge and format changes). ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
use
and
'-destination', destination,make Xcode know which device to choose for the build.
This will not affect the architecture version of the build result, the actual build version is still determined by the xcode settings. This is simply a more precise specification of the build target to minimize Xcode complaints.
If there is no matching architectural information in the version, the code behavior falls back to what it was before this pr.
fixes #86590
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.