Skip to content

Commit 71cc83f

Browse files
authored
Merge pull request #358 from kelvin13/kelvin13-omit-unsafe-flags
rewrite swiftSettings to avoid causing SPM build failures
2 parents e4f7fc9 + 3882170 commit 71cc83f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Package.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
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.
8+
let swiftSyntaxSwiftSettings: [SwiftSetting]
109
if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
1110
let groupFile = URL(fileURLWithPath: #file)
1211
.deletingLastPathComponent()
1312
.appendingPathComponent("utils")
1413
.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"]
14+
swiftSyntaxSwiftSettings = [.unsafeFlags([
15+
"-Xfrontend", "-group-info-path",
16+
"-Xfrontend", groupFile.path,
17+
// Enforcing exclusivity increases compile time of release builds by 2 minutes.
18+
// Disable it when we're in a controlled CI environment.
19+
"-enforce-exclusivity=unchecked",
20+
])]
21+
} else {
22+
swiftSyntaxSwiftSettings = []
2123
}
2224

2325
let package = Package(
@@ -54,7 +56,7 @@ let package = Package(
5456
"SyntaxNodes.swift.gyb.template",
5557
"SyntaxKind.swift.gyb",
5658
],
57-
swiftSettings: [.unsafeFlags(swiftSyntaxUnsafeSwiftFlags)]
59+
swiftSettings: swiftSyntaxSwiftSettings
5860
),
5961
.target(
6062
name: "SwiftSyntaxBuilder",

0 commit comments

Comments
 (0)