Skip to content

Commit

Permalink
Add Swift 5.9 package manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-cfuller committed Feb 16, 2024
1 parent 8716114 commit 39e60d1
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 46 deletions.
48 changes: 2 additions & 46 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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),
],
Expand All @@ -29,11 +22,7 @@ let package = Package(
],
targets: [
.target(
name: "Layout",
swiftSettings: .swiftSettings,
plugins: [
.plugin(name: SwiftLint.plugin),
]),
name: "Layout"),
.testTarget(
name: "LayoutTests",
dependencies: [
Expand All @@ -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 []
}
}
82 changes: 82 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -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 []
}
}

0 comments on commit 39e60d1

Please sign in to comment.