Repository navigation
flutter clean: add --xcode-clean option to control Xcode cleaning - #181079
RusKryzhanovskiy wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new --xcode-clean option to the flutter clean command, providing more granular control over Xcode workspace cleaning. This is a valuable addition for large projects where cleaning all schemes can be time-consuming. The implementation is clear, using an enum for different cleaning scopes and adding comprehensive tests to validate the new functionality. The interaction with the existing --scheme option is also correctly handled. I noticed the PR description mentions that this change is test-exempt, but new tests have been added, which is great! It would be good to update the description to reflect this. My only suggestion is to add documentation for the new enum to align with the project's style guide.
d4debb7 to
fe849b7
Compare
fe849b7 to
7835b05
Compare
| required XcodeBasedProject xcodeProject, | ||
| }) { | ||
| final String hostProjectName = xcodeProject.hostAppProjectName; | ||
| final applicationSchemePrefix = '$hostProjectName-'; |
There was a problem hiding this comment.
I don't believe flavors follow this pattern: https://docs.flutter.dev/deployment/flavors-ios
| return true; | ||
| } | ||
|
|
||
| if (projectInfo.targets.contains(scheme)) { |
There was a problem hiding this comment.
This will also match on non-application schemes, such as extension targets/schemes.
| } | ||
|
|
||
| globals.printTrace('Skipping Xcode scheme "$scheme" (non-application scheme).'); | ||
| return false; |
There was a problem hiding this comment.
I think the proper way to check for "application" schemes, would be to parse the pbxproj file using plistParser.plistJsonContent and filter for PBXNativeTarget with productType = "com.apple.product-type.application"
|
@RusKryzhanovskiy from triage: are you able to make the requested changes? thanks |
|
from triage: We're putting this in draft to get it off our triage queue. Feel free to request review again when it's ready. |
|
@RusKryzhanovskiy would you like to continue working on this PR? |
|
Thank you for your contribution. I'm going to close this PR for now since there are outstanding comments, just to get this off our PR review queue. Please don't hesitate to re-open or submit a new PR if you have the time to address the review comments. Thanks! |
This PR adds a new
--xcode-cleanoption toflutter cleanthat allows controlling how Xcode workspaces are cleaned.Large projects using Swift Package Manager can accumulate many Xcode schemes, which causes
flutter cleanto runxcodebuild cleanserially for every scheme, significantly increasing execution time. This change allows users to limit Xcode cleaning to application-related schemes only, or skip Xcode workspace cleaning entirely when desired.The default behavior remains unchanged: by default, all Xcode schemes continue to be cleaned to preserve existing workflows.
New options:
--xcode-clean=workspace(default, current behavior): Clean all Xcode schemes.--xcode-clean=app: Clean only application schemes.--xcode-clean=skip: Skip Xcode workspace cleaning.This provides a faster and more predictable cleanup experience for large SwiftPM-based workspaces while maintaining backward compatibility.
Fixes #173940, #180758
Pre-launch Checklist
///).