Skip to content

Commit

Permalink
Opt into StrictConcurrency with environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjbeaumont committed Sep 18, 2023
1 parent e3a7650 commit fca413f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//
import Foundation
import PackageDescription

// General Swift-settings for all targets.
Expand All @@ -23,6 +24,15 @@ swiftSettings.append(
// Require `any` for existential types.
.enableUpcomingFeature("ExistentialAny")
)

// Strict concurrency is enabled in CI; use this environment variable to enable it locally.
if ProcessInfo.processInfo.environment["SWIFT_OPENAPI_STRICT_CONCURRENCY"].flatMap(Bool.init) ?? false {
#warning("Compiling with Strict Concurrency")
swiftSettings.append(contentsOf: [
.enableExperimentalFeature("StrictConcurrency"),
.unsafeFlags(["-warnings-as-errors"]),
])
}
#endif

let package = Package(
Expand Down

0 comments on commit fca413f

Please sign in to comment.