Skip to content

Commit 597cfb9

Browse files
authored
Update availability release for FoundationPredicateRegex (#760)
1 parent f0adc5e commit 597cfb9

File tree

2 files changed

+36
-15
lines changed

2 files changed

+36
-15
lines changed

CMakeLists.txt

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,40 @@ FetchContent_MakeAvailable(SwiftFoundationICU SwiftCollections)
6969
list(APPEND CMAKE_MODULE_PATH ${SwiftFoundation_SOURCE_DIR}/cmake/modules)
7070

7171
# Availability Macros (only applies to FoundationEssentials and FoundationInternationalization)
72-
set(_SwiftFoundation_availability_macros)
73-
list(APPEND _SwiftFoundation_availability_macros
74-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPreview 0.1:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4\">"
75-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPreview 0.2:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4\">"
76-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPreview 0.3:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4\">"
77-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPreview 0.4:macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4\">"
78-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicate 0.1:macOS 14, iOS 17, tvOS 17, watchOS 10\">"
79-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicate 0.2:macOS 14, iOS 17, tvOS 17, watchOS 10\">"
80-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicate 0.3:macOS 14, iOS 17, tvOS 17, watchOS 10\">"
81-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicate 0.4:macOS 14, iOS 17, tvOS 17, watchOS 10\">"
82-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicateRegex 0.1:macOS 10000, iOS 10000, tvOS 10000, watchOS 10000\">"
83-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicateRegex 0.2:macOS 10000, iOS 10000, tvOS 10000, watchOS 10000\">"
84-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicateRegex 0.3:macOS 10000, iOS 10000, tvOS 10000, watchOS 10000\">"
85-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=FoundationPredicateRegex 0.4:macOS 10000, iOS 10000, tvOS 10000, watchOS 10000\">")
72+
set(_SwiftFoundation_BaseAvailability "macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4")
73+
set(_SwiftFoundation_macOS14Availability "macOS 14, iOS 17, tvOS 17, watchOS 10")
74+
set(_SwiftFoundation_macOS15Availability "macOS 15, iOS 18, tvOS 18, watchOS 11")
75+
set(_SwiftFoundation_FutureAvailability "macOS 10000, iOS 10000, tvOS 10000, watchOS 10000")
76+
77+
# All versions to define for each availability name
78+
list(APPEND _SwiftFoundation_versions
79+
"0.1"
80+
"0.2"
81+
"0.3"
82+
"0.4")
83+
84+
# Each availability name to define
85+
list(APPEND _SwiftFoundation_availability_names
86+
"FoundationPreview"
87+
"FoundationPredicate"
88+
"FoundationPredicateRegex")
89+
90+
# The aligned availability for each name (in the same order)
91+
list(APPEND _SwiftFoundation_availability_releases
92+
${_SwiftFoundation_BaseAvailability}
93+
${_SwiftFoundation_macOS14Availability}
94+
${_SwiftFoundation_macOS15Availability})
95+
96+
foreach(version ${_SwiftFoundation_versions})
97+
foreach(name release IN ZIP_LISTS _SwiftFoundation_availability_names _SwiftFoundation_availability_releases)
98+
if(NOT DEFINED name OR NOT DEFINED release)
99+
message(FATAL_ERROR "_SwiftFoundation_availability_names and _SwiftFoundation_availability_releases are not the same length")
100+
endif()
101+
102+
list(APPEND _SwiftFoundation_availability_macros
103+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -enable-experimental-feature -Xfrontend \"AvailabilityMacro=${name} ${version}=${release}\">")
104+
endforeach()
105+
endforeach()
86106

87107
include(GNUInstallDirs)
88108
include(SwiftFoundationSwiftSupport)

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import CompilerPluginSupport
99
let availabilityTags: [_Availability] = [
1010
_Availability("FoundationPreview"), // Default FoundationPreview availability,
1111
_Availability("FoundationPredicate", availability: .macOS14_0), // Predicate relies on pack parameter runtime support
12-
_Availability("FoundationPredicateRegex", availability: .future) // Predicate regexes rely on new stdlib APIs
12+
_Availability("FoundationPredicateRegex", availability: .macOS15_0) // Predicate regexes rely on new stdlib APIs
1313
]
1414
let versionNumbers = ["0.1", "0.2", "0.3", "0.4"]
1515

@@ -18,6 +18,7 @@ let versionNumbers = ["0.1", "0.2", "0.3", "0.4"]
1818
enum _OSAvailability: String {
1919
case alwaysAvailable = "macOS 13.3, iOS 16.4, tvOS 16.4, watchOS 9.4" // This should match the package's deployment target
2020
case macOS14_0 = "macOS 14, iOS 17, tvOS 17, watchOS 10"
21+
case macOS15_0 = "macOS 15, iOS 18, tvOS 18, watchOS 11"
2122
// Use 10000 for future availability to avoid compiler magic around the 9999 version number but ensure it is greater than 9999
2223
case future = "macOS 10000, iOS 10000, tvOS 10000, watchOS 10000"
2324
}

0 commit comments

Comments
 (0)