Skip to content

Commit 6cf94c7

Browse files
authored
Drop availability checks for macOS 10.13 (#729)
As @rgoldberg points out, the bump to Swift 5.7 makes these availability checks unnecessary. Fixes #725.
1 parent 56d4248 commit 6cf94c7

File tree

4 files changed

+19
-43
lines changed

4 files changed

+19
-43
lines changed

Sources/ArgumentParser/Usage/DumpHelpGenerator.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ internal struct DumpHelpGenerator {
3131
func rendered() -> String {
3232
let encoder = JSONEncoder()
3333
encoder.outputFormatting = .prettyPrinted
34-
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
35-
encoder.outputFormatting.insert(.sortedKeys)
36-
}
34+
encoder.outputFormatting.insert(.sortedKeys)
3735
guard let encoded = try? encoder.encode(self.toolInfo) else { return "" }
3836
return String(data: encoded, encoding: .utf8) ?? ""
3937
}

Sources/ArgumentParserTestHelpers/TestHelpers.swift

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -350,25 +350,17 @@ extension XCTest {
350350

351351
#if !canImport(Darwin) || os(macOS)
352352
let process = Process()
353-
if #available(macOS 10.13, *) {
354-
process.executableURL = commandURL
355-
} else {
356-
process.launchPath = commandURL.path
357-
}
353+
process.executableURL = commandURL
358354
process.arguments = arguments
359355

360356
let output = Pipe()
361357
process.standardOutput = output
362358
let error = Pipe()
363359
process.standardError = error
364360

365-
if #available(macOS 10.13, *) {
366-
guard (try? process.run()) != nil else {
367-
XCTFail("Couldn't run command process.", file: file, line: line)
368-
return ""
369-
}
370-
} else {
371-
process.launch()
361+
guard (try? process.run()) != nil else {
362+
XCTFail("Couldn't run command process.", file: file, line: line)
363+
return ""
372364
}
373365
process.waitUntilExit()
374366

@@ -401,13 +393,11 @@ extension XCTest {
401393
actual: String, expected: String, for type: T.Type,
402394
file: StaticString = #filePath, line: UInt = #line
403395
) throws {
404-
if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) {
405-
AssertEqualStrings(
406-
actual: actual.trimmingCharacters(in: .whitespacesAndNewlines),
407-
expected: expected.trimmingCharacters(in: .whitespacesAndNewlines),
408-
file: file,
409-
line: line)
410-
}
396+
AssertEqualStrings(
397+
actual: actual.trimmingCharacters(in: .whitespacesAndNewlines),
398+
expected: expected.trimmingCharacters(in: .whitespacesAndNewlines),
399+
file: file,
400+
line: line)
411401

412402
let actualJSONData = try XCTUnwrap(
413403
actual.data(using: .utf8), file: file, line: line)

Tools/generate-docc-reference/Extensions/Process+SimpleAPI.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,10 @@ func executeCommand(
5050
process.standardOutput = output
5151
process.standardError = FileHandle.nullDevice
5252

53-
if #available(macOS 10.13, *) {
54-
do {
55-
try process.run()
56-
} catch {
57-
throw SubprocessError.failedToLaunch(error: error)
58-
}
59-
} else {
60-
process.launch()
53+
do {
54+
try process.run()
55+
} catch {
56+
throw SubprocessError.failedToLaunch(error: error)
6157
}
6258
let outputData = output.fileHandleForReading.readDataToEndOfFile()
6359
process.waitUntilExit()

Tools/generate-manual/Extensions/Process+SimpleAPI.swift

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,26 +47,18 @@ func executeCommand(
4747
}
4848

4949
let process = Process()
50-
if #available(macOS 10.13, *) {
51-
process.executableURL = executable
52-
} else {
53-
process.launchPath = executable.path
54-
}
50+
process.executableURL = executable
5551
process.arguments = arguments
5652

5753
let output = Pipe()
5854
process.standardOutput = output
5955
let error = Pipe()
6056
process.standardError = error
6157

62-
if #available(macOS 10.13, *) {
63-
do {
64-
try process.run()
65-
} catch {
66-
throw SubprocessError.failedToLaunch(error: error)
67-
}
68-
} else {
69-
process.launch()
58+
do {
59+
try process.run()
60+
} catch {
61+
throw SubprocessError.failedToLaunch(error: error)
7062
}
7163
let outputData = output.fileHandleForReading.readDataToEndOfFile()
7264
let errorData = error.fileHandleForReading.readDataToEndOfFile()

0 commit comments

Comments
 (0)