|
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. |
10 | | -if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil { |
| 8 | +let swiftSettings:[SwiftSetting] = ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"].map { _ in |
11 | 9 | let groupFile = URL(fileURLWithPath: #file) |
12 | 10 | .deletingLastPathComponent() |
13 | 11 | .appendingPathComponent("utils") |
14 | 12 | .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 | +} ?? [] |
22 | 21 |
|
23 | 22 | let package = Package( |
24 | 23 | name: "SwiftSyntax", |
@@ -54,7 +53,7 @@ let package = Package( |
54 | 53 | "SyntaxNodes.swift.gyb.template", |
55 | 54 | "SyntaxKind.swift.gyb", |
56 | 55 | ], |
57 | | - swiftSettings: [.unsafeFlags(swiftSyntaxUnsafeSwiftFlags)] |
| 56 | + swiftSettings: swiftSettings |
58 | 57 | ), |
59 | 58 | .target( |
60 | 59 | name: "SwiftSyntaxBuilder", |
|
0 commit comments