Skip to content

Fix search for the Swift compiler on Windows #72

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

Merged
merged 1 commit into from
Aug 18, 2020

Conversation

egorzhdan
Copy link
Contributor

Since the Path.isAbsolute implementation isn't valid for Windows paths, SwiftPM tries to find the Swift compiler in paths like this:

C:/Users/User/Documents/C:/Library/Developer/Toolchains/custom-development.xctoolchain/usr/bin/swiftc.exe

while the actual path is:

C:/Library/Developer/Toolchains/custom-development.xctoolchain/usr/bin/swiftc.exe

After this change SwiftPM can successfully find swiftc.exe on Windows, create a temporary directory for the artifacts and run the compiler (which currently results in an unrelated error).

@MaxDesiatov
Copy link
Contributor

@swift-ci please test

@egorzhdan egorzhdan force-pushed the master branch 2 times, most recently from 6ea0ce0 to a8f3e36 Compare July 28, 2020 21:04
@tomerd
Copy link
Contributor

tomerd commented Aug 17, 2020

@compnerd would you be able to help drive this PR per your recent work on the topic

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the cleanups in Path.swift and fixes in misc.swift are good. Would you mind splitting that out so that we can get those merged? I had something similar to the changes to misc.swift as well.

}
return String(cString: result).withCStringW { resultW, capacity in
return path.withCStringW { pathW, _ in
guard _wfullpath(UnsafeMutablePointer(mutating: resultW), pathW, capacity) != nil else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is really the equivalent to realpath btw, this will expand the relative paths but I don't think it will resolve symlinks along the way.

@egorzhdan
Copy link
Contributor Author

I've excluded the changes in libc.swift from this PR.

@egorzhdan
Copy link
Contributor Author

@swift-ci please test

2 similar comments
@MaxDesiatov
Copy link
Contributor

@swift-ci please test

@MaxDesiatov
Copy link
Contributor

@swift-ci please test

@MaxDesiatov MaxDesiatov requested a review from compnerd August 18, 2020 14:26
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@compnerd compnerd merged commit 2e45582 into swiftlang:master Aug 18, 2020
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.

4 participants