Skip to content

Commit 0de1799

Browse files
Move warning about strict concurrency into PlatformChecks.swift (#289)
### Motivation In #191 we enabled strict concurrency in CI. We also attempted to include it conditionally as part of a local development flow. However, the `#warning` (that strict concurrency was enabled) added to Package.swift was firing unconditionally because it was, itself, behind a _runtime_ conditional. ### Modifications Now if `SWIFT_OPENAPI_STRICT_CONCURRENCY=true` then we will add a `define` to the `swiftSettings` and we will move the `#warning` to the existing `PlatformChecks.swift`. ### Result Opening Xcode with `SWIFT_OPENAPI_STRICT_CONCURRENCY=true` will enable strict concurrency warnings locally. Opening Xcode without this will no longer produce a misleading warning. ### Test Plan Tested locally. Signed-off-by: Si Beaumont <[email protected]>
1 parent 6a259ae commit 0de1799

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Package.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ swiftSettings.append(
2727

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

Sources/_OpenAPIGeneratorCore/PlatformChecks.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,7 @@
1717
#if !(os(macOS) || os(Linux))
1818
#error("_OpenAPIGeneratorCore is only to be used by swift-openapi-generator itself—your target should not link this library or the command line tool directly.")
1919
#endif
20+
21+
#if SWIFT_OPENAPI_STRICT_CONCURRENCY
22+
#warning("Compiling with Strict Concurrency")
23+
#endif

0 commit comments

Comments
 (0)