Skip to content

Instantly share code, notes, and snippets.

@tkersey
Last active October 24, 2023 14:19
Show Gist options
  • Save tkersey/30f7dd82899fbdac25eea159b1d4d794 to your computer and use it in GitHub Desktop.
Save tkersey/30f7dd82899fbdac25eea159b1d4d794 to your computer and use it in GitHub Desktop.
Package.swift Settings
extension LinkerSetting {
static var mergeable: Self = unsafeFlags([
"-Wl,-make_mergeable",
"-Wl,-no_exported_symbols",
])
}
extension SwiftSetting {
static func warnLongExpressionTypeChecking(
typeChecking: Int = 200,
functionBodies: Int = 200,
for configuration: BuildConfiguration = .debug
) -> Self {
unsafeFlags(
[
"-Xfrontend", "-warn-long-expression-type-checking=\(typeChecking)",
"-Xfrontend", "-warn-long-function-bodies=\(functionBodies)",
],
.when(configuration: configuration)
)
}
enum ConcurrencyChecking: String {
case complete
case minimal
case targeted
}
static func concurrencyChecking(
_ setting: ConcurrencyChecking = .complete,
for configuration: BuildConfiguration = .debug
) -> Self {
.unsafeFlags(
[
"-Xfrontend", "-strict-concurrency=\(setting)",
"-Xfrontend", "-warn-concurrency",
"-Xfrontend", "-enable-actor-data-race-checks",
],
.when(configuration: configuration)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment