Skip to content

flutter_tools: Copy vendored frameworks from plugin podspecs in ios/macos-framework builds#180135

Merged
auto-submit[bot] merged 7 commits intoflutter:masterfrom
MohammedTarigg:fix-ios-framework-vendored-frameworks
Feb 18, 2026
Merged

flutter_tools: Copy vendored frameworks from plugin podspecs in ios/macos-framework builds#180135
auto-submit[bot] merged 7 commits intoflutter:masterfrom
MohammedTarigg:fix-ios-framework-vendored-frameworks

Conversation

@MohammedTarigg
Copy link
Contributor

Fixes #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.

@MohammedTarigg MohammedTarigg requested a review from a team as a code owner December 19, 2025 18:44
@github-actions github-actions bot added tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team labels Dec 19, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 parseVendoredFrameworks function has a potential bug where it could incorrectly handle multiple vendored_frameworks assignments. I've suggested a refactoring to process only the last assignment, which aligns with Ruby's behavior.
  • There's a path resolution bug in copyVendoredFrameworks that could fail for plugins with shared darwin sources. 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 copyVendoredFrameworks logic 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.

@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from afeee34 to 70486c6 Compare December 19, 2025 18:54
@MohammedTarigg
Copy link
Contributor Author

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.
Added tests for it too. Let me know if you need any changes.

@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from 50a61cc to 038add9 Compare January 14, 2026 02:48
@vashworth
Copy link
Contributor

Overall, I think this looks good, but we still need unit tests for copyVendoredFrameworks

@vashworth
Copy link
Contributor

Also, some files need to be formatted. To fix, run

dart format packages/flutter_tools/lib/src/commands/build_macos_framework.dart packages/flutter_tools/lib/src/commands/build_ios_framework.dart packages/flutter_tools/test/commands.shard/hermetic/build_darwin_framework_test.dart

@MohammedTarigg
Copy link
Contributor Author

Hey, I've added unit tests for copyVendoredFrameworks and formatted the files. The tests cover:

  • Skipping when Pods.xcodeproj doesn't exist
  • Skipping Flutter/App frameworks
  • Copying xcframeworks directly
  • Creating xcframeworks from .framework files
  • Handling missing frameworks, duplicates, and nested paths

@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from 7616258 to 179a3fb Compare January 23, 2026 17:26
Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this out locally and tested it with the fair plugin and found a few bugs. See comments

@MohammedTarigg
Copy link
Contributor Author

Thanks for checking this, I’ll look into the issues you flagged and follow up with fixes + re-test before re-requesting review.

@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from 179a3fb to 53e7109 Compare January 30, 2026 21:05
@MohammedTarigg
Copy link
Contributor Author

updated.

The filter now uses /Flutter.framework instead of Flutter.framework to avoid
false matches like FairDynamicFlutter.framework. Also stripping the ../../../
prefix from CocoaPods virtual group paths, and copying .framework directly
instead of wrapping in xcframework (matching what CocoaPods does).

Added tests and tested manually with a local plugin (vendored .framework and
.xcframework, multiple frameworks, substring names like
FairDynamicFlutter.framework), two plugins with separate vendored frameworks,
and pdfrx which vendors PDFium.xcframework
(espresso3389/pdfrx#501 (comment)).
All copied correctly. This should also fix the workaround that user had where
they were manually copying PDFium.xcframework from the pub cache after the
build. Should work for the common scenarios but let me know if I'm missing
something.

@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from 316db9c to a3e8f21 Compare February 3, 2026 17:42
Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @MohammedTarigg Thanks for working through this with me!

Copy link
Contributor

@okorohelijah okorohelijah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a merge conflict but LGTM

@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from a3e8f21 to c5e10cb Compare February 13, 2026 11:12
@MohammedTarigg
Copy link
Contributor Author

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.

@MohammedTarigg
Copy link
Contributor Author

there is a merge conflict but LGTM

Thanks @okorohelijah, I rebased onto master and resolved the merge conflict; the PR should be mergeable now and CI is re-running.

@MohammedTarigg
Copy link
Contributor Author

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.

MohammedTarigg and others added 7 commits February 14, 2026 08:20
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
@MohammedTarigg MohammedTarigg force-pushed the fix-ios-framework-vendored-frameworks branch from 014a5e6 to 5b97cd7 Compare February 14, 2026 05:20
@vashworth
Copy link
Contributor

Changed LGTM!

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 18, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Feb 18, 2026
Merged via the queue into flutter:master with commit 1887f3f Feb 18, 2026
142 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 18, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 18, 2026
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Feb 18, 2026
…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
rickhohler pushed a commit to rickhohler/flutter that referenced this pull request Feb 19, 2026
…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]>
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flutter build ios-framework ignore plugin vendored_frameworks

5 participants