Skip to content

Commit 3ee10cc

Browse files
authored
Merge pull request swiftlang#372 from keith/ks/5.6-rewrite-swiftsettings-to-avoid-causing-spm-build-failures
[5.6] rewrite swiftSettings to avoid causing SPM build failures
2 parents 87d6d0a + 58818c9 commit 3ee10cc

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Package.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@
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")
1514

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"]
15+
swiftSyntaxSwiftSettings = [.unsafeFlags([
16+
"-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+
"-enforce-exclusivity=unchecked",
21+
])]
22+
} else {
23+
swiftSyntaxSwiftSettings = []
2124
}
2225

2326
let package = Package(
@@ -49,7 +52,7 @@ let package = Package(
4952
"SyntaxNodes.swift.gyb.template",
5053
"SyntaxKind.swift.gyb",
5154
],
52-
swiftSettings: [.unsafeFlags(swiftSyntaxUnsafeSwiftFlags)]
55+
swiftSettings: swiftSyntaxSwiftSettings
5356
),
5457
.target(
5558
name: "SwiftSyntaxBuilder",

0 commit comments

Comments
 (0)