From 6bb168782c8010cc1ef01fbaa14a56f94984836f Mon Sep 17 00:00:00 2001 From: Jorge Revuelta Herrero Date: Fri, 10 Dec 2021 14:37:24 +0100 Subject: [PATCH 1/3] Fix issue with compiler vs swift --- Sources/PackageConfig/Package.swift | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Sources/PackageConfig/Package.swift b/Sources/PackageConfig/Package.swift index d400edd..34e126e 100644 --- a/Sources/PackageConfig/Package.swift +++ b/Sources/PackageConfig/Package.swift @@ -163,24 +163,26 @@ enum Package { // /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/4_2 let fileManager = FileManager.default let swiftPMDir = swiftPath.replacingOccurrences(of: "bin/swiftc", with: "lib/swift/pm") - #if swift(<5.5.2) + let swiftToolsVersion = getSwiftToolsVersion() + #if compiler(>=5.5.2) + debugLog("MORE 5.5.2") + // Since Swift 5.5.2 there're no more different versions installed in the toolchain and it is stored + // in another directory + let directory = try! fileManager.contentsOfDirectory(atPath: swiftPMDir) + .first(where: { $0.starts(with: "Manifest") }) + let spmManifestDir = directory! + #else + debugLog("LESS 5.5.2") let versions = try! fileManager.contentsOfDirectory(atPath: swiftPMDir) .filter { $0 != "llbuild" } .filter { $0.first?.isNumber ?? false } let latestVersion = versions.sorted().last! var spmManifestDir = latestVersion - let swiftToolsVersion = getSwiftToolsVersion() if let swiftToolsVersion = swiftToolsVersion, versions.contains(swiftToolsVersion) { spmManifestDir = swiftToolsVersion } - #else - // Since Swift 5.5.2 there're no more different versions installed in the toolchain and it is stored - // in another directory - let directory = try! fileManager.contentsOfDirectory(atPath: swiftPMDir) - .first(where: { $0.starts(with: "Manifest") }) - let spmManifestDir = swiftPMDir + "/" + directory! #endif From de908a94a1fbf03379dfc29ca32d6942b54084ef Mon Sep 17 00:00:00 2001 From: Jorge Revuelta Date: Fri, 10 Dec 2021 15:33:09 +0100 Subject: [PATCH 2/3] Update Sources/PackageConfig/Package.swift --- Sources/PackageConfig/Package.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/PackageConfig/Package.swift b/Sources/PackageConfig/Package.swift index 34e126e..0d00e03 100644 --- a/Sources/PackageConfig/Package.swift +++ b/Sources/PackageConfig/Package.swift @@ -165,7 +165,6 @@ enum Package { let swiftPMDir = swiftPath.replacingOccurrences(of: "bin/swiftc", with: "lib/swift/pm") let swiftToolsVersion = getSwiftToolsVersion() #if compiler(>=5.5.2) - debugLog("MORE 5.5.2") // Since Swift 5.5.2 there're no more different versions installed in the toolchain and it is stored // in another directory let directory = try! fileManager.contentsOfDirectory(atPath: swiftPMDir) From 35f0d4e4ebecdc954727462dc52622167b5067bd Mon Sep 17 00:00:00 2001 From: Jorge Revuelta Date: Fri, 10 Dec 2021 15:33:27 +0100 Subject: [PATCH 3/3] Update Sources/PackageConfig/Package.swift --- Sources/PackageConfig/Package.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/PackageConfig/Package.swift b/Sources/PackageConfig/Package.swift index 0d00e03..01955ab 100644 --- a/Sources/PackageConfig/Package.swift +++ b/Sources/PackageConfig/Package.swift @@ -171,7 +171,6 @@ enum Package { .first(where: { $0.starts(with: "Manifest") }) let spmManifestDir = directory! #else - debugLog("LESS 5.5.2") let versions = try! fileManager.contentsOfDirectory(atPath: swiftPMDir) .filter { $0 != "llbuild" } .filter { $0.first?.isNumber ?? false }