Skip to content

Conversation

@stuartmorgan-g
Copy link
Collaborator

As of Xcode 16, swift-format is part of the Xcode distribution. Since CI now uses Xcode 16, we can just always use that version.

This:

  • Removes the swift-format-path logic.
  • Removes the check for swift-format being available
  • Defaults Swift formatting to true only on macOS
  • Removes the swift-format CIPD package from .ci.yaml
  • Updates Pigeon in packages using Swift Pigeon generation to pick up a fix for a lint issue picked up by the latest version of swift-format (which was already fixed in Pigeon).

Fixes flutter/flutter#153803

Pre-Review Checklist

Footnotes

  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. 2 3

@stuartmorgan-g
Copy link
Collaborator Author

@jmagman / @vashworth Any objection to this approach of just unconditionally using xcrun, rather than using the multi-step check originally described in flutter/flutter#153803 ?

We could still do that version, if we wanted to support overriding the swift-format version (or to allow running swift-format from other platforms), but in practice I think that now that it's part of Xcode the chances that anyone will ever actually want to run a version that's not the Xcode version is very low, so probably not worth the complexity in the tool.

/// Options for open panels.
///
/// These correspond to NSOpenPanel properties.
class OpenPanelOptions extends SavePanelOptions {
Copy link
Collaborator Author

@stuartmorgan-g stuartmorgan-g Jun 20, 2025

Choose a reason for hiding this comment

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

This change preserves the old behavior. When I first wrote this I used inheritance out of habit, but that didn't actually do anything in Pigeon at the time. I fixed it by adding composition (line 62 below), but forgot to remove this extends that was being ignored.

In the current Pigeon this is an error, because inheritance does work, but only to inherit from a sealed empty base class to allow type switching.

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

argParser.addFlag(_javaArg, help: 'Format Java files', defaultsTo: true);
argParser.addFlag(_swiftArg,
help: 'Format and lint Swift files', defaultsTo: true);
help: 'Format and lint Swift files', defaultsTo: platform.isMacOS);
Copy link
Member

Choose a reason for hiding this comment

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

fyi: Nothing to do for this patch, but it looks like swift-format is open source https://github.com/swiftlang/swift-format and tagged for various releases if we one did want to support this on Linux as well.

@vashworth
Copy link
Contributor

@jmagman / @vashworth Any objection to this approach of just unconditionally using xcrun, rather than using the multi-step check originally described in flutter/flutter#153803 ?

We could still do that version, if we wanted to support overriding the swift-format version (or to allow running swift-format from other platforms), but in practice I think that now that it's part of Xcode the chances that anyone will ever actually want to run a version that's not the Xcode version is very low, so probably not worth the complexity in the tool.

No objection. We should document how to add this back somewhere in case we do want to use it again.

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

@stuartmorgan-g
Copy link
Collaborator Author

We should document how to add this back somewhere in case we do want to use it again.

I'll add a comment with some context and a link to this PR on the constructor line that makes it default to on for macOS only.

@stuartmorgan-g stuartmorgan-g added override: no versioning needed Override the check requiring version bumps for most changes override: no changelog needed Override the check requiring CHANGELOG updates for most changes labels Jun 23, 2025
@stuartmorgan-g
Copy link
Collaborator Author

CHANGELOG/version override: webview_flutter_wkwebview change is whitespace-only.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 23, 2025
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 23, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 23, 2025

autosubmit label was removed for flutter/packages/9460, because - The status or check suite Linux_android android_device_tests_shard_1 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 23, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 23, 2025

autosubmit label was removed for flutter/packages/9460, because - The status or check suite Linux_android android_platform_tests_shard_1 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 23, 2025
@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 23, 2025
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 23, 2025

autosubmit label was removed for flutter/packages/9460, because - The status or check suite Linux_android android_platform_tests_shard_1 master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 23, 2025
@stuartmorgan-g stuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 24, 2025
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

Thank you!

@auto-submit auto-submit bot merged commit 111ceb7 into flutter:main Jun 26, 2025
79 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 26, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jun 26, 2025
flutter/packages@5963ecd...2c8d2bc

2025-06-26 [email protected] Bump AVD and SDK to API 36 in
Packages CI (flutter/packages#9414)
2025-06-26 [email protected] [tool] Use `swift-format` from Xcode
(flutter/packages#9460)
2025-06-26 [email protected] Revert "[camera_android_camerax]
Force new `Surface` for each `SurfaceRequest`" (flutter/packages#9500)

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
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
flutter/packages@5963ecd...2c8d2bc

2025-06-26 [email protected] Bump AVD and SDK to API 36 in
Packages CI (flutter/packages#9414)
2025-06-26 [email protected] [tool] Use `swift-format` from Xcode
(flutter/packages#9460)
2025-06-26 [email protected] Revert "[camera_android_camerax]
Force new `Surface` for each `SurfaceRequest`" (flutter/packages#9500)

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
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
As of Xcode 16, `swift-format` is part of the Xcode distribution. Since CI now uses Xcode 16, we can just always use that version.

This:
- Removes the `swift-format-path` logic.
- Removes the check for `swift-format` being available
- Defaults Swift formatting to true only on macOS
- Removes the `swift-format` CIPD package from .ci.yaml
- Updates Pigeon in packages using Swift Pigeon generation to pick up a fix for a lint issue picked up by the latest version of `swift-format` (which was already fixed in Pigeon).

Fixes flutter/flutter#153803

## Pre-Review Checklist

[^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.
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
flutter/packages@5963ecd...2c8d2bc

2025-06-26 [email protected] Bump AVD and SDK to API 36 in
Packages CI (flutter/packages#9414)
2025-06-26 [email protected] [tool] Use `swift-format` from Xcode
(flutter/packages#9460)
2025-06-26 [email protected] Revert "[camera_android_camerax]
Force new `Surface` for each `SurfaceRequest`" (flutter/packages#9500)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App override: no changelog needed Override the check requiring CHANGELOG updates for most changes override: no versioning needed Override the check requiring version bumps for most changes p: file_selector p: path_provider p: quick_actions p: url_launcher p: webview_flutter platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In packages repo, swift-format should fall back to Xcode swift-format if not found on PATH

4 participants