Directly generate a Mach-O dynamic library using gen_snapshot. [reland]#181539
Directly generate a Mach-O dynamic library using gen_snapshot. [reland]#181539auto-submit[bot] merged 12 commits intoflutter:masterfrom
Conversation
Instead of generating assembly code that is then compiled to a Mach-O dynamic library, use the new app-aot-macho-dylib output option for gen_snapshot to generate the Mach-O dynamic library without the assembly step.
There was a problem hiding this comment.
Code Review
This pull request refactors the AOT snapshotting process for Apple platforms to directly generate a Mach-O dynamic library using gen_snapshot, instead of first generating assembly code and then compiling it. This simplifies the build process by removing the intermediate assembly and linking steps. The changes are well-reflected in the updated tests. I have a couple of suggestions to improve the code's clarity and maintainability.
| // On iOS and macOS, we use Xcode to compile the snapshot into a dynamic | ||
| // library that the end-developer can link into their app. |
There was a problem hiding this comment.
This comment is now slightly inaccurate. With this change, gen_snapshot directly produces the dynamic library, and Xcode is no longer used to compile an assembly snapshot. The comment should be updated to reflect this for better code maintainability.
| // On iOS and macOS, we use Xcode to compile the snapshot into a dynamic | |
| // library that the end-developer can link into their app. | |
| // On iOS and macOS, the snapshot is generated as a dynamic library that is | |
| // then embedded in a framework that the end-developer can link into their app. |
References
- The style guide emphasizes that documentation should be useful (line 55). An outdated comment can be misleading and is not useful. (link)
| final minOSVersion = platform == TargetPlatform.ios | ||
| ? FlutterDarwinPlatform.ios.deploymentTarget().toString() | ||
| : FlutterDarwinPlatform.macos.deploymentTarget().toString(); |
There was a problem hiding this comment.
This logic can be simplified by using FlutterDarwinPlatform.fromTargetPlatform to avoid repeating the platform check and make the code more concise.
| final minOSVersion = platform == TargetPlatform.ios | |
| ? FlutterDarwinPlatform.ios.deploymentTarget().toString() | |
| : FlutterDarwinPlatform.macos.deploymentTarget().toString(); | |
| final minOSVersion = FlutterDarwinPlatform.fromTargetPlatform(platform)!.deploymentTarget().toString(); |
References
- The style guide suggests optimizing for readability (line 29). Using a helper function improves readability by abstracting away the platform check. (link)
- The style guide states to 'Write what you need and no more, but when you write it, do it right' (line 31). This refactoring makes the code more concise and less repetitive. (link)
|
autosubmit label was removed for flutter/flutter/181539, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
|
autosubmit label was removed for flutter/flutter/181539, because - The status or check suite Linux firebase_release_smoke_test has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Roll Flutter from f916dd6887bf to e8f9dc50356d (34 revisions) flutter/flutter@f916dd6...e8f9dc5 2026-02-08 [email protected] Roll Skia from 9325111e6ee4 to b7db9f35f0f2 (1 revision) (flutter/flutter#182062) 2026-02-08 [email protected] Roll Skia from 3167229206b5 to 9325111e6ee4 (1 revision) (flutter/flutter#182061) 2026-02-08 [email protected] Roll Fuchsia Linux SDK from sYqpDF9l9-kldd9_Q... to iqtwdXlgKIyZkL5Li... (flutter/flutter#182058) 2026-02-08 [email protected] Roll Skia from ae78024b261e to 3167229206b5 (1 revision) (flutter/flutter#182055) 2026-02-07 [email protected] Roll Dart SDK from ad6368edbe02 to 965b51c219d3 (1 revision) (flutter/flutter#182050) 2026-02-07 [email protected] Roll Skia from a471f253b941 to ae78024b261e (1 revision) (flutter/flutter#182049) 2026-02-07 [email protected] Roll Fuchsia Linux SDK from IOzzhWfhdzhu3zHsz... to sYqpDF9l9-kldd9_Q... (flutter/flutter#182043) 2026-02-07 [email protected] Roll Dart SDK from 02092faa97c5 to ad6368edbe02 (2 revisions) (flutter/flutter#182040) 2026-02-07 [email protected] Roll Skia from 9a983f6c2c06 to a471f253b941 (24 revisions) (flutter/flutter#182039) 2026-02-07 [email protected] Add buffer around rerasterized input to fragment shaders to maintain coordinate space when clipped (flutter/flutter#181743) 2026-02-07 [email protected] Update Flutter's style guide for dot shorthands and extension methods (flutter/flutter#181934) 2026-02-06 [email protected] Manual roll Skia from 39aa2a70213a to 9a983f6c2c06 (flutter/flutter#181986) 2026-02-06 [email protected] Update doc in foundation to match the style guide (flutter/flutter#181972) 2026-02-06 [email protected] Roll Dart SDK from ec674bdb3ae4 to 02092faa97c5 (11 revisions) (flutter/flutter#182017) 2026-02-06 [email protected] Roll Packages from c197455 to 7805d3e (4 revisions) (flutter/flutter#182016) 2026-02-06 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (#174695)" (flutter/flutter#182010) 2026-02-06 [email protected] Update Dart SDK to 3.12 beta1 (flutter/flutter#181948) 2026-02-06 [email protected] [cupertino.dart] Implement CupertinoMenuAnchor and CupertinoMenuItem using RawMenuAnchor (flutter/flutter#174695) 2026-02-06 [email protected] `flutter_tool` : Remove redundant enum types inside the enum definition scope (flutter/flutter#181910) 2026-02-06 [email protected] Roll pub packages (flutter/flutter#181973) 2026-02-05 [email protected] Roll Fuchsia Linux SDK from J2QdLcY2gyt4NP_xV... to IOzzhWfhdzhu3zHsz... (flutter/flutter#181971) 2026-02-05 [email protected] Directly generate a Mach-O dynamic library using gen_snapshot. [reland] (flutter/flutter#181539) 2026-02-05 [email protected] macOS: Implement tooltip window controller (flutter/flutter#180895) 2026-02-05 [email protected] Constrain RawAutocomplete options by soft keyboard (flutter/flutter#181930) 2026-02-05 [email protected] Roll Skia from 079d092f49e6 to 39aa2a70213a (1 revision) (flutter/flutter#181970) 2026-02-05 [email protected] perf: web ui loadFontFromList (flutter/flutter#181440) 2026-02-05 [email protected] Improve accessibility contrast for pre-test message (flutter/flutter#180469) 2026-02-05 [email protected] Roll pub packages (flutter/flutter#181965) 2026-02-05 [email protected] Roll Skia from 8543ce512d5c to 079d092f49e6 (8 revisions) (flutter/flutter#181964) 2026-02-05 [email protected] Add `clearError` API to Form and FormFieldState (flutter/flutter#180752) 2026-02-05 [email protected] Bump minimum required Xcode version to 15 and recommended to 16 (flutter/flutter#180531) 2026-02-05 [email protected] Rename "widgetTester" parameter to "tester" in "WidgetTesterCallback" (flutter/flutter#180944) 2026-02-05 [email protected] Roll Packages from 3bddf2c to c197455 (3 revisions) (flutter/flutter#181962) 2026-02-05 [email protected] Temporarily remove the Pixel 9/API 36 device from the Firebase Test Lab tests. (flutter/flutter#181956) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 ...
…d] (flutter#181539) Instead of generating assembly code that is then compiled to a Mach-O dynamic library, use the new app-aot-macho-dylib output option for gen_snapshot to generate the Mach-O dynamic library without the assembly step. This is a reland of flutter#174870. No changes from the previously landed PR are needed, as the fixes for the App Store issue described in flutter#178602 are all on the Dart side: dart-lang/sdk@8cbf864. Related issues: * dart-lang/sdk#43299 * dart-lang/sdk#60307 * flutter#178602 * dart-lang/sdk#62414 ## 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.
…d] (flutter#181539) Instead of generating assembly code that is then compiled to a Mach-O dynamic library, use the new app-aot-macho-dylib output option for gen_snapshot to generate the Mach-O dynamic library without the assembly step. This is a reland of flutter#174870. No changes from the previously landed PR are needed, as the fixes for the App Store issue described in flutter#178602 are all on the Dart side: dart-lang/sdk@8cbf864. Related issues: * dart-lang/sdk#43299 * dart-lang/sdk#60307 * flutter#178602 * dart-lang/sdk#62414 ## 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.
Instead of generating assembly code that is then compiled to a Mach-O dynamic library, use the new app-aot-macho-dylib output option for gen_snapshot to generate the Mach-O dynamic library without the assembly step.
This is a reland of #174870. No changes from the previously landed PR are needed, as the fixes for the App Store issue described in #178602 are all on the Dart side: dart-lang/sdk@8cbf864.
Related issues:
Pre-launch Checklist
///).