-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Disable SwiftPM for xcode-analyze
#9666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable SwiftPM for xcode-analyze
#9666
Conversation
Until flutter/flutter#172427 is resolved, `xcode-analyze` doesn't work as desired with SwiftPM enabled (it analyzes only the test code, not the plugin code). To avoid losing analysis coverage in the meantime, this disabled SwiftPM temporarily while running analysis. This PR also updates `build-examples` to use the newer pubspec-based config option to set the SwiftPM flag state instead of setting global state, to avoid future issues where we are unintentionally bleeding flag changes across different tests, and to make local runs not impact developer machine state. To unit test this functionality, this adds a new feature to the existing process mock system that allows running an arbitrary test callback at the ponit where a process is being run, which in this case allows reading the temporarily-modified pubspec contents at the right point in the command execution. Fixes flutter/flutter#171442
| throw ToolExit(_exitNoPlatformFlags); | ||
| } | ||
|
|
||
| switch (_swiftPackageManagerFeatureConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change from the flag to the pubspec config does mean that we are delaying stable testing of SwiftPM in this repo longer, since the pubspec config won't do anything on current stable, but since we were already accidentally not testing it on stable anyway even though we could have been, I don't think delaying a bit longer is a big deal. And unlike the old code, this version will not require us to remember to turn it on for stable later, it'll just start working as soon as stable gets the config feature.
There was a problem hiding this 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 improves the tooling's robustness by moving SwiftPM configuration from global state to temporary pubspec.yaml modifications, enhancing test reliability. The new runCallback in the mock process runner is a smart way to test these changes.
My review focuses on a few areas:
- Robustness: I've suggested using
try...finallyblocks to ensurepubspec.yamlis always restored, even if errors occur. - Maintainability: I've identified opportunities to simplify the YAML editing logic and to refactor duplicated test code into helper functions.
These changes will make the tooling more resilient and easier to maintain.
|
Hm, this is blocked on flutter/flutter#154365, unless we turn of analysis for the whole maps package (or hard-code special handling of the |
Hopefully that's fixed on Flutter master once flutter/flutter#173251 rolls in. |
flutter/packages@5c52c55...953cae0 2025-08-19 [email protected] Add com.android.tools.build:gradle to dependabot gradle-plugin group (flutter/packages#9848) 2025-08-19 [email protected] [flutter_migrate] Remove source (flutter/packages#9847) 2025-08-18 [email protected] [go_router]: Add `RelativeGoRouteData` and `TypedRelativeGoRoute` (flutter/packages#9732) 2025-08-18 [email protected] Roll Flutter (stable) from edada7c to 20f8274 (1474 revisions) (flutter/packages#9837) 2025-08-18 [email protected] Roll Flutter from b3fb4c7 to 2265d94 (7 revisions) (flutter/packages#9845) 2025-08-18 [email protected] Disable SwiftPM for `xcode-analyze` (flutter/packages#9666) 2025-08-17 [email protected] Roll Flutter from 0a2906b to b3fb4c7 (5 revisions) (flutter/packages#9840) 2025-08-16 [email protected] Update repo for 3.35 stable release (flutter/packages#9816) 2025-08-16 [email protected] Roll Flutter from 52af7a5 to 0a2906b (16 revisions) (flutter/packages#9836) 2025-08-16 [email protected] [image_picker] Updates min SDK to 3.29 (flutter/packages#9830) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos (flutter/packages#9775) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos - platform implementations (flutter/packages#9818) 2025-08-16 [email protected] [various] Updates min SDK for third_party/packages to 3.29 (flutter/packages#9819) 2025-08-16 [email protected] [vector_graphics] Updates min SDK to 3.29 (flutter/packages#9820) 2025-08-16 [email protected] [google_maps_flutter] Updates min SDK to 3.29 (flutter/packages#9821) 2025-08-16 [email protected] [video_player] Updates min SDK to 3.29 (flutter/packages#9826) 2025-08-15 [email protected] [shared_preferences] Updates min SDK to 3.29 (flutter/packages#9829) 2025-08-15 [email protected] [image_picker_ios] Add photo to simulator Photos library during test (flutter/packages#9759) 2025-08-15 [email protected] [interactive_media_ads] Updates `README` with information about enabling desugaring on Android (flutter/packages#9790) 2025-08-15 [email protected] [in_app_purchase] Updates min SDK to 3.29 (flutter/packages#9825) 2025-08-15 [email protected] Roll Flutter from f4334d2 to 52af7a5 (29 revisions) (flutter/packages#9832) 2025-08-15 [email protected] [go_router] Update generated output format (flutter/packages#9817) 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-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
Until flutter/flutter#172427 is resolved, `xcode-analyze` doesn't work as desired with SwiftPM enabled (it analyzes only the test code, not the plugin code). To avoid losing analysis coverage in the meantime, this disabled SwiftPM temporarily while running analysis. This PR also updates `build-examples` to use the newer pubspec-based config option to set the SwiftPM flag state instead of setting global state, to avoid future issues where we are unintentionally bleeding flag changes across different tests, and to make local runs not impact developer machine state. To unit test this functionality, this adds a new feature to the existing process mock system that allows running an arbitrary test callback at the ponit where a process is being run, which in this case allows reading the temporarily-modified pubspec contents at the right point in the command execution. Fixes flutter/flutter#171442 ## Pre-Review Checklist **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. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
…er#174040) flutter/packages@5c52c55...953cae0 2025-08-19 [email protected] Add com.android.tools.build:gradle to dependabot gradle-plugin group (flutter/packages#9848) 2025-08-19 [email protected] [flutter_migrate] Remove source (flutter/packages#9847) 2025-08-18 [email protected] [go_router]: Add `RelativeGoRouteData` and `TypedRelativeGoRoute` (flutter/packages#9732) 2025-08-18 [email protected] Roll Flutter (stable) from edada7c to 20f8274 (1474 revisions) (flutter/packages#9837) 2025-08-18 [email protected] Roll Flutter from b3fb4c7 to 2265d94 (7 revisions) (flutter/packages#9845) 2025-08-18 [email protected] Disable SwiftPM for `xcode-analyze` (flutter/packages#9666) 2025-08-17 [email protected] Roll Flutter from 0a2906b to b3fb4c7 (5 revisions) (flutter/packages#9840) 2025-08-16 [email protected] Update repo for 3.35 stable release (flutter/packages#9816) 2025-08-16 [email protected] Roll Flutter from 52af7a5 to 0a2906b (16 revisions) (flutter/packages#9836) 2025-08-16 [email protected] [image_picker] Updates min SDK to 3.29 (flutter/packages#9830) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos (flutter/packages#9775) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos - platform implementations (flutter/packages#9818) 2025-08-16 [email protected] [various] Updates min SDK for third_party/packages to 3.29 (flutter/packages#9819) 2025-08-16 [email protected] [vector_graphics] Updates min SDK to 3.29 (flutter/packages#9820) 2025-08-16 [email protected] [google_maps_flutter] Updates min SDK to 3.29 (flutter/packages#9821) 2025-08-16 [email protected] [video_player] Updates min SDK to 3.29 (flutter/packages#9826) 2025-08-15 [email protected] [shared_preferences] Updates min SDK to 3.29 (flutter/packages#9829) 2025-08-15 [email protected] [image_picker_ios] Add photo to simulator Photos library during test (flutter/packages#9759) 2025-08-15 [email protected] [interactive_media_ads] Updates `README` with information about enabling desugaring on Android (flutter/packages#9790) 2025-08-15 [email protected] [in_app_purchase] Updates min SDK to 3.29 (flutter/packages#9825) 2025-08-15 [email protected] Roll Flutter from f4334d2 to 52af7a5 (29 revisions) (flutter/packages#9832) 2025-08-15 [email protected] [go_router] Update generated output format (flutter/packages#9817) 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-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
…er#174040) flutter/packages@5c52c55...953cae0 2025-08-19 [email protected] Add com.android.tools.build:gradle to dependabot gradle-plugin group (flutter/packages#9848) 2025-08-19 [email protected] [flutter_migrate] Remove source (flutter/packages#9847) 2025-08-18 [email protected] [go_router]: Add `RelativeGoRouteData` and `TypedRelativeGoRoute` (flutter/packages#9732) 2025-08-18 [email protected] Roll Flutter (stable) from edada7c to 20f8274 (1474 revisions) (flutter/packages#9837) 2025-08-18 [email protected] Roll Flutter from b3fb4c7 to 2265d94 (7 revisions) (flutter/packages#9845) 2025-08-18 [email protected] Disable SwiftPM for `xcode-analyze` (flutter/packages#9666) 2025-08-17 [email protected] Roll Flutter from 0a2906b to b3fb4c7 (5 revisions) (flutter/packages#9840) 2025-08-16 [email protected] Update repo for 3.35 stable release (flutter/packages#9816) 2025-08-16 [email protected] Roll Flutter from 52af7a5 to 0a2906b (16 revisions) (flutter/packages#9836) 2025-08-16 [email protected] [image_picker] Updates min SDK to 3.29 (flutter/packages#9830) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos (flutter/packages#9775) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos - platform implementations (flutter/packages#9818) 2025-08-16 [email protected] [various] Updates min SDK for third_party/packages to 3.29 (flutter/packages#9819) 2025-08-16 [email protected] [vector_graphics] Updates min SDK to 3.29 (flutter/packages#9820) 2025-08-16 [email protected] [google_maps_flutter] Updates min SDK to 3.29 (flutter/packages#9821) 2025-08-16 [email protected] [video_player] Updates min SDK to 3.29 (flutter/packages#9826) 2025-08-15 [email protected] [shared_preferences] Updates min SDK to 3.29 (flutter/packages#9829) 2025-08-15 [email protected] [image_picker_ios] Add photo to simulator Photos library during test (flutter/packages#9759) 2025-08-15 [email protected] [interactive_media_ads] Updates `README` with information about enabling desugaring on Android (flutter/packages#9790) 2025-08-15 [email protected] [in_app_purchase] Updates min SDK to 3.29 (flutter/packages#9825) 2025-08-15 [email protected] Roll Flutter from f4334d2 to 52af7a5 (29 revisions) (flutter/packages#9832) 2025-08-15 [email protected] [go_router] Update generated output format (flutter/packages#9817) 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-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
…er#174040) flutter/packages@5c52c55...953cae0 2025-08-19 [email protected] Add com.android.tools.build:gradle to dependabot gradle-plugin group (flutter/packages#9848) 2025-08-19 [email protected] [flutter_migrate] Remove source (flutter/packages#9847) 2025-08-18 [email protected] [go_router]: Add `RelativeGoRouteData` and `TypedRelativeGoRoute` (flutter/packages#9732) 2025-08-18 [email protected] Roll Flutter (stable) from edada7c to 20f8274 (1474 revisions) (flutter/packages#9837) 2025-08-18 [email protected] Roll Flutter from b3fb4c7 to 2265d94 (7 revisions) (flutter/packages#9845) 2025-08-18 [email protected] Disable SwiftPM for `xcode-analyze` (flutter/packages#9666) 2025-08-17 [email protected] Roll Flutter from 0a2906b to b3fb4c7 (5 revisions) (flutter/packages#9840) 2025-08-16 [email protected] Update repo for 3.35 stable release (flutter/packages#9816) 2025-08-16 [email protected] Roll Flutter from 52af7a5 to 0a2906b (16 revisions) (flutter/packages#9836) 2025-08-16 [email protected] [image_picker] Updates min SDK to 3.29 (flutter/packages#9830) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos (flutter/packages#9775) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos - platform implementations (flutter/packages#9818) 2025-08-16 [email protected] [various] Updates min SDK for third_party/packages to 3.29 (flutter/packages#9819) 2025-08-16 [email protected] [vector_graphics] Updates min SDK to 3.29 (flutter/packages#9820) 2025-08-16 [email protected] [google_maps_flutter] Updates min SDK to 3.29 (flutter/packages#9821) 2025-08-16 [email protected] [video_player] Updates min SDK to 3.29 (flutter/packages#9826) 2025-08-15 [email protected] [shared_preferences] Updates min SDK to 3.29 (flutter/packages#9829) 2025-08-15 [email protected] [image_picker_ios] Add photo to simulator Photos library during test (flutter/packages#9759) 2025-08-15 [email protected] [interactive_media_ads] Updates `README` with information about enabling desugaring on Android (flutter/packages#9790) 2025-08-15 [email protected] [in_app_purchase] Updates min SDK to 3.29 (flutter/packages#9825) 2025-08-15 [email protected] Roll Flutter from f4334d2 to 52af7a5 (29 revisions) (flutter/packages#9832) 2025-08-15 [email protected] [go_router] Update generated output format (flutter/packages#9817) 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-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
…er#174040) flutter/packages@5c52c55...953cae0 2025-08-19 [email protected] Add com.android.tools.build:gradle to dependabot gradle-plugin group (flutter/packages#9848) 2025-08-19 [email protected] [flutter_migrate] Remove source (flutter/packages#9847) 2025-08-18 [email protected] [go_router]: Add `RelativeGoRouteData` and `TypedRelativeGoRoute` (flutter/packages#9732) 2025-08-18 [email protected] Roll Flutter (stable) from edada7c to 20f8274 (1474 revisions) (flutter/packages#9837) 2025-08-18 [email protected] Roll Flutter from b3fb4c7 to 2265d94 (7 revisions) (flutter/packages#9845) 2025-08-18 [email protected] Disable SwiftPM for `xcode-analyze` (flutter/packages#9666) 2025-08-17 [email protected] Roll Flutter from 0a2906b to b3fb4c7 (5 revisions) (flutter/packages#9840) 2025-08-16 [email protected] Update repo for 3.35 stable release (flutter/packages#9816) 2025-08-16 [email protected] Roll Flutter from 52af7a5 to 0a2906b (16 revisions) (flutter/packages#9836) 2025-08-16 [email protected] [image_picker] Updates min SDK to 3.29 (flutter/packages#9830) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos (flutter/packages#9775) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos - platform implementations (flutter/packages#9818) 2025-08-16 [email protected] [various] Updates min SDK for third_party/packages to 3.29 (flutter/packages#9819) 2025-08-16 [email protected] [vector_graphics] Updates min SDK to 3.29 (flutter/packages#9820) 2025-08-16 [email protected] [google_maps_flutter] Updates min SDK to 3.29 (flutter/packages#9821) 2025-08-16 [email protected] [video_player] Updates min SDK to 3.29 (flutter/packages#9826) 2025-08-15 [email protected] [shared_preferences] Updates min SDK to 3.29 (flutter/packages#9829) 2025-08-15 [email protected] [image_picker_ios] Add photo to simulator Photos library during test (flutter/packages#9759) 2025-08-15 [email protected] [interactive_media_ads] Updates `README` with information about enabling desugaring on Android (flutter/packages#9790) 2025-08-15 [email protected] [in_app_purchase] Updates min SDK to 3.29 (flutter/packages#9825) 2025-08-15 [email protected] Roll Flutter from f4334d2 to 52af7a5 (29 revisions) (flutter/packages#9832) 2025-08-15 [email protected] [go_router] Update generated output format (flutter/packages#9817) 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-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
…er#174040) flutter/packages@5c52c55...953cae0 2025-08-19 [email protected] Add com.android.tools.build:gradle to dependabot gradle-plugin group (flutter/packages#9848) 2025-08-19 [email protected] [flutter_migrate] Remove source (flutter/packages#9847) 2025-08-18 [email protected] [go_router]: Add `RelativeGoRouteData` and `TypedRelativeGoRoute` (flutter/packages#9732) 2025-08-18 [email protected] Roll Flutter (stable) from edada7c to 20f8274 (1474 revisions) (flutter/packages#9837) 2025-08-18 [email protected] Roll Flutter from b3fb4c7 to 2265d94 (7 revisions) (flutter/packages#9845) 2025-08-18 [email protected] Disable SwiftPM for `xcode-analyze` (flutter/packages#9666) 2025-08-17 [email protected] Roll Flutter from 0a2906b to b3fb4c7 (5 revisions) (flutter/packages#9840) 2025-08-16 [email protected] Update repo for 3.35 stable release (flutter/packages#9816) 2025-08-16 [email protected] Roll Flutter from 52af7a5 to 0a2906b (16 revisions) (flutter/packages#9836) 2025-08-16 [email protected] [image_picker] Updates min SDK to 3.29 (flutter/packages#9830) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos (flutter/packages#9775) 2025-08-16 [email protected] [image_picker] Add the ability to pick multiple videos - platform implementations (flutter/packages#9818) 2025-08-16 [email protected] [various] Updates min SDK for third_party/packages to 3.29 (flutter/packages#9819) 2025-08-16 [email protected] [vector_graphics] Updates min SDK to 3.29 (flutter/packages#9820) 2025-08-16 [email protected] [google_maps_flutter] Updates min SDK to 3.29 (flutter/packages#9821) 2025-08-16 [email protected] [video_player] Updates min SDK to 3.29 (flutter/packages#9826) 2025-08-15 [email protected] [shared_preferences] Updates min SDK to 3.29 (flutter/packages#9829) 2025-08-15 [email protected] [image_picker_ios] Add photo to simulator Photos library during test (flutter/packages#9759) 2025-08-15 [email protected] [interactive_media_ads] Updates `README` with information about enabling desugaring on Android (flutter/packages#9790) 2025-08-15 [email protected] [in_app_purchase] Updates min SDK to 3.29 (flutter/packages#9825) 2025-08-15 [email protected] Roll Flutter from f4334d2 to 52af7a5 (29 revisions) (flutter/packages#9832) 2025-08-15 [email protected] [go_router] Update generated output format (flutter/packages#9817) 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-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: 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
Until flutter/flutter#172427 is resolved,
xcode-analyzedoesn't work as desired with SwiftPM enabled (it analyzes only the test code, not the plugin code). To avoid losing analysis coverage in the meantime, this disabled SwiftPM temporarily while running analysis.This PR also updates
build-examplesto use the newer pubspec-based config option to set the SwiftPM flag state instead of setting global state, to avoid future issues where we are unintentionally bleeding flag changes across different tests, and to make local runs not impact developer machine state.To unit test this functionality, this adds a new feature to the existing process mock system that allows running an arbitrary test callback at the ponit where a process is being run, which in this case allows reading the temporarily-modified pubspec contents at the right point in the command execution.
Fixes flutter/flutter#171442
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot 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.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3