Skip to content

Refactor SwiftPM symlink path logic - #188647

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
vashworth:refactor_swiftpm_symlink
Aug 14, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
vashworth:refactor_swiftpm_symlink

Conversation

@vashworth

@vashworth vashworth commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Xcode caches Swift package manifests and only re-processes them when the path or the contents of the manifest change. To ensure that the package manifest is re-processed when the Flutter plugin version changes, we use the basename as the symlink plugin directory name since the basename has the version number in it.

However, the basename cannot be used in the following scenarios:

.package(name: "firebase_core", path: "../firebase_core"),

This PR copies plugins where the basename can't be used into the build directory and inserts a comment into the Package.swift to force Xcode to re-process it.

Fixes #186881. Fixes #188147. Fixes #188646

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-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 platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. platform-macos Building on or for macOS specifically a: desktop Running on desktop team-ios Owned by iOS platform team team-macos Owned by the macOS platform team labels Jun 26, 2026
@vashworth vashworth added the CICD Run CI/CD label Jun 26, 2026
@vashworth
vashworth marked this pull request as ready for review June 26, 2026 21:47
@vashworth
vashworth requested review from a team as code owners June 26, 2026 21:47
@vashworth
vashworth requested a review from stuartmorgan-g June 26, 2026 21:47

@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 Manager integration in flutter_tools to determine which plugins require symlinking by their name rather than their basename, particularly when the basename does not match the plugin name or when there are inter-plugin dependencies. It also updates the plugin copying process to exclude the example directory and appends the original basename as a comment in the manifest. The review feedback suggests appending a trailing slash to the source path in the rsync command to prevent nested directories, updating the corresponding test expectations, and explicitly handling the nullable return value of pluginSwiftPackageManifestPath for improved type safety.

Comment thread packages/flutter_tools/lib/src/macos/swift_package_manager.dart Outdated
Comment thread packages/flutter_tools/lib/src/macos/swift_package_manager.dart Outdated
Comment thread packages/flutter_tools/test/general.shard/macos/swift_package_manager_test.dart Outdated
Comment thread packages/flutter_tools/test/general.shard/macos/swift_package_manager_test.dart Outdated
Comment thread packages/flutter_tools/test/general.shard/macos/swift_package_manager_test.dart Outdated
Comment thread packages/flutter_tools/lib/src/macos/swift_package_manager.dart Outdated
Comment thread packages/flutter_tools/lib/src/macos/swift_package_manager.dart Outdated
Comment thread packages/flutter_tools/lib/src/macos/swift_package_manager.dart
stuartmorgan-g
stuartmorgan-g previously approved these changes Aug 10, 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.

LGTM

@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 12, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 12, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Aug 12, 2026
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 12, 2026
@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 13, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 13, 2026
Merged via the queue into flutter:master with commit b9ecd16 Aug 14, 2026
28 checks passed
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-ios iOS applications specifically platform-macos Building on or for macOS specifically 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

3 participants