-
Notifications
You must be signed in to change notification settings - Fork 207
Fix the legacy driver path construction on non-Windows platforms #1756
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
Fix the legacy driver path construction on non-Windows platforms #1756
Conversation
@swift-ci test |
Wait, it seems like a swift-foundation side issue: import Foundation
let url = URL(fileURLWithPath: "/tmp/x")
print(url.deletingPathExtension().appendingPathExtension(url.pathExtension))
// Swift 5.10: file:///tmp/x
// Swift 6.0: file:///tmp/x. |
@swift-ci test macOS |
should be reverted once swiftlang/swift-driver#1756 is merged
Can you check with swift-foundation if the behaviour change is intentional? If not, we should mark this as a workaround and then revert it once we have a newer Foundation. |
17873dc
to
107b39b
Compare
@compnerd The team said it was an unintentional change and fixed in the main branch. swiftlang/swift-foundation#1080 |
@swift-ci smoke test |
Sources/swift-driver/main.swift
Outdated
@@ -83,10 +83,18 @@ do { | |||
// invocation for a multi-call binary. | |||
let executable: URL = URL(fileURLWithPath: ProcessInfo.processInfo.arguments[0]) | |||
let invocation: URL = URL(fileURLWithPath: CommandLine.arguments[0]) | |||
let legacyExecutablePath: URL = | |||
var legacyExecutablePath: URL = |
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.
Can you duplicate this code instead and guard it with a compiler version check please?
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.
Ok, gated behind 6.2 until we cherry-pick the fix to 6.1 branch.
`swift-driver` tries to invoke `swiftc-legacy-driver.` (trailing dot) on non-Windows platforms when legacy driver is requested since swiftlang#1746 This is because `URL.pathExtension` returns an empty string if the URL does not have an extension but `URL.appendPathExtension` appends a period before the extension even if given an empty string. Thus `url.deletingPathExtension().appendingPathExtension(url.pathExtension)` will not be equal to `url` if `url` does not have an extension.
107b39b
to
46cc429
Compare
@swift-ci please test |
@swift-ci please test macOS platform |
@swift-ci please test Windows platform |
swift-driver
tries to invokeswiftc-legacy-driver.
(trailing dot) on non-Windows platforms when legacy driver is requested since #1746This is because
URL.pathExtension
returns an empty string if the URL does not have an extension butURL.appendPathExtension
appends a period before the extension even if given an empty string. Thusurl.deletingPathExtension().appendingPathExtension(url.pathExtension)
will not be equal tourl
ifurl
does not have an extension.