Skip to content

Move prefetchSwiftPackages to be per platform#186468

Merged
auto-submit[bot] merged 6 commits into
flutter:masterfrom
vashworth:move_prefetch_swift_packages
May 21, 2026
Merged

Move prefetchSwiftPackages to be per platform#186468
auto-submit[bot] merged 6 commits into
flutter:masterfrom
vashworth:move_prefetch_swift_packages

Conversation

@vashworth
Copy link
Copy Markdown
Contributor

This PR moves the logic for prefetchSwiftPackages from the XcodeProjectInterpreter class to the XcodeBasedProject class so that it can be run per platform

Incremental step toward #185218.

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.

@vashworth vashworth requested review from a team as code owners May 13, 2026 18:34
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 13, 2026
@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 May 13, 2026
Copy link
Copy Markdown
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 refactors the Swift package prefetching logic by moving the implementation from XcodeProjectInterpreter to the XcodeBasedProject class and renaming the original method to prefetchSwiftPackagesForProject. Corresponding tests were also relocated. Critical feedback identifies a missing convert.dart import in xcode_project.dart which will lead to compilation errors, and an invalid constructor implementation in the TestIosProject test class.

Comment thread packages/flutter_tools/lib/src/xcode_project.dart
Comment thread packages/flutter_tools/test/general.shard/xcode_project_test.dart Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@vashworth vashworth added the CICD Run CI/CD label May 13, 2026
@vashworth vashworth requested a review from hellohuanlin May 14, 2026 21:38
hellohuanlin
hellohuanlin previously approved these changes May 20, 2026
// All `xcodebuild` project commands will download and resolve Swift packages.
// We should always prefetch Swift packages before running any `xcodebuild` project command
// to control the output.
await prefetchSwiftPackages(xcodeProject, buildDirectory: buildDirectory, quiet: false);
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.

just to clarify - the original code prefetches for both macOS & iOS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The original code prefetched for whichever was first (iOS) and then wouldn't prefetch for the next (macOS) because the process would have already been set.

xcodebuildProjectCommandArguments: _xcodebuildProjectCommandArguments(
buildDirectory,
// skipPackageUpdatesAndValidation should be false so that when subsequent xcodebuild
// commands run, packages should already be resolved, downloaded, updated, and validated.
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.

is this comment accurate? what if subsequent xcodebuild command runs before packages are done fetching?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is accurate. Subsequent xcodebuild commands should not be run before packages are done fetching. The only case where that could happen is if waitForCompletion is false, which is not set when using fetchDependenciesAndGenerateXcodebuildArgs.

@github-actions github-actions Bot removed the CICD Run CI/CD label May 21, 2026
@vashworth vashworth added the CICD Run CI/CD label May 21, 2026
@vashworth vashworth added the autosubmit Merge PR when tree becomes green via auto submit App label May 21, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue May 21, 2026
Merged via the queue into flutter:master with commit bf6210a May 21, 2026
165 of 166 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 21, 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-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

Development

Successfully merging this pull request may close these issues.

3 participants