From fffd4e4bb8384444a9dad5748dcd59f5bf1c4de1 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 7 Nov 2020 17:23:03 +0900 Subject: [PATCH 1/3] Use target dependency condition instead of building environment info --- Package.swift | 18 +++++++----------- Package@swift-5.2.swift | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 Package@swift-5.2.swift diff --git a/Package.swift b/Package.swift index f4d666920..8f8ac80ae 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.3 import PackageDescription let package = Package( @@ -15,16 +15,12 @@ let package = Package( targets: [ .target( name: "Nimble", - dependencies: { - #if os(macOS) - return [ - "CwlPreconditionTesting", - .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting") - ] - #else - return [] - #endif - }() + dependencies: [ + .product(name: "CwlPreconditionTesting", package: "CwlPreconditionTesting", + condition: .when(platforms: [.macOS])), + .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting", + condition: .when(platforms: [.macOS])) + ] ), .testTarget( name: "NimbleTests", diff --git a/Package@swift-5.2.swift b/Package@swift-5.2.swift new file mode 100644 index 000000000..f4d666920 --- /dev/null +++ b/Package@swift-5.2.swift @@ -0,0 +1,36 @@ +// swift-tools-version:5.2 +import PackageDescription + +let package = Package( + name: "Nimble", + platforms: [ + .macOS(.v10_10), .iOS(.v9), .tvOS(.v9) + ], + products: [ + .library(name: "Nimble", targets: ["Nimble"]), + ], + dependencies: [ + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", .upToNextMajor(from: "2.0.0")), + ], + targets: [ + .target( + name: "Nimble", + dependencies: { + #if os(macOS) + return [ + "CwlPreconditionTesting", + .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting") + ] + #else + return [] + #endif + }() + ), + .testTarget( + name: "NimbleTests", + dependencies: ["Nimble"], + exclude: ["objc"] + ), + ], + swiftLanguageVersions: [.v5] +) From cb4621018fbf91eea7dac722d6f1143c4ab61102 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 7 Nov 2020 17:45:40 +0900 Subject: [PATCH 2/3] Add missing Darwin platforms --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 8f8ac80ae..1f4b2abf2 100644 --- a/Package.swift +++ b/Package.swift @@ -17,9 +17,9 @@ let package = Package( name: "Nimble", dependencies: [ .product(name: "CwlPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.macOS])), + condition: .when(platforms: [.macOS, .iOS, .tvOS])), .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.macOS])) + condition: .when(platforms: [.macOS, .iOS, .tvOS])) ] ), .testTarget( From 94c416fede35410e259d2580dce4579736e8934c Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sat, 24 Apr 2021 18:55:27 +0900 Subject: [PATCH 3/3] Update platform condition in Package.swift - CwlPreconditionTesting is used on macOS and iOS - CwlPosixPreconditionTesting is used on tvOS Co-authored-by: IKEDA Sho --- Package.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 1f4b2abf2..811014a69 100644 --- a/Package.swift +++ b/Package.swift @@ -17,9 +17,9 @@ let package = Package( name: "Nimble", dependencies: [ .product(name: "CwlPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.macOS, .iOS, .tvOS])), + condition: .when(platforms: [.macOS, .iOS])), .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.macOS, .iOS, .tvOS])) + condition: .when(platforms: [.tvOS])) ] ), .testTarget(