Skip to content

Commit 92652d9

Browse files
authored
Move release 1.0 to swift 6.1 (#305)
* Move release 1.0 to swift 6.1 * Update swift version check regexes in build script to work with swift at no minor version
1 parent 92515c9 commit 92652d9

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.0.3
1+
6.1.0

Tools/build-swiftly-release/BuildSwiftlyRelease.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public func runProgramOutput(_ program: String, _ args: String...) async throws
103103
throw Error(message: "\(args.first!) exited with non-zero status: \(process.terminationStatus)")
104104
}
105105

106-
if let outData = outData {
106+
if let outData {
107107
return String(data: outData, encoding: .utf8)
108108
} else {
109109
return nil
@@ -203,7 +203,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
203203

204204
if FileManager.default.fileExists(atPath: svFile.path) {
205205
let selector = try? String(contentsOf: svFile, encoding: .utf8)
206-
if let selector = selector {
206+
if let selector {
207207
return selector.replacingOccurrences(of: "\n", with: "")
208208
}
209209
return selector
@@ -220,10 +220,14 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
220220
return try await self.assertTool("swift", message: "Please install swift and make sure that it is added to your path.")
221221
}
222222

223-
guard let requiredSwiftVersion = try? self.findSwiftVersion() else {
223+
guard var requiredSwiftVersion = try? self.findSwiftVersion() else {
224224
throw Error(message: "Unable to determine the required swift version for this version of swiftly. Please make sure that you `cd <swiftly_git_dir>` and there is a .swift-version file there.")
225225
}
226226

227+
if requiredSwiftVersion.hasSuffix(".0") {
228+
requiredSwiftVersion = String(requiredSwiftVersion.dropLast(2))
229+
}
230+
227231
let swift = try await self.assertTool("swift", message: "Please install swift \(requiredSwiftVersion) and make sure that it is added to your path.")
228232

229233
// We also need a swift toolchain with the correct version
@@ -287,7 +291,7 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
287291
try? FileManager.default.createDirectory(atPath: pkgConfigPath, withIntermediateDirectories: true)
288292

289293
try? FileManager.default.removeItem(atPath: libArchivePath)
290-
try runProgram(curl, "-o", "\(buildCheckoutsDir + "/libarchive-\(libArchiveVersion).tar.gz")", "--remote-name", "--location", "https://github.com/libarchive/libarchive/releases/download/v\(libArchiveVersion)/libarchive-\(libArchiveVersion).tar.gz")
294+
try runProgram(curl, "-L", "-o", "\(buildCheckoutsDir + "/libarchive-\(libArchiveVersion).tar.gz")", "--remote-name", "--location", "https://github.com/libarchive/libarchive/releases/download/v\(libArchiveVersion)/libarchive-\(libArchiveVersion).tar.gz")
291295
let libArchiveTarShaActual = try await runProgramOutput(sha256sum, "\(buildCheckoutsDir)/libarchive-\(libArchiveVersion).tar.gz")
292296
guard let libArchiveTarShaActual, libArchiveTarShaActual.starts(with: libArchiveTarSha) else {
293297
let shaActual = libArchiveTarShaActual ?? "none"
@@ -298,7 +302,8 @@ struct BuildSwiftlyRelease: AsyncParsableCommand {
298302
let cwd = FileManager.default.currentDirectoryPath
299303
FileManager.default.changeCurrentDirectoryPath(libArchivePath)
300304

301-
let swiftVerRegex: Regex<(Substring, Substring)> = try! Regex("Swift version (\\d+\\.\\d+\\.\\d+) ")
305+
let swiftVerRegex: Regex<(Substring, Substring)> = try! Regex("Swift version (\\d+\\.\\d+\\.?\\d*) ")
306+
302307
let swiftVerOutput = (try await runProgramOutput(swift, "--version")) ?? ""
303308
guard let swiftVerMatch = try swiftVerRegex.firstMatch(in: swiftVerOutput) else {
304309
throw Error(message: "Unable to detect swift version")

0 commit comments

Comments
 (0)