Skip to content

Commit 202a319

Browse files
committed
rewrite swiftSettings to avoid causing SPM build failures
1 parent 21d13a4 commit 202a319

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

Package.swift

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,21 @@
33
import PackageDescription
44
import Foundation
55

6-
var swiftSyntaxUnsafeSwiftFlags: [String] = []
7-
86
/// If we are in a controlled CI environment, we can use internal compiler flags
97
/// to speed up the build or improve it.
10-
if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
8+
let swiftSettings:[SwiftSetting] = ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"].map { _ in
119
let groupFile = URL(fileURLWithPath: #file)
1210
.deletingLastPathComponent()
1311
.appendingPathComponent("utils")
1412
.appendingPathComponent("group.json")
15-
16-
swiftSyntaxUnsafeSwiftFlags += ["-Xfrontend", "-group-info-path",
17-
"-Xfrontend", groupFile.path]
18-
// Enforcing exclusivity increases compile time of release builds by 2 minutes.
19-
// Disable it when we're in a controlled CI environment.
20-
swiftSyntaxUnsafeSwiftFlags += ["-enforce-exclusivity=unchecked"]
21-
}
13+
return [.unsafeFlags([
14+
"-Xfrontend", "-group-info-path",
15+
"-Xfrontend", groupFile.path,
16+
// Enforcing exclusivity increases compile time of release builds by 2 minutes.
17+
// Disable it when we're in a controlled CI environment.
18+
"-enforce-exclusivity=unchecked",
19+
])]
20+
} ?? []
2221

2322
let package = Package(
2423
name: "SwiftSyntax",
@@ -54,7 +53,7 @@ let package = Package(
5453
"SyntaxNodes.swift.gyb.template",
5554
"SyntaxKind.swift.gyb",
5655
],
57-
swiftSettings: [.unsafeFlags(swiftSyntaxUnsafeSwiftFlags)]
56+
swiftSettings: swiftSettings
5857
),
5958
.target(
6059
name: "SwiftSyntaxBuilder",

0 commit comments

Comments
 (0)