packages icon indicating copy to clipboard operation
packages copied to clipboard

[tool] Use `swift-format` from Xcode

Open stuartmorgan-g opened this issue 6 months ago • 7 comments

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 https://github.com/flutter/flutter/issues/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.

stuartmorgan-g avatar Jun 20 '25 14:06 stuartmorgan-g

@jmagman / @vashworth Any objection to this approach of just unconditionally using xcrun, rather than using the multi-step check originally described in https://github.com/flutter/flutter/issues/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.

stuartmorgan-g avatar Jun 20 '25 14:06 stuartmorgan-g

@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.

vashworth avatar Jun 23 '25 15:06 vashworth

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 avatar Jun 23 '25 15:06 stuartmorgan-g

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

stuartmorgan-g avatar Jun 23 '25 15:06 stuartmorgan-g

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.

auto-submit[bot] avatar Jun 23 '25 15:06 auto-submit[bot]

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[bot] avatar Jun 23 '25 17:06 auto-submit[bot]

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[bot] avatar Jun 23 '25 18:06 auto-submit[bot]