From 30a77772574d09f2e88ec5c2972438f331d5fff1 Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Thu, 27 Jun 2024 15:23:36 -0500 Subject: [PATCH 1/4] Updates to support Swift 6 language version Some minor NFC changes to resolve strict concurrency checking warnings/errors and the warning about the change in meaning for `#file`. --- .../GenerateManualPluginError.swift | 2 +- .../ArgumentParser/Utilities/Platform.swift | 5 +--- .../TestHelpers.swift | 28 +++++++++---------- .../AsyncCommandEndToEndTests.swift | 1 + .../NestedCommandEndToEndTests.swift | 2 +- .../SubcommandEndToEndTests.swift | 15 +++++----- .../TransformEndToEndTests.swift | 16 +++++------ .../ValidationEndToEndTests.swift | 4 +-- .../HelpTests.swift | 2 +- .../PackageManager/Config.swift | 2 +- .../CompletionScriptTests.swift | 2 +- .../DumpHelpGenerationTests.swift | 7 +---- .../HelpGenerationTests.swift | 8 +++--- .../NameSpecificationTests.swift | 4 +-- .../SplitArgumentTests.swift | 4 +-- Tests/ArgumentParserUnitTests/TreeTests.swift | 6 ++-- .../UsageGenerationTests.swift | 2 +- 17 files changed, 53 insertions(+), 57 deletions(-) diff --git a/Plugins/GenerateManual/GenerateManualPluginError.swift b/Plugins/GenerateManual/GenerateManualPluginError.swift index 43138d2b7..9a5ef9ac6 100644 --- a/Plugins/GenerateManual/GenerateManualPluginError.swift +++ b/Plugins/GenerateManual/GenerateManualPluginError.swift @@ -10,7 +10,7 @@ //===----------------------------------------------------------------------===// import Foundation -import PackagePlugin +@preconcurrency import PackagePlugin enum GenerateManualPluginError: Error { case unknownBuildConfiguration(String) diff --git a/Sources/ArgumentParser/Utilities/Platform.swift b/Sources/ArgumentParser/Utilities/Platform.swift index 20c5926d2..2cfd87530 100644 --- a/Sources/ArgumentParser/Utilities/Platform.swift +++ b/Sources/ArgumentParser/Utilities/Platform.swift @@ -13,10 +13,7 @@ extension CommandLine { /// Accesses the command line arguments in a concurrency-safe way. /// /// Workaround for https://github.com/apple/swift/issues/66213 - static let _staticArguments: [String] = - UnsafeBufferPointer(start: unsafeArgv, count: Int(argc)) - .compactMap { String(validatingUTF8: $0!) - } + static let _staticArguments: [String] = Self.arguments } #if canImport(Glibc) diff --git a/Sources/ArgumentParserTestHelpers/TestHelpers.swift b/Sources/ArgumentParserTestHelpers/TestHelpers.swift index fb3019f0e..85a60b852 100644 --- a/Sources/ArgumentParserTestHelpers/TestHelpers.swift +++ b/Sources/ArgumentParserTestHelpers/TestHelpers.swift @@ -77,7 +77,7 @@ extension XCTestExpectation { public func AssertResultFailure( _ expression: @autoclosure () -> Result, _ message: @autoclosure () -> String = "", - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line) { switch expression() { @@ -89,7 +89,7 @@ public func AssertResultFailure( } } -public func AssertErrorMessage(_ type: A.Type, _ arguments: [String], _ errorMessage: String, file: StaticString = #file, line: UInt = #line) where A: ParsableArguments { +public func AssertErrorMessage(_ type: A.Type, _ arguments: [String], _ errorMessage: String, file: StaticString = #filePath, line: UInt = #line) where A: ParsableArguments { do { _ = try A.parse(arguments) XCTFail("Parsing should have failed.", file: file, line: line) @@ -99,7 +99,7 @@ public func AssertErrorMessage(_ type: A.Type, _ arguments: [String], _ error } } -public func AssertFullErrorMessage(_ type: A.Type, _ arguments: [String], _ errorMessage: String, file: StaticString = #file, line: UInt = #line) where A: ParsableArguments { +public func AssertFullErrorMessage(_ type: A.Type, _ arguments: [String], _ errorMessage: String, file: StaticString = #filePath, line: UInt = #line) where A: ParsableArguments { do { _ = try A.parse(arguments) XCTFail("Parsing should have failed.", file: (file), line: line) @@ -109,7 +109,7 @@ public func AssertFullErrorMessage(_ type: A.Type, _ arguments: [String], _ e } } -public func AssertParse(_ type: A.Type, _ arguments: [String], file: StaticString = #file, line: UInt = #line, closure: (A) throws -> Void) where A: ParsableArguments { +public func AssertParse(_ type: A.Type, _ arguments: [String], file: StaticString = #filePath, line: UInt = #line, closure: (A) throws -> Void) where A: ParsableArguments { do { let parsed = try type.parse(arguments) try closure(parsed) @@ -119,7 +119,7 @@ public func AssertParse(_ type: A.Type, _ arguments: [String], file: StaticSt } } -public func AssertParseCommand(_ rootCommand: ParsableCommand.Type, _ type: A.Type, _ arguments: [String], file: StaticString = #file, line: UInt = #line, closure: (A) throws -> Void) { +public func AssertParseCommand(_ rootCommand: ParsableCommand.Type, _ type: A.Type, _ arguments: [String], file: StaticString = #filePath, line: UInt = #line, closure: (A) throws -> Void) { do { let command = try rootCommand.parseAsRoot(arguments) guard let aCommand = command as? A else { @@ -136,7 +136,7 @@ public func AssertParseCommand(_ rootCommand: ParsableComman public func AssertEqualStrings( actual: String, expected: String, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) { // If the input strings are not equal, create a simple diff for debugging... @@ -207,7 +207,7 @@ public func AssertHelp( for _: T.Type, columns: Int? = 80, equals expected: String, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) { let flag: String @@ -246,7 +246,7 @@ public func AssertHelp( root _: U.Type, columns: Int? = 80, equals expected: String, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) { let includeHidden: Bool @@ -271,7 +271,7 @@ public func AssertHelp( public func AssertDump( for _: T.Type, equals expected: String, - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) throws { do { _ = try T.parse(["--experimental-dump-help"]) @@ -284,7 +284,7 @@ public func AssertDump( try AssertJSONEqualFromString(actual: T._dumpHelp(), expected: expected, for: ToolInfoV0.self, file: file, line: line) } -public func AssertJSONEqualFromString(actual: String, expected: String, for type: T.Type, file: StaticString = #file, line: UInt = #line) throws { +public func AssertJSONEqualFromString(actual: String, expected: String, for type: T.Type, file: StaticString = #filePath, line: UInt = #line) throws { if #available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) { AssertEqualStrings(actual: actual, expected: expected, file: file, line: line) } @@ -309,7 +309,7 @@ extension XCTest { command: String, expected: String? = nil, exitCode: ExitCode = .success, - file: StaticString = #file, line: UInt = #line) throws + file: StaticString = #filePath, line: UInt = #line) throws { try AssertExecuteCommand( command: command.split(separator: " ").map(String.init), @@ -323,7 +323,7 @@ extension XCTest { command: [String], expected: String? = nil, exitCode: ExitCode = .success, - file: StaticString = #file, line: UInt = #line) throws + file: StaticString = #filePath, line: UInt = #line) throws { #if os(Windows) throw XCTSkip("Unsupported on this platform") @@ -385,7 +385,7 @@ extension XCTest { public func AssertJSONOutputEqual( command: String, expected: String, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) throws { #if os(Windows) @@ -439,7 +439,7 @@ extension XCTest { multiPage: Bool, command: String, expected: String, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) throws { #if os(Windows) diff --git a/Tests/ArgumentParserEndToEndTests/AsyncCommandEndToEndTests.swift b/Tests/ArgumentParserEndToEndTests/AsyncCommandEndToEndTests.swift index 52397ffa6..11177525a 100644 --- a/Tests/ArgumentParserEndToEndTests/AsyncCommandEndToEndTests.swift +++ b/Tests/ArgumentParserEndToEndTests/AsyncCommandEndToEndTests.swift @@ -32,6 +32,7 @@ actor AsyncStatusCheck { } } +@MainActor var statusCheck = AsyncStatusCheck() // MARK: AsyncParsableCommand.main() testing diff --git a/Tests/ArgumentParserEndToEndTests/NestedCommandEndToEndTests.swift b/Tests/ArgumentParserEndToEndTests/NestedCommandEndToEndTests.swift index e10154cef..e6e825cf1 100644 --- a/Tests/ArgumentParserEndToEndTests/NestedCommandEndToEndTests.swift +++ b/Tests/ArgumentParserEndToEndTests/NestedCommandEndToEndTests.swift @@ -54,7 +54,7 @@ fileprivate struct Foo: ParsableCommand { } } -fileprivate func AssertParseFooCommand(_ type: A.Type, _ arguments: [String], file: StaticString = #file, line: UInt = #line, closure: (A) throws -> Void) where A: ParsableCommand { +fileprivate func AssertParseFooCommand(_ type: A.Type, _ arguments: [String], file: StaticString = #filePath, line: UInt = #line, closure: (A) throws -> Void) where A: ParsableCommand { AssertParseCommand(Foo.self, type, arguments, file: file, line: line, closure: closure) } diff --git a/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift b/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift index 856ec6e93..50e315294 100644 --- a/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift +++ b/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift @@ -110,8 +110,6 @@ extension SubcommandEndToEndTests { } } -fileprivate var mathDidRun = false - fileprivate struct Math: ParsableCommand { enum Operation: String, ExpressibleByArgument { case add @@ -127,20 +125,23 @@ fileprivate struct Math: ParsableCommand { @Argument(help: "The first operand") var operands: [Int] = [] + var didRun = false + mutating func run() { XCTAssertEqual(operation, .multiply) XCTAssertTrue(verbose) XCTAssertEqual(operands, [5, 11]) - mathDidRun = true + didRun = true } } extension SubcommandEndToEndTests { + @MainActor func testParsing_SingleCommand() throws { - var mathCommand = try Math.parseAsRoot(["--operation", "multiply", "-v", "5", "11"]) - XCTAssertFalse(mathDidRun) - try mathCommand.run() - XCTAssertTrue(mathDidRun) + var mathCommand = try Math.parseAsRoot(["--operation", "multiply", "-v", "5", "11"]) as! Math + XCTAssertFalse(mathCommand.didRun) + mathCommand.run() + XCTAssertTrue(mathCommand.didRun) } } diff --git a/Tests/ArgumentParserEndToEndTests/TransformEndToEndTests.swift b/Tests/ArgumentParserEndToEndTests/TransformEndToEndTests.swift index 957eae5fe..75b8cb6fd 100644 --- a/Tests/ArgumentParserEndToEndTests/TransformEndToEndTests.swift +++ b/Tests/ArgumentParserEndToEndTests/TransformEndToEndTests.swift @@ -36,11 +36,11 @@ extension Convert { fileprivate struct FooOption: Convert, ParsableArguments { - static var usageString: String = """ + static let usageString: String = """ Usage: foo_option --string See 'foo_option --help' for more information. """ - static var help: String = "Help: --string Convert string to integer\n" + static let help: String = "Help: --string Convert string to integer\n" @Option(help: ArgumentHelp("Convert string to integer", valueName: "int_str"), transform: { try convert($0) }) @@ -49,11 +49,11 @@ fileprivate struct FooOption: Convert, ParsableArguments { fileprivate struct BarOption: Convert, ParsableCommand { - static var usageString: String = """ + static let usageString: String = """ Usage: bar-option [--strings ...] See 'bar-option --help' for more information. """ - static var help: String = "Help: --strings Convert a list of strings to an array of integers\n" + static let help: String = "Help: --strings Convert a list of strings to an array of integers\n" @Option(help: ArgumentHelp("Convert a list of strings to an array of integers", valueName: "int_str"), transform: { try convert($0) }) @@ -99,11 +99,11 @@ extension TransformEndToEndTests { fileprivate struct FooArgument: Convert, ParsableArguments { - static var usageString: String = """ + static let usageString: String = """ Usage: foo_argument See 'foo_argument --help' for more information. """ - static var help: String = "Help: Convert string to integer\n" + static let help: String = "Help: Convert string to integer\n" enum FooError: Error { case outOfBounds @@ -116,11 +116,11 @@ fileprivate struct FooArgument: Convert, ParsableArguments { fileprivate struct BarArgument: Convert, ParsableCommand { - static var usageString: String = """ + static let usageString: String = """ Usage: bar-argument [ ...] See 'bar-argument --help' for more information. """ - static var help: String = "Help: Convert a list of strings to an array of integers\n" + static let help: String = "Help: Convert a list of strings to an array of integers\n" @Argument(help: ArgumentHelp("Convert a list of strings to an array of integers", valueName: "int_str"), transform: { try convert($0) }) diff --git a/Tests/ArgumentParserEndToEndTests/ValidationEndToEndTests.swift b/Tests/ArgumentParserEndToEndTests/ValidationEndToEndTests.swift index b4222bc3c..a0d272c39 100644 --- a/Tests/ArgumentParserEndToEndTests/ValidationEndToEndTests.swift +++ b/Tests/ArgumentParserEndToEndTests/ValidationEndToEndTests.swift @@ -28,12 +28,12 @@ fileprivate enum UserValidationError: LocalizedError { } fileprivate struct Foo: ParsableArguments { - static var usageString: String = """ + static let usageString: String = """ Usage: foo [--count ] [ ...] [--version] [--throw] See 'foo --help' for more information. """ - static var helpString: String = """ + static let helpString: String = """ USAGE: foo [--count ] [ ...] [--version] [--throw] ARGUMENTS: diff --git a/Tests/ArgumentParserPackageManagerTests/HelpTests.swift b/Tests/ArgumentParserPackageManagerTests/HelpTests.swift index cb67aadb7..6ba46a3b3 100644 --- a/Tests/ArgumentParserPackageManagerTests/HelpTests.swift +++ b/Tests/ArgumentParserPackageManagerTests/HelpTests.swift @@ -168,7 +168,7 @@ struct Simple: ParsableArguments { @Option() var min: Int? @Argument() var max: Int - static var helpText = """ + static let helpText = """ USAGE: simple [--verbose] [--min ] ARGUMENTS: diff --git a/Tests/ArgumentParserPackageManagerTests/PackageManager/Config.swift b/Tests/ArgumentParserPackageManagerTests/PackageManager/Config.swift index 8d19a6d67..04d19eb55 100644 --- a/Tests/ArgumentParserPackageManagerTests/PackageManager/Config.swift +++ b/Tests/ArgumentParserPackageManagerTests/PackageManager/Config.swift @@ -17,7 +17,7 @@ extension Package { } extension Package.Config { - public static var configuration = CommandConfiguration( + public static let configuration = CommandConfiguration( subcommands: [GetMirror.self, SetMirror.self, UnsetMirror.self]) /// Print mirror configuration for the given package dependency diff --git a/Tests/ArgumentParserUnitTests/CompletionScriptTests.swift b/Tests/ArgumentParserUnitTests/CompletionScriptTests.swift index 5a8d8dfe7..44e66d5f3 100644 --- a/Tests/ArgumentParserUnitTests/CompletionScriptTests.swift +++ b/Tests/ArgumentParserUnitTests/CompletionScriptTests.swift @@ -116,7 +116,7 @@ extension CompletionScriptTests { func verifyCustomOutput( _ arg: String, expectedOutput: String, - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) throws { do { _ = try Custom.parse(["---completion", "--", arg]) diff --git a/Tests/ArgumentParserUnitTests/DumpHelpGenerationTests.swift b/Tests/ArgumentParserUnitTests/DumpHelpGenerationTests.swift index 234d1050c..5b6141948 100644 --- a/Tests/ArgumentParserUnitTests/DumpHelpGenerationTests.swift +++ b/Tests/ArgumentParserUnitTests/DumpHelpGenerationTests.swift @@ -12,12 +12,7 @@ import XCTest import ArgumentParserTestHelpers @testable import ArgumentParser -final class DumpHelpGenerationTests: XCTestCase { - public static let allTests = [ - ("testDumpExampleCommands", testDumpExampleCommands), - ("testDumpA", testDumpA) - ] -} +final class DumpHelpGenerationTests: XCTestCase {} extension DumpHelpGenerationTests { struct A: ParsableCommand { diff --git a/Tests/ArgumentParserUnitTests/HelpGenerationTests.swift b/Tests/ArgumentParserUnitTests/HelpGenerationTests.swift index 19d29f14f..e7a4f0408 100644 --- a/Tests/ArgumentParserUnitTests/HelpGenerationTests.swift +++ b/Tests/ArgumentParserUnitTests/HelpGenerationTests.swift @@ -283,10 +283,10 @@ extension HelpGenerationTests { struct H: ParsableCommand { struct CommandWithVeryLongName: ParsableCommand {} struct ShortCommand: ParsableCommand { - static var configuration: CommandConfiguration = CommandConfiguration(abstract: "Test short command name.") + static let configuration: CommandConfiguration = CommandConfiguration(abstract: "Test short command name.") } struct AnotherCommandWithVeryLongName: ParsableCommand { - static var configuration: CommandConfiguration = CommandConfiguration(abstract: "Test long command name.") + static let configuration: CommandConfiguration = CommandConfiguration(abstract: "Test long command name.") } struct AnotherCommand: ParsableCommand { @Option() @@ -474,7 +474,7 @@ extension HelpGenerationTests { } struct Foo: ParsableCommand { - public static var configuration = CommandConfiguration( + public static let configuration = CommandConfiguration( commandName: "foo", abstract: "Perform some foo", subcommands: [ @@ -681,7 +681,7 @@ extension HelpGenerationTests { struct AllValues: ParsableCommand { enum Manual: Int, ExpressibleByArgument { case foo - static var allValueStrings = ["bar"] + static let allValueStrings = ["bar"] } enum UnspecializedSynthesized: Int, CaseIterable, ExpressibleByArgument { diff --git a/Tests/ArgumentParserUnitTests/NameSpecificationTests.swift b/Tests/ArgumentParserUnitTests/NameSpecificationTests.swift index 328b77afb..7f5c075a2 100644 --- a/Tests/ArgumentParserUnitTests/NameSpecificationTests.swift +++ b/Tests/ArgumentParserUnitTests/NameSpecificationTests.swift @@ -42,12 +42,12 @@ extension NameSpecificationTests { } } -fileprivate func Assert(nameSpecification: NameSpecification, key: String, parent: InputKey? = nil, makeNames expected: [Name], file: StaticString = #file, line: UInt = #line) { +fileprivate func Assert(nameSpecification: NameSpecification, key: String, parent: InputKey? = nil, makeNames expected: [Name], file: StaticString = #filePath, line: UInt = #line) { let names = nameSpecification.makeNames(InputKey(name: key, parent: parent)) Assert(names: names, expected: expected, file: file, line: line) } -fileprivate func Assert(names: [N], expected: [N], file: StaticString = #file, line: UInt = #line) where N: Equatable { +fileprivate func Assert(names: [N], expected: [N], file: StaticString = #filePath, line: UInt = #line) where N: Equatable { names.forEach { XCTAssert(expected.contains($0), "Unexpected name '\($0)'.", file: (file), line: line) } diff --git a/Tests/ArgumentParserUnitTests/SplitArgumentTests.swift b/Tests/ArgumentParserUnitTests/SplitArgumentTests.swift index ffd61613a..f40531003 100644 --- a/Tests/ArgumentParserUnitTests/SplitArgumentTests.swift +++ b/Tests/ArgumentParserUnitTests/SplitArgumentTests.swift @@ -19,7 +19,7 @@ extension ArgumentParser.SplitArguments.InputIndex: Swift.ExpressibleByIntegerLi } } -private func AssertIndexEqual(_ sut: SplitArguments, at index: Int, inputIndex: Int, subIndex: SplitArguments.SubIndex, file: StaticString = #file, line: UInt = #line) { +private func AssertIndexEqual(_ sut: SplitArguments, at index: Int, inputIndex: Int, subIndex: SplitArguments.SubIndex, file: StaticString = #filePath, line: UInt = #line) { guard index < sut.elements.endIndex else { XCTFail("Element index \(index) is out of range. sur only has \(sut.elements.count) elements.", file: (file), line: line) return @@ -34,7 +34,7 @@ private func AssertIndexEqual(_ sut: SplitArguments, at index: Int, inputIndex: } } -private func AssertElementEqual(_ sut: SplitArguments, at index: Int, _ element: SplitArguments.Element.Value, file: StaticString = #file, line: UInt = #line) { +private func AssertElementEqual(_ sut: SplitArguments, at index: Int, _ element: SplitArguments.Element.Value, file: StaticString = #filePath, line: UInt = #line) { guard index < sut.elements.endIndex else { XCTFail("Element index \(index) is out of range. sur only has \(sut.elements.count) elements.", file: (file), line: line) return diff --git a/Tests/ArgumentParserUnitTests/TreeTests.swift b/Tests/ArgumentParserUnitTests/TreeTests.swift index 346561595..2426ea151 100644 --- a/Tests/ArgumentParserUnitTests/TreeTests.swift +++ b/Tests/ArgumentParserUnitTests/TreeTests.swift @@ -17,7 +17,7 @@ final class TreeTests: XCTestCase { // MARK: - -let tree: Tree = { +func generateTree() -> Tree { let tree = Tree(1) for x in 11...13 { let node = Tree(x) @@ -28,10 +28,11 @@ let tree: Tree = { } } return tree -}() +} extension TreeTests { func testHierarchy() { + let tree = generateTree() XCTAssertEqual(tree.element, 1) XCTAssertEqual(tree.children.map { $0.element }, [11, 12, 13]) XCTAssertEqual( @@ -40,6 +41,7 @@ extension TreeTests { } func testSearch() { + let tree = generateTree() XCTAssertEqual( tree.path(toFirstWhere: { $0 == 1 }).map { $0.element }, [1]) diff --git a/Tests/ArgumentParserUnitTests/UsageGenerationTests.swift b/Tests/ArgumentParserUnitTests/UsageGenerationTests.swift index 22baf2fdc..991963397 100644 --- a/Tests/ArgumentParserUnitTests/UsageGenerationTests.swift +++ b/Tests/ArgumentParserUnitTests/UsageGenerationTests.swift @@ -19,7 +19,7 @@ func _testSynopsis( _ type: T.Type, visibility: ArgumentVisibility = .default, expected: String, - file: StaticString = #file, + file: StaticString = #filePath, line: UInt = #line ) { let help = UsageGenerator(toolName: "example", parsable: T(), visibility: visibility, parent: nil) From 4d1bddcfd6ca1a60a7d3fbf707145cdde4a3de08 Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Thu, 27 Jun 2024 15:38:06 -0500 Subject: [PATCH 2/4] Two more warnings fixes --- Plugins/GenerateManual/GenerateManualPluginError.swift | 4 ++++ .../ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Plugins/GenerateManual/GenerateManualPluginError.swift b/Plugins/GenerateManual/GenerateManualPluginError.swift index 9a5ef9ac6..851a9b484 100644 --- a/Plugins/GenerateManual/GenerateManualPluginError.swift +++ b/Plugins/GenerateManual/GenerateManualPluginError.swift @@ -10,7 +10,11 @@ //===----------------------------------------------------------------------===// import Foundation +#if swift(>=6) @preconcurrency import PackagePlugin +#else +import PackagePlugin +#endif enum GenerateManualPluginError: Error { case unknownBuildConfiguration(String) diff --git a/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift b/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift index 50e315294..2dafd6e4b 100644 --- a/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift +++ b/Tests/ArgumentParserEndToEndTests/SubcommandEndToEndTests.swift @@ -136,7 +136,6 @@ fileprivate struct Math: ParsableCommand { } extension SubcommandEndToEndTests { - @MainActor func testParsing_SingleCommand() throws { var mathCommand = try Math.parseAsRoot(["--operation", "multiply", "-v", "5", "11"]) as! Math XCTAssertFalse(mathCommand.didRun) From 707c3ed1345386aadeb829ce65f7265aeeca39b5 Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Fri, 28 Jun 2024 11:51:18 -0500 Subject: [PATCH 3/4] Mark non-Darwin platforms as preconcurrency --- Sources/ArgumentParser/Utilities/Platform.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ArgumentParser/Utilities/Platform.swift b/Sources/ArgumentParser/Utilities/Platform.swift index 2cfd87530..a3593ccf4 100644 --- a/Sources/ArgumentParser/Utilities/Platform.swift +++ b/Sources/ArgumentParser/Utilities/Platform.swift @@ -17,15 +17,15 @@ extension CommandLine { } #if canImport(Glibc) -import Glibc +@preconcurrency import Glibc #elseif canImport(Musl) -import Musl +@preconcurrency import Musl #elseif canImport(Darwin) import Darwin #elseif canImport(CRT) -import CRT +@preconcurrency import CRT #elseif canImport(WASILibc) -import WASILibc +@preconcurrency import WASILibc #endif enum Platform {} From 52af7d93b175f53a88fa0df756775b8588bcb55a Mon Sep 17 00:00:00 2001 From: Nate Cook Date: Mon, 15 Jul 2024 16:05:55 -0500 Subject: [PATCH 4/4] Revert changes around PackagePlugin import --- Plugins/GenerateManual/GenerateManualPluginError.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Plugins/GenerateManual/GenerateManualPluginError.swift b/Plugins/GenerateManual/GenerateManualPluginError.swift index 851a9b484..43138d2b7 100644 --- a/Plugins/GenerateManual/GenerateManualPluginError.swift +++ b/Plugins/GenerateManual/GenerateManualPluginError.swift @@ -10,11 +10,7 @@ //===----------------------------------------------------------------------===// import Foundation -#if swift(>=6) -@preconcurrency import PackagePlugin -#else import PackagePlugin -#endif enum GenerateManualPluginError: Error { case unknownBuildConfiguration(String)