bazelbuild / bazelbuild/rules_swift

Provide SwiftFormat toolchain

Open
#864 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
353
Forks
172
Avg merge
23h 14m
Merged PRs (30d)
8

Description

@cgrindel and I are discussing the best way to provide formatting capabilities for Bazel swift users.

The first facility required is a Bazel repository rule that fetches a prebuilt formatter binary and exposes it as a toolchain constrained on the execution platform. It seems like rules_swift could be a good place to host that code, as it already exposes other swift tools. Of course this new toolchain would be orthogonal to the swift compiler, and only fetched if the user invokes actions which require it.

I'm not sure which formatter(s) should be included. These two seem like the obvious candidates from a quick Googling:
https://github.com/nicklockwood/SwiftFormat
https://github.com/apple/swift-format

@allevato @keith do you have any strong opinions on whether such a toolchain could be contributed here, or if you'd prefer it live in some other repo?

Contributor guide

Open the contributing guide

Research direction

Start by reading rules_swift's existing Swift tool integrations and Bazel repository-rule and toolchain documentation; the issue names no files or tests. First resolve whether SwiftFormat or swift-format belongs here, then define a repository rule that fetches the selected prebuilt formatter and exposes a platform-constrained toolchain fetched only when needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.