flutter_tools: Copy vendored frameworks from plugin podspecs in ios/macos-framework builds#180135
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for copying vendored frameworks from plugin podspecs during iOS and macOS framework builds. The implementation introduces a new copyVendoredFrameworks method and a regex-based parser for podspecs. My review focuses on improving the robustness and correctness of the parsing logic, aligning with async best practices, and enhancing test clarity. Overall, this is a valuable addition that addresses a gap in the build process.
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Code Review
This pull request adds functionality to copy vendored frameworks from plugin podspecs during iOS and macOS framework builds. The implementation introduces a new method copyVendoredFrameworks and a regex-based parser parseVendoredFrameworks.
My review focuses on improving the robustness of the podspec parsing and correcting a path resolution issue.
- The
parseVendoredFrameworksfunction has a potential bug where it could incorrectly handle multiplevendored_frameworksassignments. I've suggested a refactoring to process only the last assignment, which aligns with Ruby's behavior. - There's a path resolution bug in
copyVendoredFrameworksthat could fail for plugins with shareddarwinsources. I've provided a fix to use the podspec's parent directory as the base for resolving framework paths. - I've also recommended adding tests for the new
copyVendoredFrameworkslogic to ensure its correctness and prevent future regressions.
Overall, the changes are a valuable addition, and with these fixes, the implementation will be more robust.
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart
Outdated
Show resolved
Hide resolved
afeee34 to
70486c6
Compare
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart
Show resolved
Hide resolved
|
Hey, sorry for keeping you waiting on this, I switched to parsing the project.pbxproj file instead of the podspec like you suggested. This way CocoaPods handles all the wildcard and platform-specific stuff for us. |
50a61cc to
038add9
Compare
|
Overall, I think this looks good, but we still need unit tests for |
|
Also, some files need to be formatted. To fix, run |
|
Hey, I've added unit tests for copyVendoredFrameworks and formatted the files. The tests cover:
|
7616258 to
179a3fb
Compare
vashworth
left a comment
There was a problem hiding this comment.
I checked this out locally and tested it with the fair plugin and found a few bugs. See comments
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
|
Thanks for checking this, I’ll look into the issues you flagged and follow up with fixes + re-test before re-requesting review. |
179a3fb to
53e7109
Compare
|
updated. The filter now uses /Flutter.framework instead of Flutter.framework to avoid Added tests and tested manually with a local plugin (vendored .framework and |
316db9c to
a3e8f21
Compare
vashworth
left a comment
There was a problem hiding this comment.
LGTM! @MohammedTarigg Thanks for working through this with me!
okorohelijah
left a comment
There was a problem hiding this comment.
there is a merge conflict but LGTM
a3e8f21 to
c5e10cb
Compare
|
Thanks @vashworth. Really appreciate all your help working through this. I’ve rebased the PR onto master, resolved the merge conflict, and force-pushed the updated branch; checks are re-running now. |
Thanks @okorohelijah, I rebased onto master and resolved the merge conflict; the PR should be mergeable now and CI is re-running. |
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
Outdated
Show resolved
Hide resolved
|
I pushed a small follow-up refactor that dedupes the .xcframework and .framework copy paths while keeping behavior the same. I also tightened the skip check to compare the framework basename (Flutter.framework, App.framework, etc) instead of doing a substring match on the path. |
… Darwin framework builds.
Co-authored-by: Victoria Ashworth <[email protected]>
This change addresses reviewer feedback by: - Replacing podspec regex parsing with project.pbxproj parsing using PlistParser - This approach is more reliable because CocoaPods has already resolved all paths, wildcards, and platform-specific entries - Handles edge cases like spec.ios.vendored_frameworks and wildcard patterns automatically - Added comprehensive unit tests for parseVendoredFrameworksFromPbxproj Note: This only copies frameworks from CocoaPods-based plugins. Swift Package Manager support will be added in a separate command as mentioned by @vashworth.
- Use /Flutter.framework instead of Flutter.framework in the skip filter to avoid false matches on names like FairDynamicFlutter - Strip ../../../ prefix from framework paths that CocoaPods adds for virtual groups (Development Pods) - Copy .framework directly instead of wrapping in xcframework, matching how CocoaPods handles vendored frameworks - Update and add tests for all three changes
014a5e6 to
5b97cd7
Compare
|
Changed LGTM! |
…s in ios/macos-framework builds (flutter/flutter#180135)
…s in ios/macos-framework builds (flutter/flutter#180135)
…s in ios/macos-framework builds (flutter/flutter#180135)
…11060) Manual roll requested by [email protected] flutter/flutter@6e4a481...c023e5b 2026-02-18 [email protected] [web] Pass form validation errors to screen readers via aria-description (flutter/flutter#180556) 2026-02-18 [email protected] Roll Packages from f83926f to 59f905c (10 revisions) (flutter/flutter#182547) 2026-02-18 [email protected] flutter_tools: Copy vendored frameworks from plugin podspecs in ios/macos-framework builds (flutter/flutter#180135) 2026-02-18 [email protected] Marks Windows framework_tests_misc_leak_tracking to be unflaky (flutter/flutter#182534) 2026-02-18 [email protected] Allow TabBar to receive a TabBarScrollController (flutter/flutter#180389) 2026-02-18 [email protected] Clean up cross imports in single_child_scroll_view_test.dart, decorated_sliver_test.dart, draggable_scrollable_sheet_test.dart (flutter/flutter#181613) 2026-02-18 [email protected] Roll Fuchsia Linux SDK from mcN42vw48OPH3JDNm... to Ihau0pUz3u5ajw42u... (flutter/flutter#182530) 2026-02-18 [email protected] Analyzer, require 10.1.0, fix deprecations in dependency_graph.dart (flutter/flutter#182507) 2026-02-17 [email protected] Refactor: Remove material from actions test (flutter/flutter#181702) 2026-02-17 [email protected] [a11y] RangeSlider mouse interaction should change keyboard focus (flutter/flutter#182185) 2026-02-17 [email protected] Remove more getters from userMessages class (flutter/flutter#182166) 2026-02-17 [email protected] Implement getUniformMatX and getUniformMatXArray functionality on web (flutter/flutter#182249) 2026-02-17 [email protected] Do not wait until dispose before removing replaced/popped page (flutter/flutter#182315) 2026-02-17 [email protected] Add contentTextStyle support to SimpleDialog (flutter/flutter#178824) 2026-02-17 [email protected] Filter error messages from `emulator -list-avds` output (flutter/flutter#180802) 2026-02-17 [email protected] [Reland] Cupertino cross imports (flutter/flutter#182416) 2026-02-17 [email protected] Roll Packages from 09104b0 to f83926f (1 revision) (flutter/flutter#182504) 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],[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 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…acos-framework builds (flutter#180135) Fixes flutter#125530 When running `flutter build ios-framework` or `flutter build macos-framework`, vendored frameworks declared in plugin podspecs (via `s.vendored_frameworks`) were not being copied to the output directory. This PR adds support for parsing plugin podspecs to find vendored_frameworks entries and copying them to the output directory. Single .framework files are wrapped into xcframeworks to match the output format. Changes: - Added `copyVendoredFrameworks` method to `BuildFrameworkCommand` base class - Added `parseVendoredFrameworks` function to parse podspec Ruby files - Called from both iOS and macOS framework build commands - Added unit tests for the podspec parser I'm happy to adjust the approach if there's a better way to handle this - particularly around the regex-based podspec parsing. Let me know if this looks reasonable or if you'd prefer a different strategy. --------- Co-authored-by: Victoria Ashworth <[email protected]>
…acos-framework builds (flutter#180135) Fixes flutter#125530 When running `flutter build ios-framework` or `flutter build macos-framework`, vendored frameworks declared in plugin podspecs (via `s.vendored_frameworks`) were not being copied to the output directory. This PR adds support for parsing plugin podspecs to find vendored_frameworks entries and copying them to the output directory. Single .framework files are wrapped into xcframeworks to match the output format. Changes: - Added `copyVendoredFrameworks` method to `BuildFrameworkCommand` base class - Added `parseVendoredFrameworks` function to parse podspec Ruby files - Called from both iOS and macOS framework build commands - Added unit tests for the podspec parser I'm happy to adjust the approach if there's a better way to handle this - particularly around the regex-based podspec parsing. Let me know if this looks reasonable or if you'd prefer a different strategy. --------- Co-authored-by: Victoria Ashworth <[email protected]>
Fixes #125530
When running
flutter build ios-frameworkorflutter build macos-framework, vendored frameworks declared in plugin podspecs (vias.vendored_frameworks) were not being copied to the output directory.This PR adds support for parsing plugin podspecs to find vendored_frameworks entries and copying them to the output directory. Single .framework files are wrapped into xcframeworks to match the output format.
Changes:
copyVendoredFrameworksmethod toBuildFrameworkCommandbase classparseVendoredFrameworksfunction to parse podspec Ruby filesI'm happy to adjust the approach if there's a better way to handle this - particularly around the regex-based podspec parsing. Let me know if this looks reasonable or if you'd prefer a different strategy.