From 78b4e7649c32d38582e9084b72965f318a933060 Mon Sep 17 00:00:00 2001 From: David Steinacher Date: Fri, 3 Nov 2023 10:30:51 +0100 Subject: [PATCH] do not break older Swift version support by creating a swift 5.9 explicit Package.swift file --- Package.swift | 9 +++--- Package@swift-5.9.swift | 66 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 Package@swift-5.9.swift diff --git a/Package.swift b/Package.swift index 0a2eebdd4..de40d97b5 100644 --- a/Package.swift +++ b/Package.swift @@ -1,10 +1,10 @@ -// swift-tools-version:5.9 +// swift-tools-version:5.7 import PackageDescription let package = Package( name: "Nimble", platforms: [ - .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1) + .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6) ], products: [ .library( @@ -19,8 +19,7 @@ let package = Package( ), ], dependencies: [ - // TODO: use official repo once merged - .package(url: "https://github.com/bitmovin-engineering/CwlPreconditionTesting.git", branch: "bitmovin/feature/visionos-support"), + .package(url: "https://github.com/mattgallagher/CwlPreconditionTesting.git", .upToNextMajor(from: "2.1.0")), ], targets: { var testHelperDependencies: [PackageDescription.Target.Dependency] = ["Nimble"] @@ -32,7 +31,7 @@ let package = Package( name: "Nimble", dependencies: [ .product(name: "CwlPreconditionTesting", package: "CwlPreconditionTesting", - condition: .when(platforms: [.macOS, .iOS, .macCatalyst, .visionOS])), + condition: .when(platforms: [.macOS, .iOS, .macCatalyst])), .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting", condition: .when(platforms: [.tvOS, .watchOS])) ], diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift new file mode 100644 index 000000000..0a2eebdd4 --- /dev/null +++ b/Package@swift-5.9.swift @@ -0,0 +1,66 @@ +// swift-tools-version:5.9 +import PackageDescription + +let package = Package( + name: "Nimble", + platforms: [ + .macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6), .visionOS(.v1) + ], + products: [ + .library( + name: "Nimble", + targets: { + var targets: [String] = ["Nimble"] + #if os(macOS) + targets.append("NimbleObjectiveC") + #endif + return targets + }() + ), + ], + dependencies: [ + // TODO: use official repo once merged + .package(url: "https://github.com/bitmovin-engineering/CwlPreconditionTesting.git", branch: "bitmovin/feature/visionos-support"), + ], + targets: { + var testHelperDependencies: [PackageDescription.Target.Dependency] = ["Nimble"] + #if os(macOS) + testHelperDependencies.append("NimbleObjectiveC") + #endif + var targets: [Target] = [ + .target( + name: "Nimble", + dependencies: [ + .product(name: "CwlPreconditionTesting", package: "CwlPreconditionTesting", + condition: .when(platforms: [.macOS, .iOS, .macCatalyst, .visionOS])), + .product(name: "CwlPosixPreconditionTesting", package: "CwlPreconditionTesting", + condition: .when(platforms: [.tvOS, .watchOS])) + ], + exclude: ["Info.plist"] + ), + .target( + name: "NimbleSharedTestHelpers", + dependencies: testHelperDependencies + ), + .testTarget( + name: "NimbleTests", + dependencies: ["Nimble", "NimbleSharedTestHelpers"], + exclude: ["Info.plist"] + ), + ] +#if os(macOS) + targets.append(contentsOf: [ + .target( + name: "NimbleObjectiveC", + dependencies: ["Nimble"] + ), + .testTarget( + name: "NimbleObjectiveCTests", + dependencies: ["NimbleObjectiveC", "Nimble", "NimbleSharedTestHelpers"] + ) + ]) + #endif + return targets + }(), + swiftLanguageVersions: [.v5] +)