Skip to content

Commit 9ca4e51

Browse files
committed
build: use Foundation instead of C for the environment
The `getenv` call is part of the C library which is vended with different names on different platforms (`ucrt`, `Darwin.C`, and `glibc`). Use Foundation instead to abstract over the differences.
1 parent a062ec8 commit 9ca4e51

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Package.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212
//===----------------------------------------------------------------------===//
1313

1414
import PackageDescription
15-
16-
#if os(Linux)
17-
import Glibc
18-
#else
19-
import Darwin.C
20-
#endif
15+
import Foundation
2116

2217
let package = Package(
2318
name: "swift-format",
@@ -141,7 +136,7 @@ let package = Package(
141136
)
142137

143138

144-
if getenv("SWIFTCI_USE_LOCAL_DEPS") == nil {
139+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
145140
// Building standalone.
146141
package.dependencies += [
147142
.package(url: "https://github.com/apple/swift-syntax", .branch("main")),

0 commit comments

Comments
 (0)