From 39e60d10b6f28e8b74b933c970e11f5dafd38442 Mon Sep 17 00:00:00 2001
From: Christopher Fuller <christopher.fuller@gotinder.com>
Date: Fri, 16 Feb 2024 11:37:49 -0800
Subject: [PATCH] Add Swift 5.9 package manifest

---
 Package.swift           | 48 +-----------------------
 Package@swift-5.9.swift | 82 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 46 deletions(-)
 create mode 100644 Package@swift-5.9.swift

diff --git a/Package.swift b/Package.swift
index 8cf7dbff..3ee28af4 100644
--- a/Package.swift
+++ b/Package.swift
@@ -2,15 +2,8 @@
 
 import PackageDescription
 
-let packageName = "Layout"
-
-enum SwiftLint {
-    static let plugin = "SwiftLintPlugin-\(packageName)"
-    static let binary = "SwiftLintBinary-\(packageName)"
-}
-
 let package = Package(
-    name: packageName,
+    name: "Layout",
     platforms: [
         .iOS(.v13),
     ],
@@ -29,11 +22,7 @@ let package = Package(
     ],
     targets: [
         .target(
-            name: "Layout",
-            swiftSettings: .swiftSettings,
-            plugins: [
-                .plugin(name: SwiftLint.plugin),
-            ]),
+            name: "Layout"),
         .testTarget(
             name: "LayoutTests",
             dependencies: [
@@ -44,39 +33,6 @@ let package = Package(
             exclude: [
                 "__Snapshots__",
                 "UIKit/__Snapshots__",
-            ],
-            swiftSettings: .swiftSettings,
-            plugins: [
-                .plugin(name: SwiftLint.plugin),
             ]),
-        .plugin(
-            name: "SwiftLintCommand",
-            capability: .command(intent: .custom(verb: "swiftlint", description: "SwiftLint Command Plugin")),
-            dependencies: [
-                .target(name: SwiftLint.binary)
-            ]),
-        .plugin(
-            name: SwiftLint.plugin,
-            capability: .buildTool(),
-            dependencies: [
-                .target(name: SwiftLint.binary)
-            ],
-            path: "Plugins/SwiftLintPlugin"),
-        .binaryTarget(
-            name: SwiftLint.binary,
-            url: "https://github.com/realm/SwiftLint/releases/download/0.54.0/SwiftLintBinary-macos.artifactbundle.zip",
-            checksum: "963121d6babf2bf5fd66a21ac9297e86d855cbc9d28322790646b88dceca00f1"),
     ]
 )
-
-extension Array where Element == SwiftSetting {
-
-    static var swiftSettings: [SwiftSetting] {
-        if let value: String = Context.environment["SWIFT_STRICT_CONCURRENCY"] {
-            return [.unsafeFlags(["-strict-concurrency=\(value)"])]
-        } else if Context.environment["SWIFT_EMIT_EXTENSION_BLOCK_SYMBOLS"] != nil {
-            return [.unsafeFlags(["-emit-extension-block-symbols"])]
-        }
-        return []
-    }
-}
diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift
new file mode 100644
index 00000000..81bccc38
--- /dev/null
+++ b/Package@swift-5.9.swift
@@ -0,0 +1,82 @@
+// swift-tools-version:5.9
+
+import PackageDescription
+
+let packageName = "Layout"
+
+enum SwiftLint {
+    static let plugin = "SwiftLintPlugin-\(packageName)"
+    static let binary = "SwiftLintBinary-\(packageName)"
+}
+
+let package = Package(
+    name: packageName,
+    platforms: [
+        .iOS(.v13),
+    ],
+    products: [
+        .library(
+            name: "Layout",
+            targets: ["Layout"]),
+    ],
+    dependencies: [
+        .package(
+            url: "https://github.com/Quick/Nimble.git",
+            from: "13.0.0"),
+        .package(
+            url: "https://github.com/pointfreeco/swift-snapshot-testing.git",
+            from: "1.15.0"),
+    ],
+    targets: [
+        .target(
+            name: "Layout",
+            swiftSettings: .swiftSettings,
+            plugins: [
+                .plugin(name: SwiftLint.plugin),
+            ]),
+        .testTarget(
+            name: "LayoutTests",
+            dependencies: [
+                "Layout",
+                "Nimble",
+                .product(name: "SnapshotTesting", package: "swift-snapshot-testing"),
+            ],
+            exclude: [
+                "__Snapshots__",
+                "UIKit/__Snapshots__",
+            ],
+            swiftSettings: .swiftSettings,
+            plugins: [
+                .plugin(name: SwiftLint.plugin),
+            ]),
+        .plugin(
+            name: "SwiftLintCommand",
+            capability: .command(intent: .custom(verb: "swiftlint", description: "SwiftLint Command Plugin")),
+            dependencies: [
+                .target(name: SwiftLint.binary)
+            ]),
+        .plugin(
+            name: SwiftLint.plugin,
+            capability: .buildTool(),
+            dependencies: [
+                .target(name: SwiftLint.binary)
+            ],
+            path: "Plugins/SwiftLintPlugin"),
+        .binaryTarget(
+            name: SwiftLint.binary,
+            url: "https://github.com/realm/SwiftLint/releases/download/0.54.0/SwiftLintBinary-macos.artifactbundle.zip",
+            checksum: "963121d6babf2bf5fd66a21ac9297e86d855cbc9d28322790646b88dceca00f1"),
+    ]
+)
+
+extension Array where Element == SwiftSetting {
+
+    static var swiftSettings: [SwiftSetting] {
+        if let value: String = Context.environment["SWIFT_STRICT_CONCURRENCY"] {
+            return [.unsafeFlags(["-strict-concurrency=\(value)"])]
+        } else if Context.environment["SWIFT_EMIT_EXTENSION_BLOCK_SYMBOLS"] != nil {
+            return [.unsafeFlags(["-emit-extension-block-symbols"])]
+        }
+        return []
+    }
+}
