Skip to content
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

Bump github.com/mxcl/path.swift from 0.16.3 to 1.4.1 and fix compilations #345

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ jobs:
- uses: actions/checkout@v4
- name: Run tests
env:
DEVELOPER_DIR: /Applications/Xcode_13.4.1.app
DEVELOPER_DIR: /Applications/Xcode_14.2.app
run: swift test
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mxcl/Path.swift.git",
"state" : {
"revision" : "dac007e907a4f4c565cfdc55a9ce148a761a11d5",
"version" : "0.16.3"
"revision" : "8e355c28e9393c42e58b18c54cace2c42c98a616",
"version" : "1.4.1"
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.6
// swift-tools-version:5.7
import PackageDescription

let package = Package(
Expand All @@ -13,7 +13,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.1.4")),
.package(url: "https://github.com/mxcl/Path.swift.git", .upToNextMinor(from: "0.16.0")),
.package(url: "https://github.com/mxcl/Path.swift.git", .upToNextMinor(from: "1.4.1")),
.package(url: "https://github.com/mxcl/Version.git", .upToNextMinor(from: "1.0.3")),
.package(url: "https://github.com/mxcl/PromiseKit.git", .upToNextMinor(from: "6.22.1")),
.package(url: "https://github.com/PromiseKit/Foundation.git", .upToNextMinor(from: "3.4.0")),
Expand Down
10 changes: 5 additions & 5 deletions Sources/XcodesKit/Entry+.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import Foundation
import Path

extension Entry {
extension Path {
var isAppBundle: Bool {
kind == .directory &&
path.extension == "app" &&
!path.isSymlink
type == .directory &&
`extension` == "app" &&
!isSymlink
}

var infoPlist: InfoPlist? {
let infoPlistPath = path.join("Contents").join("Info.plist")
let infoPlistPath = join("Contents").join("Info.plist")
guard
let infoPlistData = try? Data(contentsOf: infoPlistPath.url),
let infoPlist = try? PropertyListDecoder().decode(InfoPlist.self, from: infoPlistData)
Expand Down
3 changes: 1 addition & 2 deletions Sources/XcodesKit/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,8 @@ public struct Files {
public var contentsOfDirectory: (URL) throws -> [URL] = { try FileManager.default.contentsOfDirectory(at: $0, includingPropertiesForKeys: nil, options: []) }

public var installedXcodes: (Path) -> [InstalledXcode] = { directory in
return ((try? directory.ls()) ?? [])
return directory.ls()
.filter { $0.isAppBundle && $0.infoPlist?.bundleID == "com.apple.dt.Xcode" }
.map { $0.path }
.compactMap(InstalledXcode.init)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodesKit/Path+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation

extension Path {
// Get Home even if we are running as root
static let environmentHome = ProcessInfo.processInfo.environment["HOME"].flatMap(Path.init) ?? .home
static let environmentHome = ProcessInfo.processInfo.environment["HOME"].flatMap(Path.init) ?? Path(Path.home)
static let environmentApplicationSupport = environmentHome/"Library/Application Support"
static let environmentCaches = environmentHome/"Library/Caches"
public static let environmentDownloads = environmentHome/"Downloads"
Expand Down
4 changes: 2 additions & 2 deletions Sources/XcodesKit/Process.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public typealias ProcessOutput = (status: Int32, out: String, err: String)

extension Process {
@discardableResult
static func sudo(password: String? = nil, _ executable: Path, workingDirectory: URL? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
static func sudo(password: String? = nil, _ executable: some Pathish, workingDirectory: URL? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
var arguments = [executable.string] + arguments
if password != nil {
arguments.insert("-S", at: 0)
Expand All @@ -16,7 +16,7 @@ extension Process {
}

@discardableResult
static func run(_ executable: Path, workingDirectory: URL? = nil, input: String? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
static func run(_ executable: some Pathish, workingDirectory: URL? = nil, input: String? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
return run(executable.url, workingDirectory: workingDirectory, input: input, arguments)
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodesKit/RuntimeInstaller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public class RuntimeInstaller {
// 1-Mount DMG and get the mounted path
let mountedUrl = try await mountDMG(dmgUrl: dmgUrl)
// 2-Get the first path under the mounted path, should be a .pkg
let pkgPath = try! Path(url: mountedUrl)!.ls().first!.path
let pkgPath = Path(url: mountedUrl)!.ls().first!
// 3-Create a caches directory (if it doesn't exist), and
// 4-Set its ownership to the current user (important because under sudo it would be owned by root)
try Path.xcodesCaches.mkdir().setCurrentUserAsOwner()
Expand Down
2 changes: 1 addition & 1 deletion Sources/XcodesKit/Version+Xcode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public extension Version {
}

/// Attempt to instatiate a `Version` using the `.xcode-version` file in the provided directory
static func fromXcodeVersionFile(inDirectory: Path = Path.cwd) -> Version? {
static func fromXcodeVersionFile(inDirectory: some Pathish = Path.cwd) -> Version? {
let xcodeVersionFilePath = inDirectory.join(".xcode-version")
guard
Current.files.fileExists(atPath: xcodeVersionFilePath.string),
Expand Down