|
3 | 3 | import PackageDescription
|
4 | 4 | import Foundation
|
5 | 5 |
|
6 |
| -var swiftSyntaxUnsafeSwiftFlags: [String] = [] |
7 |
| - |
8 | 6 | /// If we are in a controlled CI environment, we can use internal compiler flags
|
9 | 7 | /// to speed up the build or improve it.
|
| 8 | +let swiftSyntaxSwiftSettings:[SwiftSetting] |
10 | 9 | if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
|
11 | 10 | let groupFile = URL(fileURLWithPath: #file)
|
12 | 11 | .deletingLastPathComponent()
|
13 | 12 | .appendingPathComponent("utils")
|
14 | 13 | .appendingPathComponent("group.json")
|
15 | 14 |
|
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 = [] |
21 | 24 | }
|
22 | 25 |
|
23 | 26 | // Include the parser library as a binary dependency if both the host and the target are macOS.
|
@@ -64,7 +67,7 @@ let package = Package(
|
64 | 67 | "SyntaxNodes.swift.gyb.template",
|
65 | 68 | "SyntaxKind.swift.gyb",
|
66 | 69 | ],
|
67 |
| - swiftSettings: [.unsafeFlags(swiftSyntaxUnsafeSwiftFlags)] |
| 70 | + swiftSettings: swiftSyntaxSwiftSettings |
68 | 71 | ),
|
69 | 72 | .target(
|
70 | 73 | name: "SwiftSyntaxBuilder",
|
|
0 commit comments