Skip to content

Commit 6c0a79e

Browse files
committed
Add setup to enable all traits with env vars
1 parent 730a418 commit 6c0a79e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Package.swift

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// swift-tools-version:6.1
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

4+
import Foundation
45
import PackageDescription
56

67
let swiftSettings: [SwiftSetting] = [
@@ -15,6 +16,19 @@ let swiftSettings: [SwiftSetting] = [
1516

1617
]
1718

19+
// Should we enable all traits.
20+
let enableAllTraitsExplicitly = ProcessInfo.processInfo.environment["ENABLE_ALL_TRAITS"] != nil
21+
let enableAllTraitsInCI = ProcessInfo.processInfo.environment["CI"] != nil
22+
let enableAllTraits = enableAllTraitsExplicitly || enableAllTraitsInCI
23+
// Construct trait set
24+
var traits: Set<Trait> = [
25+
.trait(name: "ExperimentalConfiguration")
26+
]
27+
let defaultTraits: Trait = .default(enabledTraits: [])
28+
if enableAllTraits {
29+
traits.insert(enableAllTraits ? .default(enabledTraits: Set(traits.map(\.name))) : defaultTraits)
30+
}
31+
1832
let package = Package(
1933
name: "hummingbird",
2034
platforms: [.macOS(.v15), .iOS(.v17), .macCatalyst(.v17), .tvOS(.v17), .visionOS(.v1)],
@@ -27,10 +41,7 @@ let package = Package(
2741
.library(name: "HummingbirdTesting", targets: ["HummingbirdTesting"]),
2842
.executable(name: "PerformanceTest", targets: ["PerformanceTest"]),
2943
],
30-
traits: [
31-
.trait(name: "ExperimentalConfiguration"),
32-
.default(enabledTraits: ["ExperimentalConfiguration"]),
33-
],
44+
traits: traits,
3445
dependencies: [
3546
.package(url: "https://github.com/apple/swift-async-algorithms.git", from: "1.0.2"),
3647
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.0.0"),

0 commit comments

Comments
 (0)