-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it. #81440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If you use SwiftStdlibCurrentOS availability, you will be able to use new types and functions from within the implementation. This works by, when appropriate, building with the CurrentOS availability set to the current deployment target. rdar://150944675
d36db74
to
28f96e6
Compare
@swift-ci Please test |
Love where this is going, but I think the names are more-or-less backwards; we shouldn't reference the "OS" for changes that are just new API additions in the stdlib at all. They should be "SwiftStdlib x.y," and the rare change that does depend on an outside OS feature should either reference the OS version, or reference the feature itself (Foundation does this). This may make phasing adoption in slightly more complex however. |
@@ -36,3 +36,26 @@ if(NOT SwiftCore_ARCH_SUBDIR) | |||
|
|||
message(CONFIGURE_LOG "Swift Arch: ${arch}") | |||
endif() | |||
|
|||
if(NOT SwiftCore_SWIFT_AVAILABILITY_PLATFORM) | |||
set(availability_platform_macosx "macOS") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this bit. We're trying to get away from the hard-coded hand-maintained tables. I wonder if there is any way we could embed it into the existing availability macro file?
CC @compnerd, do you have any ideas?
Maybe this is something we can embed in cache files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPP to generate a response file would be my recommendation. I think that we were already doing that somewhere? (Perhaps the new build system?)
set(availability_platform_bridgeos "bridgeOS") | ||
|
||
if(SwiftCore_SWIFT_MODULE_TRIPLE MATCHES ".*-([^-]+)-simulator$") | ||
set(platform "${CMAKE_MATCH_1}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to get this information from the platform
entry in the target info without needing to regex it out of the module triple.
string(JSON platform GET "${target_info_json}" "target" "platform") |
# ON will cause us to use the "proper" availability instead. | ||
string(REPLACE "SwiftStdlib" "SwiftStdlibCurrentOS" current "${def}") | ||
if(NOT SwiftCore_ENABLE_STRICT_AVAILABILITY AND SwiftCore_SWIFT_AVAILABILITY_PLATFORM) | ||
string(REGEX MATCH "${SwiftCore_SWIFT_AVAILABILITY_PLATFORM} ([0-9]+(\.[0-9]+)+)" platform_version "${def}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AvailabilityMacros.cmake is loaded before platform info, so SwiftCore_SWIFT_AVAILABILITY_PLATFORM
won't be set by that here.
Agreed, but I didn't want to change the meaning of We could make changing the names a separate task, if someone comes up with something better. |
Add catalyst support for SwiftStdlibCurrentOS. Also, set a minimum deployment target when building Concurrency; this stops the build failing when we're trying to build on older systems where Concurrency didn't really exist yet. rdar://150966361
@swift-ci Please smoke test |
@swift-ci Please smoke test macOS platform |
It should have been `SwiftCore_MODULE_TRIPLE`, not `SwiftCore_SWIFT_MODULE_TRIPLE`.
@swift-ci Please smoke test |
We should be using `FATAL_ERROR` for error messages from CMake, not just `ERROR`.
@swift-ci Please smoke test |
The module triple bizarrely omits the "x" from "macosx". Also disable some of this code on non-Apple platforms. rdar://150944675
@swift-ci Please smoke test |
I don't think you need to fully solve the naming issue now, but please do not merge this under a name that references "OS"; there will be considerable inertia to changing this later, so we should not use a name that we know is bad. If we need a placeholder name, let's call this |
@swift-ci Please smoke test |
Let's discuss this offline and agree what we're going to do here. |
fca653e
to
0b560cb
Compare
@swift-ci Please smoke test |
These need to be defined always; we'll set them to "unknown" and "none" respectively if they end up being something we don't understand. rdar://150966361
0b560cb
to
467f401
Compare
@swift-ci Please smoke test |
If you use
SwiftStdlibCurrentOS
availability, you will be able to use new types and functions from within the implementation. This works by, when appropriate, building with theCurrentOS
availability set to the current deployment target.rdar://150944675