Skip to content

Commit

Permalink
Enable strict concurrency checking
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Sep 12, 2024
1 parent 2109f13 commit e6ecfb6
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
// SPDX-License-Identifier: MIT
//

import class Foundation.ProcessInfo
import PackageDescription


#if swift(<6)
let swiftConcurrency: SwiftSetting = .enableExperimentalFeature("StrictConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("StrictConcurrency")
#endif


let package = Package(
name: "HealthKitOnOMH",
platforms: [
Expand All @@ -21,19 +29,45 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/StanfordBDHG/OMHModels.git", .upToNextMajor(from: "0.1.0"))
],
] + swiftLintPackage(),
targets: [
.target(
name: "HealthKitOnOMH",
dependencies: [
.product(name: "OMHModels", package: "OMHModels")
]
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "HealthKitOnOMHTests",
dependencies: [
.target(name: "HealthKitOnOMH")
]
],
swiftSettings: [
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
)
]
)


func swiftLintPlugin() -> [Target.PluginUsage] {
// Fully quit Xcode and open again with `open --env SPEZI_DEVELOPMENT_SWIFTLINT /Applications/Xcode.app`
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
} else {
[]
}
}

func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
} else {
[]
}
}

0 comments on commit e6ecfb6

Please sign in to comment.