-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Pass the correct toolchain path to SwiftBuild #8696
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
base: main
Are you sure you want to change the base?
Conversation
SwiftBuild can be initialized with either an Xcode-based developer directory for a Swift toolchain based developer directory, pass the right flags to initialize properly based on what kind of toolchain is in use.
@swift-ci test |
@swift-ci test windows |
let sessionResult = if toolchainPath.components.contains(where: { $0.hasSuffix(".xctoolchain") }) { | ||
await service.createSession(name: name, developerPath: nil, resourceSearchPaths: packageManagerResourcesDirectory.map { [$0.pathString] } ?? [], cachePath: nil, inferiorProductsPath: nil, environment: nil) | ||
} else { | ||
await service.createSession(name: name, swiftToolchainPath: toolchainPath.pathString, resourceSearchPaths: packageManagerResourcesDirectory.map { [$0.pathString] } ?? [], cachePath: nil, inferiorProductsPath: nil, environment: nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth on whether this should use the toolchain from build params or the toolchain this SwiftPM is installed in. I think I've decided I'm happy with this approach though
try resolveSymlinks(swiftCompilerPath) | ||
.parentDirectory // bin | ||
.parentDirectory // usr | ||
.parentDirectory // <toolchain> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably breaks for some platforms like FreeBSD where there's an expectation of using /usr/local
but will handle that in a future change.
SwiftBuild can be initialized with either an Xcode-based developer directory for a Swift toolchain based developer directory, pass the right flags to initialize properly based on what kind of toolchain is in use.