Skip to content

Commit e66da69

Browse files
authored
Increase package deployment target to macOS 15 (#1142)
* Bump deployment target to macOS 15 * Resolve deprecation warnings * Remove unnecessary availability checks from unit tests
1 parent c3397fc commit e66da69

27 files changed

+138
-231
lines changed

CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ FetchContent_MakeAvailable(SwiftFoundationICU SwiftCollections)
8686
list(APPEND CMAKE_MODULE_PATH ${SwiftFoundation_SOURCE_DIR}/cmake/modules)
8787

8888
# Availability Macros (only applies to FoundationEssentials and FoundationInternationalization)
89-
set(_SwiftFoundation_BaseAvailability "macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4")
90-
set(_SwiftFoundation_macOS14Availability "macOS 14, iOS 17, tvOS 17, watchOS 10")
91-
set(_SwiftFoundation_macOS15Availability "macOS 15, iOS 18, tvOS 18, watchOS 11")
89+
set(_SwiftFoundation_BaseAvailability "macOS 15, iOS 18, tvOS 18, watchOS 11")
9290
set(_SwiftFoundation_FutureAvailability "macOS 10000, iOS 10000, tvOS 10000, watchOS 10000")
9391

9492
# All versions to define for each availability name
@@ -111,8 +109,8 @@ list(APPEND _SwiftFoundation_availability_names
111109
# The aligned availability for each name (in the same order)
112110
list(APPEND _SwiftFoundation_availability_releases
113111
${_SwiftFoundation_BaseAvailability}
114-
${_SwiftFoundation_macOS14Availability}
115-
${_SwiftFoundation_macOS15Availability})
112+
${_SwiftFoundation_BaseAvailability}
113+
${_SwiftFoundation_BaseAvailability})
116114

117115
foreach(version ${_SwiftFoundation_versions})
118116
foreach(name release IN ZIP_LISTS _SwiftFoundation_availability_names _SwiftFoundation_availability_releases)

Package.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ import CompilerPluginSupport
88

99
let availabilityTags: [_Availability] = [
1010
_Availability("FoundationPreview"), // Default FoundationPreview availability,
11-
_Availability("FoundationPredicate", availability: .macOS14_0), // Predicate relies on pack parameter runtime support
12-
_Availability("FoundationPredicateRegex", availability: .macOS15_0) // Predicate regexes rely on new stdlib APIs
11+
_Availability("FoundationPredicate"), // Predicate relies on pack parameter runtime support
12+
_Availability("FoundationPredicateRegex") // Predicate regexes rely on new stdlib APIs
1313
]
1414
let versionNumbers = ["0.1", "0.2", "0.3", "0.4", "6.0.2", "6.1", "6.2"]
1515

1616
// Availability Macro Utilities
1717

1818
enum _OSAvailability: String {
19-
case alwaysAvailable = "macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" // This should match the package's deployment target
20-
case macOS14_0 = "macOS 14, iOS 17, tvOS 17, watchOS 10"
21-
case macOS15_0 = "macOS 15, iOS 18, tvOS 18, watchOS 11"
19+
case alwaysAvailable = "macOS 15, iOS 18, tvOS 18, watchOS 11" // This should match the package's deployment target
2220
// Use 10000 for future availability to avoid compiler magic around the 9999 version number but ensure it is greater than 9999
2321
case future = "macOS 10000, iOS 10000, tvOS 10000, watchOS 10000"
2422
}
@@ -77,7 +75,7 @@ let wasiLibcCSettings: [CSetting] = [
7775

7876
let package = Package(
7977
name: "swift-foundation",
80-
platforms: [.macOS("13.3"), .iOS("16.4"), .tvOS("16.4"), .watchOS("9.4")],
78+
platforms: [.macOS("15"), .iOS("18"), .tvOS("18"), .watchOS("11")],
8179
products: [
8280
.library(name: "FoundationEssentials", targets: ["FoundationEssentials"]),
8381
.library(name: "FoundationInternationalization", targets: ["FoundationInternationalization"]),

Tests/FoundationEssentialsTests/DateTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ final class DateTests : XCTestCase {
7070
3600.0 * 24 * 365 * 100) /* ~1 century in seconds */
7171
}
7272

73-
@available(macOS 12, iOS 15, tvOS 15, watchOS 8, *)
7473
func test_now() {
7574
let date1 : Date = .now
7675
let date2 : Date = .now

Tests/FoundationEssentialsTests/FileManager/FileManagerTests.swift

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -571,53 +571,50 @@ final class FileManagerTests : XCTestCase {
571571

572572
#if canImport(Darwin)
573573
// not supported on linux as the test depends on FileManager.removeItem calling removefile(3)
574-
// not supported on older versions of Darwin where removefile would return ENOENT instead of ENAMETOOLONG
575-
if #available(macOS 14.4, iOS 17.0, watchOS 10.0, tvOS 17.0, *) {
576-
try FileManagerPlayground {
577-
}.test {
578-
// Create hierarchy in which the leaf is a long path (length > PATH_MAX)
579-
let rootDir = $0.currentDirectoryPath
580-
let aas = Array(repeating: "a", count: Int(NAME_MAX) - 3).joined()
581-
let bbs = Array(repeating: "b", count: Int(NAME_MAX) - 3).joined()
582-
let ccs = Array(repeating: "c", count: Int(NAME_MAX) - 3).joined()
583-
let dds = Array(repeating: "d", count: Int(NAME_MAX) - 3).joined()
584-
let ees = Array(repeating: "e", count: Int(NAME_MAX) - 3).joined()
585-
let leaf = "longpath"
586-
587-
try $0.createDirectory(atPath: aas, withIntermediateDirectories: true)
588-
XCTAssertTrue($0.changeCurrentDirectoryPath(aas))
589-
try $0.createDirectory(atPath: bbs, withIntermediateDirectories: true)
590-
XCTAssertTrue($0.changeCurrentDirectoryPath(bbs))
591-
try $0.createDirectory(atPath: ccs, withIntermediateDirectories: true)
592-
XCTAssertTrue($0.changeCurrentDirectoryPath(ccs))
593-
try $0.createDirectory(atPath: dds, withIntermediateDirectories: true)
594-
XCTAssertTrue($0.changeCurrentDirectoryPath(dds))
595-
try $0.createDirectory(atPath: ees, withIntermediateDirectories: true)
596-
XCTAssertTrue($0.changeCurrentDirectoryPath(ees))
597-
try $0.createDirectory(atPath: leaf, withIntermediateDirectories: true)
598-
599-
XCTAssertTrue($0.changeCurrentDirectoryPath(rootDir))
600-
let fullPath = "\(aas)/\(bbs)/\(ccs)/\(dds)/\(ees)/\(leaf)"
601-
XCTAssertThrowsError(try $0.removeItem(atPath: fullPath)) {
602-
let underlyingPosixError = ($0 as? CocoaError)?.underlying as? POSIXError
603-
XCTAssertEqual(underlyingPosixError?.code, .ENAMETOOLONG, "removeItem didn't fail with ENAMETOOLONG; produced error: \($0)")
604-
}
605-
606-
// Clean up
607-
XCTAssertTrue($0.changeCurrentDirectoryPath(aas))
608-
XCTAssertTrue($0.changeCurrentDirectoryPath(bbs))
609-
XCTAssertTrue($0.changeCurrentDirectoryPath(ccs))
610-
XCTAssertTrue($0.changeCurrentDirectoryPath(dds))
611-
try $0.removeItem(atPath: ees)
612-
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
613-
try $0.removeItem(atPath: dds)
614-
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
615-
try $0.removeItem(atPath: ccs)
616-
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
617-
try $0.removeItem(atPath: bbs)
618-
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
619-
try $0.removeItem(atPath: aas)
574+
try FileManagerPlayground {
575+
}.test {
576+
// Create hierarchy in which the leaf is a long path (length > PATH_MAX)
577+
let rootDir = $0.currentDirectoryPath
578+
let aas = Array(repeating: "a", count: Int(NAME_MAX) - 3).joined()
579+
let bbs = Array(repeating: "b", count: Int(NAME_MAX) - 3).joined()
580+
let ccs = Array(repeating: "c", count: Int(NAME_MAX) - 3).joined()
581+
let dds = Array(repeating: "d", count: Int(NAME_MAX) - 3).joined()
582+
let ees = Array(repeating: "e", count: Int(NAME_MAX) - 3).joined()
583+
let leaf = "longpath"
584+
585+
try $0.createDirectory(atPath: aas, withIntermediateDirectories: true)
586+
XCTAssertTrue($0.changeCurrentDirectoryPath(aas))
587+
try $0.createDirectory(atPath: bbs, withIntermediateDirectories: true)
588+
XCTAssertTrue($0.changeCurrentDirectoryPath(bbs))
589+
try $0.createDirectory(atPath: ccs, withIntermediateDirectories: true)
590+
XCTAssertTrue($0.changeCurrentDirectoryPath(ccs))
591+
try $0.createDirectory(atPath: dds, withIntermediateDirectories: true)
592+
XCTAssertTrue($0.changeCurrentDirectoryPath(dds))
593+
try $0.createDirectory(atPath: ees, withIntermediateDirectories: true)
594+
XCTAssertTrue($0.changeCurrentDirectoryPath(ees))
595+
try $0.createDirectory(atPath: leaf, withIntermediateDirectories: true)
596+
597+
XCTAssertTrue($0.changeCurrentDirectoryPath(rootDir))
598+
let fullPath = "\(aas)/\(bbs)/\(ccs)/\(dds)/\(ees)/\(leaf)"
599+
XCTAssertThrowsError(try $0.removeItem(atPath: fullPath)) {
600+
let underlyingPosixError = ($0 as? CocoaError)?.underlying as? POSIXError
601+
XCTAssertEqual(underlyingPosixError?.code, .ENAMETOOLONG, "removeItem didn't fail with ENAMETOOLONG; produced error: \($0)")
620602
}
603+
604+
// Clean up
605+
XCTAssertTrue($0.changeCurrentDirectoryPath(aas))
606+
XCTAssertTrue($0.changeCurrentDirectoryPath(bbs))
607+
XCTAssertTrue($0.changeCurrentDirectoryPath(ccs))
608+
XCTAssertTrue($0.changeCurrentDirectoryPath(dds))
609+
try $0.removeItem(atPath: ees)
610+
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
611+
try $0.removeItem(atPath: dds)
612+
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
613+
try $0.removeItem(atPath: ccs)
614+
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
615+
try $0.removeItem(atPath: bbs)
616+
XCTAssertTrue($0.changeCurrentDirectoryPath(".."))
617+
try $0.removeItem(atPath: aas)
621618
}
622619
#endif
623620
}

Tests/FoundationEssentialsTests/Formatting/BinaryInteger+FormatStyleTests.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,13 @@ final class BinaryIntegerFormatStyleTests: XCTestCase {
4343
check(type: Int16.self, min: "-32768", max: "32767")
4444
check(type: Int32.self, min: "-2147483648", max: "2147483647")
4545
check(type: Int64.self, min: "-9223372036854775808", max: "9223372036854775807")
46-
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
47-
check(type: Int128.self, min: "-170141183460469231731687303715884105728", max: "170141183460469231731687303715884105727")
48-
}
46+
check(type: Int128.self, min: "-170141183460469231731687303715884105728", max: "170141183460469231731687303715884105727")
4947

5048
check(type: UInt8.self, min: "0", max: "255")
5149
check(type: UInt16.self, min: "0", max: "65535")
5250
check(type: UInt32.self, min: "0", max: "4294967295")
5351
check(type: UInt64.self, min: "0", max: "18446744073709551615")
54-
if #available(macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0, *) {
55-
check(type: UInt128.self, min: "0", max: "340282366920938463463374607431768211455")
56-
}
52+
check(type: UInt128.self, min: "0", max: "340282366920938463463374607431768211455")
5753
}
5854

5955
func testNumericStringRepresentation_builtinIntegersAroundDecimalMagnitude() throws {

Tests/FoundationEssentialsTests/Formatting/ISO8601FormatStyleParsingTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ result : \(parsed != nil ? parsed!.debugDescription : "nil") \(parsed != nil ?
185185
#endif
186186
}
187187

188-
@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)
189188
final class DateISO8601FormatStylePatternMatchingTests : XCTestCase {
190189

191190
func _matchFullRange(_ str: String, formatStyle: Date.ISO8601FormatStyle, expectedUpperBound: String.Index?, expectedDate: Date?, file: StaticString = #filePath, line: UInt = #line) {

Tests/FoundationEssentialsTests/GregorianCalendarRecurrenceRuleTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import TestSupport
2020
@testable import FoundationEssentials
2121
#endif // FOUNDATION_FRAMEWORK
2222

23-
@available(FoundationPreview 0.4, *)
2423
final class GregorianCalendarRecurrenceRuleTests: XCTestCase {
2524
/// A Gregorian calendar in GMT with no time zone changes
2625
var gregorian: Calendar = {

0 commit comments

Comments
 (0)