Skip to content

build: use Foundation instead of C for getenv #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
import PackageDescription
import Foundation

#if canImport(Glibc)
import Glibc
#else
import Darwin.C
#endif

let package = Package(
name: "SwiftSyntax",
targets: [
Expand All @@ -26,7 +20,7 @@ let swiftSyntaxTarget: PackageDescription.Target

/// If we are in a controlled CI environment, we can use internal compiler flags
/// to speed up the build or improve it.
if getenv("SWIFT_BUILD_SCRIPT_ENVIRONMENT") != nil {
if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
let groupFile = URL(fileURLWithPath: #file)
.deletingLastPathComponent()
.appendingPathComponent("utils")
Expand All @@ -51,7 +45,7 @@ let libraryType: Product.Library.LibraryType

/// When we're in a build-script environment, we want to build a dylib instead
/// of a static library since we install the dylib into the toolchain.
if getenv("SWIFT_BUILD_SCRIPT_ENVIRONMENT") != nil {
if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
libraryType = .dynamic
} else {
libraryType = .static
Expand Down