[Android] Gate getifaddrs behind API 24 availability#3506
[Android] Gate getifaddrs behind API 24 availability#3506madsodgaard wants to merge 5 commits intoapple:mainfrom
getifaddrs behind API 24 availability#3506Conversation
| /// - Throws: If an error is encountered while enumerating interfaces. | ||
| @available(*, deprecated, renamed: "enumerateDevices") | ||
| #if compiler(>=6.3) | ||
| @available(Android 24, *) |
There was a problem hiding this comment.
I'm not sufficiently Android-aware to know this impact here. Did this compile for Android API 23 prior to Swift 6.3, and now does not?
There was a problem hiding this comment.
No, but we added @available support for Android in 6.3, that's why the compiler condition
There was a problem hiding this comment.
So what happened to this code in the 6.2 compiler?
There was a problem hiding this comment.
It does not compile for Android 23, because the getifaddrs symbol is missing from the NDK in API 23 and below.
There was a problem hiding this comment.
The thing I'm trying to figure out is whether this change produces a break for anyone, where code that previously compiled now will not.
There was a problem hiding this comment.
I don't think it would break anything. If you tried to compile swift-nio API 23 before, it would fail. The only place I could theoretically see it breaking was if someone was building swift-nio using a custom Android SDK and their own shim for getifaddrs and using one of the enumerate functions. Then they would get a error that it is only available on API 24.
But that's quite a stretch imo 😄
There was a problem hiding this comment.
Agreed. I believe we have (limited) Android CI. Is there a reason this isn't triggering compile failures there? https://github.com/apple/swift-nio/actions/runs/21817139179/job/62941167486
There was a problem hiding this comment.
Yeah, currently the Android SDK is only compiled for API 28+. That should soon be brought down to 24, and I am working on API 23 support as well. So that's why its not appearing in CI.
…tifaddrs-availability
Head branch was pushed to by a user without write access
finagolfin
left a comment
There was a problem hiding this comment.
Unfortunately, I think this will break building with NDK 27.
finagolfin
left a comment
There was a problem hiding this comment.
Never mind, this works fine because all current SDKs only support Android API 24 or later.
|
The WASM CI failure seems network related? Also not sure whats up with the C++ interop failure? Does not seem related to this PR? The most confusing is why the compiler check does not work for 6.0? |
|
It seems like in 6.0 the compiler check is not ignoring the list of supported protocols: it's parsing it anyway. You may have to duplicate the entire method. |
The
getifaddrsis only available on Android API 24+. So, to makeswift-niocompile on API 23, we need to add@availableannotations to the functions that use it. Which are just the two interface enumerate functions.Result:
swift-niocan be compiled for Android 23.