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

Use the new Android overlay in the tests and update some Bionic declarations #3009

Merged
merged 1 commit into from
Dec 1, 2024

Conversation

finagolfin
Copy link
Contributor

Motivation:

Get this repo building again for Android with NDK 27

Modifications:

  • Update some networking declarations for newly added nullability annotations
  • Import the new Android overlay instead in some tests
  • Add two force-unwraps on all platforms, that are needed for Android

Result:

This repo and its tests build for Android again

I've been using these patches on my Android CI and natively on Android for a couple months now. I didn't bother keeping this patch building for Android with Swift 5 anymore, as my Android CI no longer tests Swift 5.

I built this pull and ran the tests on linux x86_64 to make sure there was no regression.

…rations

Motivation:

Get this repo building again for Android with NDK 27

Modifications:

- Update some networking declarations for newly added nullability annotations
- Import the new Android overlay instead in some tests
- Add two force-unwraps on all platforms, that are needed for Android

Result:

This repo and its tests build for Android again
@@ -124,12 +124,20 @@ private let sysWritev = sysWritev_wrapper
#elseif !os(Windows)
private let sysWritev: @convention(c) (Int32, UnsafePointer<iovec>?, CInt) -> CLong = writev
#endif
#if !os(Windows)
#if canImport(Android)
private let sysRecvMsg: @convention(c) (CInt, UnsafeMutablePointer<msghdr>, CInt) -> ssize_t = recvmsg
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These nullability annotations were added with NDK 27 this summer, so adapt these networking APIs for that.

#elseif canImport(Bionic)
import Bionic
#elseif canImport(Android)
import Android
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed a couple months ago, the compiler started requiring different imports after the Foundation rewrite this summer.

@Lukasa Lukasa added the 🔨 semver/patch No public API change. label Dec 1, 2024
@finagolfin
Copy link
Contributor Author

The two failing linux CI jobs with nightly-main appear unrelated.

@Lukasa Lukasa merged commit 33b8a48 into apple:main Dec 1, 2024
41 of 44 checks passed
@finagolfin
Copy link
Contributor Author

Thanks for the quick review. 😃

@finagolfin finagolfin deleted the droid branch December 1, 2024 18:29
Lukasa pushed a commit that referenced this pull request Dec 15, 2024
I added this changed function call for Android in #2660 earlier this
year, because of [an incorrect Bionic function signature as explained
recently](#3009 (comment)),
but now that it has been worked around through a new API note as
mentioned there, this change is no longer needed.

I simply did not notice this earlier because it still compiles and
merely gives a warning, which removing this call now silences.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants