Skip to content

Commit 5f65695

Browse files
committed
Add support for Musl
1 parent 48a89ed commit 5f65695

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

Sources/SotoCore/Credential/ConfigFileLoader.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ import INIParser
1717
import Logging
1818
import NIOCore
1919
import NIOPosix
20-
#if os(Linux)
21-
import Glibc
22-
#else
23-
import Foundation.NSString
24-
#endif
2520

2621
/// Load settings from AWS credentials and profile configuration files
2722
/// https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

Sources/SotoCore/Doc/Environment.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
#if os(Linux)
15+
#if canImport(Glibc)
1616
import Glibc
17-
#else
17+
#elseif canImport(Musl)
18+
import Musl
19+
#elseif canImport(Darwin)
1820
import Darwin.C
21+
#else
22+
#error("Unsupported platform")
1923
#endif
2024

21-
internal enum Environment {
22-
internal static subscript(_ name: String) -> String? {
25+
enum Environment {
26+
static subscript(_ name: String) -> String? {
2327
guard let value = getenv(name) else {
2428
return nil
2529
}

Sources/SotoTestUtils/Environment.swift

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

15-
#if os(Linux)
15+
#if canImport(Glibc)
1616
import Glibc
17-
#else
17+
#elseif canImport(Musl)
18+
import Musl
19+
#elseif canImport(Darwin)
1820
import Darwin.C
21+
#else
22+
#error("Unsupported platform")
1923
#endif
2024

2125
internal enum Environment {

Sources/SotoXML/Expat.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
// Licensed under Apache License v2.0 http://www.apache.org/licenses/LICENSE-2.0.html
1919
//
2020

21-
#if os(Linux)
21+
#if canImport(Glibc)
2222
import Glibc
23-
#else
23+
#elseif canImport(Musl)
24+
import Musl
25+
#elseif canImport(Darwin)
2426
import Darwin.C
27+
#else
28+
#error("Unsupported platform")
2529
#endif
2630

2731
@_implementationOnly import CSotoExpat

Tests/SotoCoreTests/Credential/StaticCredential+EnvironmentTests.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
import XCTest
16-
#if os(Linux)
16+
#if canImport(Glibc)
1717
import Glibc
18+
#elseif canImport(Musl)
19+
import Musl
20+
#elseif canImport(Darwin)
21+
import Darwin.C
1822
#else
19-
import Darwin
23+
#error("Unsupported platform")
2024
#endif
2125
@testable import SotoCore
2226

0 commit comments

Comments
 (0)