Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for the iOS deployment target (IPHONEOS_DEPLOYMENT_TARGET) when packaging native code assets, passing it from Xcode and validating it against the minimum supported iOS version. Feedback on the changes highlights two compilation issues: an invalid syntax pattern (?deploymentTarget) in the test file and a type mismatch where a double is passed to the Version constructor instead of an int.
|
I think we should aim for the version number that comes from the xcode build to flow into (Maybe we should do MacOS and iOS in the same PR? Aren't their constraints rather similar?) Here is an AI explanation on how to do this following a similar pattern as #181004 takes for wiring the ccompiler info from cmake to the build hooks: To wire the deployment target into Here is the step-by-step wiring across the 4 files: 1. Forward the Xcode build setting in
|
|
@dcharkes Agreed that the app deployment target should reach both build/link hooks and the packaged metadata, and that iOS and macOS should be handled together. The remaining precision prerequisite is in Once the API shape is agreed and available for Flutter to consume, the follow-up here is to use one resolved version per platform for build/link configuration and metadata, forward This Flutter patch currently only fixes iOS framework metadata. It does not yet implement full hook propagation or the macOS configuration change. |
|
@dcharkes this should be ready for another look. I went with your suggestion: the deployment target now goes through macOS needed one extra step. The assemble script runs in the Flutter Assemble target, which doesn't see Runner's Could someone add the CICD label so the full suite runs? Thanks! |
There was a problem hiding this comment.
Code Review
This pull request forwards iOS and macOS deployment targets from Xcode build settings to the Flutter tool, ensuring that native asset hooks and framework metadata (such as the Info.plist MinimumOSVersion) respect the configured deployment targets. Feedback is provided to improve the readability of the regex match validation in apple_deployment_version.dart by explicitly checking the match properties.
| if (parsed == null || Version.versionPattern.firstMatch(target)?.end != target.length) { | ||
| invalidTarget(); | ||
| } |
There was a problem hiding this comment.
The current regex match check Version.versionPattern.firstMatch(target)?.end != target.length relies on implicit null-coalescing behavior which can be difficult to read and reason about.\n\nWe can improve readability and clarity by explicitly checking if the match is non-null, starts at index 0, and spans the entire length of the target string. This also aligns with the Flutter style guide principle of optimizing for readability.
final RegExpMatch? match = Version.versionPattern.firstMatch(target);\n if (parsed == null || match == null || match.start != 0 || match.end != target.length) {\n invalidTarget();\n }References
- Optimize for readability: Code is read more often than it is written. (link)
There was a problem hiding this comment.
The pattern is anchored with ^ and parsed == null covers the no-match case, so the only thing left to check is that the match reaches the end.
|
Thanks @leehack! 🙏
That is somewhat unfortunate. However, it's more important for iOS where we have add2app and there might not be an outer FYI @bkonyi |
Addresses #194145.
Pass Apple deployment versions from Xcode through
flutter assembleinto build/link hook configuration usingAppleVersion, and use the same resolved iOS value for native frameworkMinimumOSVersion. Preserve native-assets defaults/floors of iOS 15 and macOS 13, with actionable errors for malformed or overflowing components. macOS framework layout is unchanged.The precision API merged in dart-lang/native#3742. It shipped in
code_assets2.2.0, which Flutter master pins since #196114; this branch is merged up to master at031636eb69.macOS app target
macos_assemble.shruns in the Flutter Assemble aggregate target, which cannot read Runner'sMACOSX_DEPLOYMENT_TARGET.buildMacOSalready resolves Runner's build settings, so it now writes that value toFlutter-Generated.xcconfigasFLUTTER_MACOS_DEPLOYMENT_TARGET, andxcode_backend.dartprefers it over the aggregate target's own setting.Known limitation: the value is refreshed only by the Flutter tool. A build started directly from Xcode uses the value from the last
flutter build/flutter run, or the aggregate target's setting if none was written.Validation
--fatal-infos) and formatting of the changed files pass, using Dart 3.15.0-132.0.dev.package_ffidependency, Runner at 14.4.1 and project/aggregate at 12.0: the hook input has deployment version 14.4.1 and the built dylib hasminos 14.4.1.minos, app metadata, and native framework metadata match.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.