Skip to content
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

[android] Use Bionic imports instead where possible #5149

Merged
merged 1 commit into from
Dec 17, 2024

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!

@@ -19,7 +19,7 @@ import FoundationNetworking
#endif
#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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants