Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Xcode 14.0+ Swift driver #153

Open
4 tasks done
polac24 opened this issue Jun 18, 2022 · 6 comments
Open
4 tasks done

Support Xcode 14.0+ Swift driver #153

polac24 opened this issue Jun 18, 2022 · 6 comments

Comments

@polac24
Copy link
Collaborator

polac24 commented Jun 18, 2022

Expected/desired behavior
Xcode 14 introduced the new swift driver that changes the way swift-frontent commands are invoked.

Swift driver, the component that orchestrates Swift front-end invocations, is now integrated into Xcode’s build system, allowing for fine granular dependencies to other build system tasks and explicit scheduling. (72440175)

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

  • CocoaPods cocoapods-xcremotecache plugin
  • Automatic integration using xcprepare integrate ...
  • Manual integration
  • Carthage
@ainopara
Copy link
Contributor

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

@polac24
Copy link
Collaborator Author

polac24 commented Jun 26, 2022

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

@grigorye
Copy link
Contributor

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?

@polac24
Copy link
Collaborator Author

polac24 commented Sep 13, 2023

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

@grigorye
Copy link
Contributor

The output says "Disabled remote cache for" indeed, thanks! Will take a look on it.

@grigorye
Copy link
Contributor

And I figured it out that it indeed invokes xcswiftc first, I apologise for the confusion.

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

No branches or pull requests

3 participants