Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakepetroules
Copy link
Contributor

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.

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.
@jakepetroules
Copy link
Contributor Author

@swift-ci test

@jakepetroules
Copy link
Contributor Author

@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)
Copy link
Contributor

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>
Copy link
Contributor Author

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.

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.

2 participants