Open polac24 opened 2 years ago
Is it possible to change the behavior of swift driver through custom toolchain? https://github.com/apple/swift-driver#testing-in-xcode-with-custom-toolchain
@ainopara, I don't think so. Even if you change a toolchain, (at least for the non SPM-project) Xcode triggers a step builtin-SwiftDriver
, which then schedules individual swift-frontend
steps according to the output of the embedded driver. That said, it is impossible to define a wrapper which would modify the "planning session" done in the driver.
Just in case, I'm experiencing a problem with Xcode 14.2 (using the cocoapods plugin): SWIFT_USE_INTEGRATED_DRIVER is set to NO, SWIFT_EXEC is overridden to ".../xcswiftc" (all of that is set automatically by the plugin, as result of the cache hit), however, when building in Xcode, it still uses xxx/swift-frontend -frontend -c ...
for compilation of .swift files in the target. Will try to make a reproducible sample project, but I wonder if there's a clue/hint already?
If Xcode invokes xcswiftc
and then swift-frontend
, that seems like a cache miss. Does the Xcode's output in the report navigator (CMD+9) show that there was a cache hit (Cached build for ...
vs Disabled remote cache for
)?
To trace the cache miss reason, I would look for logs (docs).
The output says "Disabled remote cache for" indeed, thanks! Will take a look on it.
And I figured it out that it indeed invokes xcswiftc first, I apologise for the confusion.
Expected/desired behavior Xcode 14 introduced the new swift driver that changes the way swift-frontent commands are invoked.
This change is not yet compatible with the simplest
SWIFT_EXEC
override, so for now disabling the new driver has been applied in #152. However, for a full advantage of swift driver, XCRemoteCache could actively integrate into the Xcode <-> swift-driver communication messages - for now, the approach is still unknown.Relevant integration setup
xcprepare integrate ...