|
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 | let package = Package(
|
@@ -49,7 +52,7 @@ let package = Package(
|
49 | 52 | "SyntaxNodes.swift.gyb.template",
|
50 | 53 | "SyntaxKind.swift.gyb",
|
51 | 54 | ],
|
52 |
| - swiftSettings: [.unsafeFlags(swiftSyntaxUnsafeSwiftFlags)] |
| 55 | + swiftSettings: swiftSyntaxSwiftSettings |
53 | 56 | ),
|
54 | 57 | .target(
|
55 | 58 | name: "SwiftSyntaxBuilder",
|
|
0 commit comments