Skip to content

Commit

Permalink
Add support for Musl
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Oct 13, 2024
1 parent 48a89ed commit 5f65695
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
5 changes: 0 additions & 5 deletions Sources/SotoCore/Credential/ConfigFileLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ import INIParser
import Logging
import NIOCore
import NIOPosix
#if os(Linux)
import Glibc
#else
import Foundation.NSString
#endif

/// Load settings from AWS credentials and profile configuration files
/// https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
Expand Down
12 changes: 8 additions & 4 deletions Sources/SotoCore/Doc/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@
//
//===----------------------------------------------------------------------===//

#if os(Linux)
#if canImport(Glibc)
import Glibc
#else
#elseif canImport(Musl)
import Musl
#elseif canImport(Darwin)
import Darwin.C
#else
#error("Unsupported platform")
#endif

internal enum Environment {
internal static subscript(_ name: String) -> String? {
enum Environment {
static subscript(_ name: String) -> String? {
guard let value = getenv(name) else {
return nil
}
Expand Down
8 changes: 6 additions & 2 deletions Sources/SotoTestUtils/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
//
//===----------------------------------------------------------------------===//

#if os(Linux)
#if canImport(Glibc)
import Glibc
#else
#elseif canImport(Musl)
import Musl
#elseif canImport(Darwin)
import Darwin.C
#else
#error("Unsupported platform")
#endif

internal enum Environment {
Expand Down
8 changes: 6 additions & 2 deletions Sources/SotoXML/Expat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
// Licensed under Apache License v2.0 http://www.apache.org/licenses/LICENSE-2.0.html
//

#if os(Linux)
#if canImport(Glibc)
import Glibc
#else
#elseif canImport(Musl)
import Musl
#elseif canImport(Darwin)
import Darwin.C
#else
#error("Unsupported platform")
#endif

@_implementationOnly import CSotoExpat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
//===----------------------------------------------------------------------===//

import XCTest
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#elseif canImport(Darwin)
import Darwin.C
#else
import Darwin
#error("Unsupported platform")
#endif
@testable import SotoCore

Expand Down

0 comments on commit 5f65695

Please sign in to comment.