From a23d58144dcaa5040c115ee4ea082171bb07acac Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Wed, 30 Nov 2022 11:37:51 +0100 Subject: [PATCH] Bump package tools-version and fix deprecation warnings --- Package.swift | 23 +++++++++++------------ README.md | 6 +++--- Sources/ArenaCore/Dependency.swift | 6 +++--- Tests/ArenaTests/ArenaTests.swift | 8 ++++---- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Package.swift b/Package.swift index f939cd8..89b74bd 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.6 import PackageDescription @@ -12,20 +12,15 @@ let package = Package( .library(name: "ArenaCore", type: .dynamic, targets: ["ArenaCore"]) ], dependencies: [ - .package(name: "swift-argument-parser", - url: "https://github.com/apple/swift-argument-parser", from: "0.2.0"), + .package(url: "https://github.com/apple/swift-argument-parser", from: "0.2.0"), .package(url: "https://github.com/finestructure/Parser", from: "0.0.0"), .package(url: "https://github.com/JohnSundell/ShellOut.git", from: "2.0.0"), - .package(name: "Path.swift", - url: "https://github.com/mxcl/Path.swift.git", from: "1.0.0"), + .package(url: "https://github.com/mxcl/Path.swift.git", from: "1.0.0"), .package(url: "https://github.com/SwiftPackageIndex/SemanticVersion", from: "0.2.0"), - .package(name: "SnapshotTesting", - url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.7.2"), + .package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.7.2"), ], targets: [ - .target( - name: "ArenaCLI", - dependencies: ["ArenaCore"]), + .executableTarget(name: "ArenaCLI", dependencies: ["ArenaCore"]), .target( name: "ArenaCore", dependencies: [ @@ -33,10 +28,14 @@ let package = Package( "Parser", .product(name: "Path", package: "Path.swift"), "SemanticVersion", - "ShellOut"]), + "ShellOut"] + ), .testTarget( name: "ArenaTests", - dependencies: ["ArenaCore", "SnapshotTesting"], + dependencies: [ + "ArenaCore", + .product(name: "SnapshotTesting", package: "swift-snapshot-testing") + ], exclude: ["__Snapshots__"] ), ] diff --git a/README.md b/README.md index dc0a226..b600aee 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ In case you want to fetch a particular revision, range of revisions, or branch, - `https://github.com/finestructure/Gala@0.1.0` - → `.package(url: "https://github.com/finestructure/Gala", .exact("0.1.0"))` + → `.package(url: "https://github.com/finestructure/Gala", exact: "0.1.0")` - `https://github.com/finestructure/Gala@from:0.1.0` @@ -107,11 +107,11 @@ In case you want to fetch a particular revision, range of revisions, or branch, - `https://github.com/finestructure/Gala@branch:master` - → `.package(url: "https://github.com/finestructure/Gala", .branch("master"))` + → `.package(url: "https://github.com/finestructure/Gala", branch: "master")` - `https://github.com/finestructure/Gala@revision:7235531e92e71176dc31e77d6ff2b128a2602110` - → `.package(url: "https://github.com/finestructure/Gala", .revision("7235531e92e71176dc31e77d6ff2b128a2602110"))` + → `.package(url: "https://github.com/finestructure/Gala", revision: "7235531e92e71176dc31e77d6ff2b128a2602110")` Make sure to properly quote the URL if you are using the `..<` range operator. Otherwise your shell will interpret the `<` character as input redirection. diff --git a/Sources/ArenaCore/Dependency.swift b/Sources/ArenaCore/Dependency.swift index 9a04da2..cbee5c2 100644 --- a/Sources/ArenaCore/Dependency.swift +++ b/Sources/ArenaCore/Dependency.swift @@ -68,9 +68,9 @@ public struct Dependency: Equatable, Hashable, Codable { #endif switch requirement { case .branch(let b): - return #".package(\#(n)url: "\#(url.absoluteString)", .branch("\#(b)"))"# + return #".package(\#(n)url: "\#(url.absoluteString)", branch: "\#(b)")"# case .exact(let v): - return #".package(\#(n)url: "\#(url.absoluteString)", .exact("\#(v)"))"# + return #".package(\#(n)url: "\#(url.absoluteString)", exact: "\#(v)")"# case .from(let v): return #".package(\#(n)url: "\#(url.absoluteString)", from: "\#(v)")"# case .path: @@ -78,7 +78,7 @@ public struct Dependency: Equatable, Hashable, Codable { case .range(let r): return #".package(\#(n)url: "\#(url.absoluteString)", "\#(r.lowerBound)"..<"\#(r.upperBound)")"# case .revision(let r): - return #".package(\#(n)url: "\#(url.absoluteString)", .revision("\#(r)"))"# + return #".package(\#(n)url: "\#(url.absoluteString)", revision: "\#(r)")"# case .noVersion: return #".package(\#(n)url: "\#(url.absoluteString)", from: "0.0.0")"# } diff --git a/Tests/ArenaTests/ArenaTests.swift b/Tests/ArenaTests/ArenaTests.swift index 794e355..f3ce4f6 100644 --- a/Tests/ArenaTests/ArenaTests.swift +++ b/Tests/ArenaTests/ArenaTests.swift @@ -154,11 +154,11 @@ final class ArenaTests: XCTestCase { func test_dependency_package_clause() throws { do { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .branch("develop")) - XCTAssertEqual(dep.packageClause(), #".package(url: "https://github.com/foo/bar", .branch("develop"))"#) + XCTAssertEqual(dep.packageClause(), #".package(url: "https://github.com/foo/bar", branch: "develop")"#) } do { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .exact("1.2.3")) - XCTAssertEqual(dep.packageClause(), #".package(url: "https://github.com/foo/bar", .exact("1.2.3"))"#) + XCTAssertEqual(dep.packageClause(), #".package(url: "https://github.com/foo/bar", exact: "1.2.3")"#) } do { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .from("1.2.3")) @@ -170,7 +170,7 @@ final class ArenaTests: XCTestCase { } do { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .revision("foo")) - XCTAssertEqual(dep.packageClause(), #".package(url: "https://github.com/foo/bar", .revision("foo"))"#) + XCTAssertEqual(dep.packageClause(), #".package(url: "https://github.com/foo/bar", revision: "foo")"#) } do { let dep = Dependency(url: URL(string: "file:///foo/bar")!, requirement: .path) @@ -178,7 +178,7 @@ final class ArenaTests: XCTestCase { } do { let dep = Dependency(url: URL(string: "https://github.com/foo/bar")!, requirement: .revision("foo")) - XCTAssertEqual(dep.packageClause(name: "bar"), #".package(url: "https://github.com/foo/bar", .revision("foo"))"#) + XCTAssertEqual(dep.packageClause(name: "bar"), #".package(url: "https://github.com/foo/bar", revision: "foo")"#) } do { let dep = Dependency(url: URL(string: "file:///foo/bar")!, requirement: .path)