Skip to content

Conversation

finagolfin
Copy link
Member

@compnerd asked that we use this narrower import instead where possible, so this pull does so and was tested natively on Android.

@finagolfin
Copy link
Member Author

@swift-ci please test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switch from Android -> Bionic looks good to me!

#if os(Windows)
import WinSDK
#elseif os(Android)
#elseif canImport(Android)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this should still be an os check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two are pretty much equivalent, but I use this to guard imports like this and os(Android) for genuine OS differences that don't involve importing these C functions. I have seen this done for other platforms in the Swift codebase, so I'm following that distinction for Android too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only done for Darwin platforms because there is a large set of them and we don't have a way to uniformly identify them at once.

@finagolfin finagolfin merged commit 25d044f into swiftlang:main Dec 17, 2024
2 checks passed
@finagolfin finagolfin deleted the main branch February 25, 2025 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants