From 18e639cd8d0b7817781770681c33d258f208e3fb Mon Sep 17 00:00:00 2001 From: Steven Lambion Date: Fri, 20 Sep 2019 18:28:37 -0700 Subject: [PATCH 1/4] Update toolchain to 5.1 --- .swift-version | 2 +- Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.swift-version b/.swift-version index bf77d54..8336407 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -4.2 +5.1 \ No newline at end of file diff --git a/Package.swift b/Package.swift index 90d07ca..83a33db 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:4.2 +// swift-tools-version:5.1 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription From 278750249739944b629787212091b64d41a7aa2a Mon Sep 17 00:00:00 2001 From: Steven Lambion Date: Fri, 20 Sep 2019 18:34:09 -0700 Subject: [PATCH 2/4] Update default swift version to 5.1 --- Sources/PackageConfig/Package.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/PackageConfig/Package.swift b/Sources/PackageConfig/Package.swift index aed318f..e88a30e 100644 --- a/Sources/PackageConfig/Package.swift +++ b/Sources/PackageConfig/Package.swift @@ -35,19 +35,19 @@ enum Package { static private func runXCRun(tool: String) throws -> String { let process = Process() let pipe = Pipe() - + process.launchPath = "/usr/bin/xcrun" process.arguments = ["--find", tool] process.standardOutput = pipe - + debugLog("CMD: \(process.launchPath!) \( ["--find", tool].joined(separator: " "))") - + process.launch() process.waitUntilExit() return String(data: pipe.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8)! .trimmingCharacters(in: .whitespacesAndNewlines) } - + private static func findPath(tool: String) throws -> String { let process = Process() let pipe = Pipe() @@ -150,7 +150,7 @@ enum Package { } return "4_2" default: - return "5" + return "5_1" } } } From f1210524a95758996489e918ae38c395c0cc3cfe Mon Sep 17 00:00:00 2001 From: Leo Dion Date: Mon, 25 May 2020 13:27:37 -0400 Subject: [PATCH 3/4] added support for swift 5.2+ --- Sources/PackageConfig/Package.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/PackageConfig/Package.swift b/Sources/PackageConfig/Package.swift index a21b99d..f35efdb 100644 --- a/Sources/PackageConfig/Package.swift +++ b/Sources/PackageConfig/Package.swift @@ -124,10 +124,11 @@ enum Package { spmVersionDir = swiftToolsVersion } + let packageDescriptionVersion = swiftToolsVersion?.replacingOccurrences(of: "_", with: ".") let libraryPathSPM = swiftPMDir + "/" + spmVersionDir debugLog("Using SPM version: \(libraryPathSPM)") - return ["-L", libraryPathSPM, "-I", libraryPathSPM, "-lPackageDescription", "-package-description-version", swiftToolsVersion ?? "5"] + return ["-L", libraryPathSPM, "-I", libraryPathSPM, "-lPackageDescription", "-package-description-version", packageDescriptionVersion ?? "5.2"] } private static func getSwiftToolsVersion() -> String? { @@ -136,7 +137,7 @@ enum Package { } let range = NSRange(location: 0, length: contents.count) - guard let regex = try? NSRegularExpression(pattern: "^// swift-tools-version:(?:(\\d)\\.(\\d)(?:\\.\\d)?)$"), + guard let regex = try? NSRegularExpression(pattern: "^// swift-tools-version:(?:(\\d)\\.(\\d)(?:\\.\\d)?)"), let match = regex.firstMatch(in: contents, options: [], range: range), let majorRange = Range(match.range(at: 1), in: contents), let major = Int(contents[majorRange]), let minorRange = Range(match.range(at: 2), in: contents), let minor = Int(contents[minorRange]) @@ -151,7 +152,7 @@ enum Package { } return "4_2" default: - return "5_1" + return "\(major)_\(minor)" } } } From 0177184c5f3f2dfce1c80bccd8d6c1732fd5d6f0 Mon Sep 17 00:00:00 2001 From: leogdion Date: Wed, 27 May 2020 14:15:56 -0400 Subject: [PATCH 4/4] adding back support Swift 4.2 * Update .swift-version * Update Package.swift --- .swift-version | 2 +- Package.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.swift-version b/.swift-version index 8336407..bf77d54 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.1 \ No newline at end of file +4.2 diff --git a/Package.swift b/Package.swift index 83a33db..90d07ca 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.1 +// swift-tools-version:4.2 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription