Skip to content

Prompt plugin authors to add Swift Package Manager compatibility to their plugin#182246

Merged
auto-submit[bot] merged 13 commits intoflutter:masterfrom
okorohelijah:fix_148222
Mar 19, 2026
Merged

Prompt plugin authors to add Swift Package Manager compatibility to their plugin#182246
auto-submit[bot] merged 13 commits intoflutter:masterfrom
okorohelijah:fix_148222

Conversation

@okorohelijah
Copy link
Contributor

@okorohelijah okorohelijah commented Feb 11, 2026

Prompt plugin authors to add Swift Package Manager compatibility to their plugin

Fixes #148222

If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.

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.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 11, 2026
@okorohelijah okorohelijah changed the title Prompt plugin authors to add Swift Package Manager compatibility to t… Prompt plugin authors to add Swift Package Manager compatibility to their plugin Feb 11, 2026
@okorohelijah
Copy link
Contributor Author

The doc for migrating to spm doesnt seem to include adding the FlutterFramework dependency. I plan on updating it

@okorohelijah okorohelijah marked this pull request as ready for review February 12, 2026 09:57
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 introduces a validation check to prompt plugin authors to add Swift Package Manager (SPM) compatibility for their iOS and macOS plugins. The check runs when refreshPluginsList is called for a plugin's example app. It verifies if a plugin with a podspec also has a Package.swift file, and if so, whether it correctly depends on FlutterFramework. Warnings are displayed to guide plugin authors on how to add or fix their SPM support. The changes include new logic in flutter_plugins.dart and plugins.dart, along with corresponding unit tests.

@jmagman jmagman added the platform-ios iOS applications specifically label Feb 12, 2026
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.

Can you move all logic into DarwinDependencyManagement?

@okorohelijah okorohelijah requested a review from a team as a code owner February 18, 2026 12:27
@github-actions github-actions bot added a: desktop Running on desktop team-ios Owned by iOS platform team and removed platform-ios iOS applications specifically labels Feb 18, 2026
' .package(name: "FlutterFramework", path: "../FlutterFramework")\n'
'And add FlutterFramework as a target dependency:\n'
' .product(name: "FlutterFramework", package: "FlutterFramework")\n'
'See $kSwiftPackageManagerDocsUrl for more information.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's wait for flutter/website#12979 to land, so we can point to the docs

///
/// This looks for common patterns used to declare a FlutterFramework dependency:
/// - `.package(name: "FlutterFramework", path: "../FlutterFramework")` - package dependency
/// - `.product(name: "FlutterFramework", package: "FlutterFramework")` - target dependency
Copy link
Contributor

@hellohuanlin hellohuanlin Feb 24, 2026

Choose a reason for hiding this comment

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

I'm not familiar with SwiftPM, but can target dependency be just a string (if no naming conflict)? Something like:

  dependencies: [
    "FlutterFramework",
  ]

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be outstanding? @vashworth is this a possible case that we should watch out?

class SwiftPackageManagerPluginValidationResult {
SwiftPackageManagerPluginValidationResult({
required this.hasPodspec,
required this.hasPackageSwift,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I assume this refers to "Package.swift" file? How about hasSwiftPMManifest?

final bool hasFlutterFrameworkDependency;
final List<String> validationMessages;

bool get isFullyCompatible => hasPackageSwift && hasFlutterFrameworkDependency;
Copy link
Contributor

Choose a reason for hiding this comment

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

what does "fully compatible" mean? (and what is "partially" compatible? the ones without
"FlutterFramework" dependency?

@okorohelijah okorohelijah requested a review from a team as a code owner March 16, 2026 20:24
@github-actions github-actions bot added the team-macos Owned by the macOS platform team label Mar 16, 2026
@github-actions github-actions bot removed platform-ios iOS applications specifically engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Mar 16, 2026
# Conflicts:
#	packages/flutter_tools/test/general.shard/macos/darwin_dependency_management_test.dart
@okorohelijah okorohelijah added the CICD Run CI/CD label Mar 16, 2026
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

@okorohelijah okorohelijah added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 19, 2026
@auto-submit auto-submit bot added this pull request to the merge queue Mar 19, 2026
Merged via the queue into flutter:master with commit 8335876 Mar 19, 2026
149 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 19, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop CICD Run CI/CD platform-macos team-ios Owned by iOS platform team team-macos Owned by the macOS 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.

Prompt plugin authors to add Swift Package Manager compatibility to their plugin

4 participants