-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
refactor path model #6509
refactor path model #6509
Conversation
swiftlang/swift-tools-support-core#418 @swift-ci smoke test |
/// normalization, because it is normally the responsibility of the shell and | ||
/// not the program being invoked (e.g. when invoking `cd ~`, it is the shell | ||
/// that evaluates the tilde; the `cd` command receives an absolute path). | ||
public struct AbsolutePath: Hashable, Sendable { |
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 is the key change
|
||
// MARK: - Custom path | ||
|
||
extension FileSystem { |
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 is an adapter so FS work with the "new" types
/// This string manipulation may change the meaning of a path if any of the | ||
/// path components are symbolic links on disk. However, the file system is | ||
/// never accessed in any way when initializing a RelativePath. | ||
public struct RelativePath: Hashable, Sendable { |
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 is the key change
// See http://swift.org/LICENSE.txt for license information | ||
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
// | ||
//===----------------------------------------------------------------------===// |
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 is a shim between utility functions in TSC and the "new" types
@@ -119,18 +133,31 @@ private extension FileSystem { | |||
public class VirtualFileSystem: FileSystem { |
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.
concrete FS implementation use the TSC types
swiftlang/swift-tools-support-core#418 @swift-ci smoke test |
"self-hosted" tests expected to fail since they do not support cross repo testing |
@swift-ci smoke test |
@swift-ci smoke test windows |
cc @abertelrud @compnerd this is the first step towards cleaning this up |
@swift-ci smoke test |
d1f03e1
to
2befe02
Compare
@swift-ci smoke test |
|
||
/// Unlike ``AbsolutePath//extension``, this property returns all characters after the first `.` character in a | ||
/// filename. If no dot character is present in the filename or first dot is the last character, `nil` is returned. | ||
public var allExtensions: [String]? { |
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 guess this was a Basics
-provided extension before? Might be worth keeping that separation?
/// Returns the absolute path with additional extension appended. | ||
/// | ||
public func appending(extension: String) -> AbsolutePath { | ||
guard !self.isRoot else { return self } |
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.
same as above
Sources/Basics/Netrc.swift
Outdated
@@ -74,7 +76,7 @@ public struct Netrc { | |||
} | |||
} | |||
|
|||
public struct NetrcParser { | |||
public enum NetrcParser { |
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.
🤔
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.
swift format made me do it
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.
That's pretty weird?
@@ -23,11 +23,11 @@ public struct SwiftVersion { | |||
public var buildIdentifier: String? | |||
|
|||
/// The major component of the version number. | |||
public var major: Int { return self.version.major } |
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.
😭
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.
Looks good, some small comments
@swift-ci smoke test |
@swift-ci smoke test windows |
@compnerd does the windows build failure make sense you? looks like a compiler crash |
It is an assertion failure:
Looks like a swift compiler issue. |
@swift-ci test windows |
@compnerd its only crashing in windows tho, is this something you can help with? |
I think that @xymus would be better able to help than I would. However, the last run seems to be failing differently:
|
@compnerd I think its because @MaxDesiatov forgot to include the LSP PR |
@swift-ci smoke test windows |
motivation: deprecate TSC, move to swift-system changes: * create AbsolutePath and RelativePath in SwiftPM, at this point just a wrapper for the TSC version. In next PR we will start refactoring them * remove all direct imports of TSBasic and replace them with data type specific imports to help migration * reduce sue of TSCTestSupport, stop exporting it from SPMTestSupport * update all call sites and tests
@swift-ci smoke test windows |
@swift-ci smoke test |
@swift-ci smoke test windows |
motivation: deprecate TSC, move to swift-system
changes: