From 6df8e1c17e68f0f93de2443b8c8cafca9ddcc89a Mon Sep 17 00:00:00 2001 From: Ian Anderson Date: Fri, 13 Sep 2024 23:55:55 -0700 Subject: [PATCH] Explicitly import locale modules (#771) The Darwin module is slowly being split up, and as it gets further along, it will stop importing some of the split-out modules like the one for locale.h that provides newlocale() and other locale API. However, there's a wrinkle that on platforms with xlocale, it's xlocale.h that provides most of the POSIX locale.h functions and not locale.h, so prefer the xlocale module when available. --- Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift | 6 +++++- Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift b/Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift index b2e9d7b05..a46b4f759 100644 --- a/Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift +++ b/Sources/AsyncHTTPClient/HTTPClient+HTTPCookie.swift @@ -13,7 +13,11 @@ //===----------------------------------------------------------------------===// import NIOHTTP1 -#if canImport(Darwin) +#if canImport(xlocale) +import xlocale +#elseif canImport(locale_h) +import locale_h +#elseif canImport(Darwin) import Darwin #elseif canImport(Musl) import Musl diff --git a/Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift b/Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift index 7f28040c2..e8d6976c5 100644 --- a/Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift +++ b/Tests/AsyncHTTPClientTests/HTTPClientTestUtils.swift @@ -28,7 +28,11 @@ import NIOSSL import NIOTLS import NIOTransportServices import XCTest -#if canImport(Darwin) +#if canImport(xlocale) +import xlocale +#elseif canImport(locale_h) +import locale_h +#elseif canImport(Darwin) import Darwin #elseif canImport(Musl) import Musl