Skip to content

Commit 0498ba7

Browse files
committed
Merge branch 'fix/frizlab/ancient_macoses' into develop
2 parents fdd2a46 + 9b3956d commit 0498ba7

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ import PackageDescription
44

55
let package = Package(
66
name: "clt-logger",
7-
/* Not sure how to test for platforms for Swift pre-5.8; let’s not do it. */
7+
platforms: [
8+
.macOS(.v10_15),
9+
.tvOS(.v13),
10+
.iOS(.v13),
11+
.watchOS(.v6),
12+
],
813
products: [
914
.library(name: "CLTLogger", targets: ["CLTLogger"]),
1015
],

Sources/CLTLogger.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,17 @@ public struct CLTLogger : LogHandler {
189189
/* Is the write retried on interrupt?
190190
* We’ll assume yes, but we don’t and can’t know for sure
191191
* until FileHandle has been migrated to the open-source Foundation. */
192-
_ = try? fh.write(contentsOf: data)
192+
if #available(macOS 10.15.4, iOS 13.4, tvOS 13.4, watchOS 6.2, *) {
193+
#if swift(>=5.2) || (!os(macOS) && !os(iOS) && !os(tvOS) && !os(watchOS))
194+
_ = try? fh.write(contentsOf: data)
195+
#else
196+
/* Note: This throws an actual objc exception if it fails. */
197+
fh.write(data)
198+
#endif
199+
} else {
200+
/* Note: This throws an actual objc exception if it fails. */
201+
fh.write(data)
202+
}
193203
}
194204
}
195205

Sources/NSLock+Linux.swift renamed to Sources/NSLock+withLock.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if os(Linux) && swift(<6.0)
1+
#if (os(Linux) && swift(<6.0)) || swift(<5.7)
22
import Foundation
33

44

Tests/CLTLoggerTests/CLTLoggerTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ final class CLTLoggerTests : XCTestCase {
104104
logger.critical("YAM!\nhere is the second line\nand why not a third one", metadata: ["with": ["metadata", "again"], "because": "42"])
105105
}
106106

107+
#if swift(>=5.2) || (!os(macOS) && !os(iOS) && !os(tvOS) && !os(watchOS))
108+
@available(macOS 10.15.4, *)
109+
@available(iOS 13.4, *)
110+
@available(tvOS 13.4, *)
111+
@available(watchOS 6.2, *)
107112
func testBasicLogOutputWithAllEmojiSets() throws {
108113
XCTAssertTrue(true, "We only want to see how the log look, so please see the logs.")
109114

@@ -124,5 +129,6 @@ final class CLTLoggerTests : XCTestCase {
124129
* ⚠️ Also change in the setUp method if changed here. */
125130
LoggingSystem.bootstrapInternal{ _ in CLTLogger(multilineMode: Self.multilineMode) }
126131
}
132+
#endif
127133

128134
}

Tests/CLTLoggerTests/EmojiTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ final class EmojiTests : XCTestCase {
2222
}
2323
}
2424

25+
#if swift(>=5.2) || (!os(macOS) && !os(iOS) && !os(tvOS) && !os(watchOS))
26+
@available(macOS 10.15.4, *)
27+
@available(iOS 13.4, *)
28+
@available(tvOS 13.4, *)
29+
@available(watchOS 6.2, *)
2530
func testEmojiAlignmentAndTextRenderingVisually() throws {
2631
let envVars = ProcessInfo.processInfo.environment
2732
let outputEnvironment: OutputEnvironment = .detect(from: .standardError, envVars)
@@ -30,5 +35,6 @@ final class EmojiTests : XCTestCase {
3035
try FileHandle.standardError.write(contentsOf: Data((lineStr + "\n").utf8))
3136
}
3237
}
38+
#endif
3339

3440
}

0 commit comments

Comments
 (0)