Skip to content

Inject FlutterFramework dependency in iOS Add2App swift packages#184365

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
vashworth:inject_flutter_dependency
Apr 1, 2026
Merged

Inject FlutterFramework dependency in iOS Add2App swift packages#184365
auto-submit[bot] merged 5 commits into
flutter:masterfrom
vashworth:inject_flutter_dependency

Conversation

@vashworth

@vashworth vashworth commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

To avoid needing a pre-action script in add2app, all SwiftPM plugins need to have a dependency on the FlutterFramework. However, not all plugins have migrated yet. This PR parses each plugin's Package.swift and injects the FlutterFramework dependency (to the copied version) if it's not already there. Since we need to parse each Package.swift anyways, this also refactors the way we determine the highest deployment version. Previously used a mix of regex and swift package dump-package command, now it relies entirely on the swift command.

Needed for #81867 and #181222

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot 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.

@vashworth vashworth added the CICD Run CI/CD label Mar 30, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Mar 30, 2026
@vashworth vashworth marked this pull request as ready for review March 31, 2026 19:10

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

Copy link
Copy Markdown
Contributor

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 refactors the Swift package build process to implement per-plugin caching and automated dependency injection of the Flutter framework. It updates the FlutterPluginSwiftDependencies class to process plugins individually and store modified manifests in a cache to skip redundant processing. Feedback identifies a regression in _parseSwiftPackageSupportedPlatform where the target platform is not correctly filtered, and a potential path error in the relative location used for the FlutterFramework dependency injection.

Comment thread packages/flutter_tools/lib/src/commands/build_swift_package.dart
Comment thread packages/flutter_tools/lib/src/commands/build_swift_package.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label Mar 31, 2026
stuartmorgan-g
stuartmorgan-g previously approved these changes Apr 1, 2026

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor comments, but nothing that needs a re-review; LGTM

Comment thread packages/flutter_tools/lib/src/commands/build_swift_package.dart Outdated
Comment thread packages/flutter_tools/lib/src/commands/build_swift_package.dart
Comment thread packages/flutter_tools/lib/src/commands/build_swift_package.dart
Comment thread packages/flutter_tools/test/commands.shard/hermetic/build_swift_package_test.dart Outdated
@vashworth vashworth added the CICD Run CI/CD label Apr 1, 2026

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh right, auto-approval clearing :|

Re-LGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 1, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Apr 1, 2026
Merged via the queue into flutter:master with commit 22bc19e Apr 1, 2026
151 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 2, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 2, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Apr 2, 2026
flutter/flutter@3d69471...0f401ee

2026-04-02 matej.knopp@gmail.com Remove isSizedToContent from _window_linux.dart. (flutter/flutter#184506)
2026-04-02 matej.knopp@gmail.com Windows: Get graphics adapter from engine instead of view (flutter/flutter#184479)
2026-04-02 robert.ancell@canonical.com Reduce number of mallocs in FFI call (flutter/flutter#184166)
2026-04-02 robert.ancell@canonical.com Handle events without a device (flutter/flutter#184163)
2026-04-02 robert.ancell@canonical.com Implement tooltip windows on Linux (flutter/flutter#182348)
2026-04-02 engine-flutter-autoroll@skia.org Roll Skia from bdeebacf23c8 to bb9fd8653739 (4 revisions) (flutter/flutter#184494)
2026-04-02 matej.knopp@gmail.com Implement popup windows for macOS (flutter/flutter#182371)
2026-04-02 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from fV-JIWUt4FQGeDtEe... to BFLjk6Uwd0gs_Hkdk... (flutter/flutter#184492)
2026-04-02 victorsanniay@gmail.com Add await or ignore to future-returning methods defined in Dart SDK (flutter/flutter#184229)
2026-04-02 engine-flutter-autoroll@skia.org Roll Dart SDK from 043a2bfd56ff to d84bdfeb45eb (2 revisions) (flutter/flutter#184487)
2026-04-01 engine-flutter-autoroll@skia.org Roll Skia from c2363c39c283 to bdeebacf23c8 (9 revisions) (flutter/flutter#184480)
2026-04-01 ksanaullah383.khan@gmail.com Remove sliver_test_utils cross-import from sliver_app_bar_test (flutter/flutter#184193)
2026-04-01 116356835+AbdeMohlbi@users.noreply.github.com Improve error message when `dart-define` content are not `base64 encoded` and add more test cases (flutter/flutter#184219)
2026-04-01 116356835+AbdeMohlbi@users.noreply.github.com Replace usages of `MediaQuery.of(context).property` with `MediaQuery.propertyOf(context)` (flutter/flutter#184211)
2026-04-01 techonlabs@gmail.com [ios] Add opt-in inline prediction text input support (flutter/flutter#183650)
2026-04-01 jesswon@google.com [fix-forward] fix build_android_host_app_with_module_source integration test (flutter/flutter#184466)
2026-04-01 katelovett@google.com Update style guide (flutter/flutter#184478)
2026-04-01 engine-flutter-autoroll@skia.org Roll Packages from b04f3e5 to b3fcf14 (3 revisions) (flutter/flutter#184474)
2026-04-01 15619084+vashworth@users.noreply.github.com Warn about slow SwiftPM downloads and centralize SwiftPM cache (flutter/flutter#183747)
2026-04-01 15619084+vashworth@users.noreply.github.com Inject FlutterFramework dependency in iOS Add2App swift packages (flutter/flutter#184365)
2026-04-01 1063596+reidbaker@users.noreply.github.com Prepare for skills adoption (flutter/flutter#184129)

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 louisehsu@google.com,stuartmorgan@google.com 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
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Apr 14, 2026
…tter#184365)

To avoid needing a pre-action script in add2app, all SwiftPM plugins
need to have a dependency on the FlutterFramework. However, not all
plugins have migrated yet. This PR parses each plugin's Package.swift
and injects the FlutterFramework dependency (to the copied version) if
it's not already there. Since we need to parse each Package.swift
anyways, this also refactors the way we determine the highest deployment
version. Previously used a mix of regex and `swift package dump-package`
command, now it relies entirely on the `swift` command.

Needed for flutter#81867 and
flutter#181222

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[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
mbcorona pushed a commit to mbcorona/flutter that referenced this pull request Apr 15, 2026
…tter#184365)

To avoid needing a pre-action script in add2app, all SwiftPM plugins
need to have a dependency on the FlutterFramework. However, not all
plugins have migrated yet. This PR parses each plugin's Package.swift
and injects the FlutterFramework dependency (to the copied version) if
it's not already there. Since we need to parse each Package.swift
anyways, this also refactors the way we determine the highest deployment
version. Previously used a mix of regex and `swift package dump-package`
command, now it relies entirely on the `swift` command.

Needed for flutter#81867 and
flutter#181222

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [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].

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot 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.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[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
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11420)

flutter/flutter@3d69471...0f401ee

2026-04-02 matej.knopp@gmail.com Remove isSizedToContent from _window_linux.dart. (flutter/flutter#184506)
2026-04-02 matej.knopp@gmail.com Windows: Get graphics adapter from engine instead of view (flutter/flutter#184479)
2026-04-02 robert.ancell@canonical.com Reduce number of mallocs in FFI call (flutter/flutter#184166)
2026-04-02 robert.ancell@canonical.com Handle events without a device (flutter/flutter#184163)
2026-04-02 robert.ancell@canonical.com Implement tooltip windows on Linux (flutter/flutter#182348)
2026-04-02 engine-flutter-autoroll@skia.org Roll Skia from bdeebacf23c8 to bb9fd8653739 (4 revisions) (flutter/flutter#184494)
2026-04-02 matej.knopp@gmail.com Implement popup windows for macOS (flutter/flutter#182371)
2026-04-02 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from fV-JIWUt4FQGeDtEe... to BFLjk6Uwd0gs_Hkdk... (flutter/flutter#184492)
2026-04-02 victorsanniay@gmail.com Add await or ignore to future-returning methods defined in Dart SDK (flutter/flutter#184229)
2026-04-02 engine-flutter-autoroll@skia.org Roll Dart SDK from 043a2bfd56ff to d84bdfeb45eb (2 revisions) (flutter/flutter#184487)
2026-04-01 engine-flutter-autoroll@skia.org Roll Skia from c2363c39c283 to bdeebacf23c8 (9 revisions) (flutter/flutter#184480)
2026-04-01 ksanaullah383.khan@gmail.com Remove sliver_test_utils cross-import from sliver_app_bar_test (flutter/flutter#184193)
2026-04-01 116356835+AbdeMohlbi@users.noreply.github.com Improve error message when `dart-define` content are not `base64 encoded` and add more test cases (flutter/flutter#184219)
2026-04-01 116356835+AbdeMohlbi@users.noreply.github.com Replace usages of `MediaQuery.of(context).property` with `MediaQuery.propertyOf(context)` (flutter/flutter#184211)
2026-04-01 techonlabs@gmail.com [ios] Add opt-in inline prediction text input support (flutter/flutter#183650)
2026-04-01 jesswon@google.com [fix-forward] fix build_android_host_app_with_module_source integration test (flutter/flutter#184466)
2026-04-01 katelovett@google.com Update style guide (flutter/flutter#184478)
2026-04-01 engine-flutter-autoroll@skia.org Roll Packages from b04f3e5 to b3fcf14 (3 revisions) (flutter/flutter#184474)
2026-04-01 15619084+vashworth@users.noreply.github.com Warn about slow SwiftPM downloads and centralize SwiftPM cache (flutter/flutter#183747)
2026-04-01 15619084+vashworth@users.noreply.github.com Inject FlutterFramework dependency in iOS Add2App swift packages (flutter/flutter#184365)
2026-04-01 1063596+reidbaker@users.noreply.github.com Prepare for skills adoption (flutter/flutter#184129)

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 louisehsu@google.com,stuartmorgan@google.com 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants