Skip to content

Commit

Permalink
Enable SwiftConcurrency feature in new compilers + SwiftLint
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Jun 26, 2024
1 parent 656f765 commit a210479
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 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("SwiftConcurrency")
#else
let swiftConcurrency: SwiftSetting = .enableUpcomingFeature("SwiftConcurrency")
#endif


let package = Package(
name: "SpeziFoundation",
defaultLocalization: "en",
Expand All @@ -24,21 +32,45 @@ let package = Package(
products: [
.library(name: "SpeziFoundation", targets: ["SpeziFoundation"])
],
dependencies: swiftLintPackage(),
targets: [
.target(
name: "SpeziFoundation",
resources: [
.process("Resources")
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency")
]
swiftConcurrency
],
plugins: [] + swiftLintPlugin()
),
.testTarget(
name: "SpeziFoundationTests",
dependencies: [
.target(name: "SpeziFoundation")
]
],
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", .upToNextMinor(from: "0.55.1"))]
} else {
[]
}
}

0 comments on commit a210479

Please sign in to comment.