Skip to content

Commit

Permalink
Enable strict concurrency checking for swift 5.8+
Browse files Browse the repository at this point in the history
feature/strict-concurrency-checking
  • Loading branch information
roanutil committed Oct 5, 2023
1 parent 7dce9e8 commit 83a5029
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// swift-tools-version:5.8

import PackageDescription

let package = Package(
name: "NetworkService",
platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)],
products: Product.products,
dependencies: Package.Dependency.dependencies,
targets: Target.targets
)

extension Product {
static let products: [Product] = [
.library(
name: "NetworkService",
targets: ["NetworkService"]
),
.library(
name: "NetworkServiceTestHelper",
targets: ["NetworkServiceTestHelper"]
),
]
}

extension Target {
static let targets: [Target] = [
.target(name: "NetworkService"),
.testTarget(
name: "NetworkServiceTests",
dependencies: [
"NetworkService",
.product(name: "OHHTTPStubs", package: "OHHTTPStubs"),
.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"),
]
),
.target(
name: "NetworkServiceTestHelper",
dependencies: [
"NetworkService",
.product(name: "CombineSchedulers", package: "combine-schedulers"),
]
),
.testTarget(
name: "NetworkServiceTestHelperTests",
dependencies: [
"NetworkServiceTestHelper",
.product(name: "CombineSchedulers", package: "combine-schedulers"),
]
),
]
}

package.targets.strictConcurrency()

extension Array where Element == Target {
func strictConcurrency() {
forEach { target in
target.swiftSettings = (target.swiftSettings ?? [])
+ [.enableUpcomingFeature("StrictConcurrency")]
}
}
}

extension Package.Dependency {
static let dependencies: [Package.Dependency] = [
.package(url: "https://github.com/AliSoftware/OHHTTPStubs.git", from: "9.1.0"),
.package(
url: "https://github.com/pointfreeco/combine-schedulers.git",
from: "1.0.0"
),
]
}

0 comments on commit 83a5029

Please sign in to comment.