-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable strict concurrency checking for swift 5.8+
feature/strict-concurrency-checking
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
), | ||
] | ||
} |