sdk: fix cross-import overlays with SwiftBuild (#361)
- Commit
c3c958d76016fb9a17000e6fd0b7202fec397922- Author
- Sergey Grechishnikov <[email protected]>
- When
- 2026-10-18 05:36 UTC (1 month ago)
- Parents
316a11e
## What does this PR do?
Fixes #360 cross-import overlays on Linux for builds with swift 6.4+.
This PR adds "-Xfrontend", "-enable-cross-import-overlays" to
`toolchan-swb.json` as it was added to `toolchan.json`.
Also bumps sdkEpoch so SDK will rebuild after update.
## How was it tested?
Build was tested locally with branch built from sources.
`xtool new example`, then replace the app file
Fix was tested on this example:
```Swift
import SwiftUI
import PhotosUI
@main
struct exampleApp: App {
@State private var item: PhotosPickerItem?
var body: some Scene {
WindowGroup {
PhotosPicker("Pick a photo", selection: $item)
}
}
}
```
It fails on version 1.22.2, but builds normally when xtool built from
this branch.
## AI tool usage
How much of this PR was AI-assisted? (check one)
- [x] **0** - No AI was used to write code
- [ ] **1** - I was assisted by AI. I reviewed the finished result.
- [ ] **2** - I set the AI going and left it to it; nobody has read the
result - no review, or AI review only
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Configuration Updates**
* Generated Swift toolchain settings no longer explicitly select the LLD
linker. Existing frontend and cross-import overlay options remain
unchanged. This affects linker selection for generated toolsets; no
public API changes are included.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->Diff
Sources/XToolSupport/SDKBuilder.swift
diff --git a/Sources/XToolSupport/SDKBuilder.swift b/Sources/XToolSupport/SDKBuilder.swiftindex 09af2dd..3e0fb83 100644--- a/Sources/XToolSupport/SDKBuilder.swift+++ b/Sources/XToolSupport/SDKBuilder.swift@@ -76,7 +76,7 @@ struct SDKBuilder { let mode: Mode // bump this when the sdk builder logic changes- static let sdkEpoch = 3+ static let sdkEpoch = 4 // tag from https://github.com/xtool-org/darwin-tools-linux-llvm static let darwinToolsVersion = "1.1.0"@@ -205,6 +205,11 @@ struct SDKBuilder { }, "librarian": { "path": "llvm-lib"+ },+ "swiftCompiler": {+ "extraCLIOptions": [+ "-Xfrontend", "-enable-cross-import-overlays"+ ] } } """.write(