Skip to content

build(swift): pin local builds to Xcode's toolchain - #8

Merged
bmc08gt merged 1 commit into
mainfrom
build/swift-toolchain-pin
Sep 18, 2026
Merged

bmc08gt merged 1 commit into
mainfrom
build/swift-toolchain-pin

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

swift build fails in a fresh clone of this repo if your swift comes from swiftly. The first error is in grpc-swift-protobuf's codegen plugin:

PluginUtils.swift:124:37: error: value of type 'String' has no member 'data'
PluginUtils.swift:113: error: cannot find type 'URL' in scope

then swift-protobuf fails the same way behind it. PluginUtils.swift does import Foundation on line 17, so it is not a missing import — it is the open-source Foundation not lining up with the macOS SDK.

It is not a stale toolchain default either. I hit this in flipcash2-client-protocol first and tried 6.2.1 and 6.3.3; both fail identically. Apple's Swift 6.4 from Xcode builds this package clean in ten seconds.

So the fix is to stop swiftly answering for swift here. .swift-version containing xcode does exactly that, and nothing else reads the file — swiftly is the only consumer, so a contributor without swiftly and CI both see no change. CI is already on Xcode's toolchain: ci.yml:87 and publish.yml:82 run bare swift build on macos-15. This only makes a local checkout match what CI was already doing.

Same one-line fix as flipcash2-client-protocol@4b600ef, which is on #16. Both repos had it; that one is fixed as part of its contract sync, this one needed its own PR.

scripts/toolchain.env is untouched — the generator pins are a separate thing from which compiler builds the package.

swiftly shims `swift` to whichever swift.org toolchain is the user's default, and
no swift.org toolchain can build this package. grpc-swift-protobuf's codegen plugin
fails to resolve Foundation's `Data` and `URL` against the macOS SDK, and swift-protobuf
fails the same way behind it. Reproduced here on 6.2.1; the identical failure in
flipcash2-client-protocol also reproduced on 6.3.3, so it is not a stale default.
Apple's Swift 6.4 from Xcode builds it clean in ten seconds.

CI already runs bare `swift build` on macos-15 against Xcode's toolchain, in both
ci.yml and publish.yml, so this only makes a local checkout match what CI does.
swiftly is the only thing that reads `.swift-version`, so CI and contributors without
swiftly are unaffected.

Same one-line fix as flipcash2-client-protocol 4b600ef.
@bmc08gt bmc08gt self-assigned this Sep 18, 2026
@bmc08gt
bmc08gt merged commit 44ed688 into main Sep 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant