Skip to content

Add --android-api-version-file support for availability#593

Merged
ktoso merged 2 commits intoswiftlang:mainfrom
ktoso:wip-android-api-version-xml
Mar 9, 2026
Merged

Add --android-api-version-file support for availability#593
ktoso merged 2 commits intoswiftlang:mainfrom
ktoso:wip-android-api-version-xml

Conversation

@ktoso
Copy link
Collaborator

@ktoso ktoso commented Mar 8, 2026

We parse the xml file and derive availability annotations for Android using it. Turns out the @RequiresApi annotations are a lie and are not present in classes in android.jar, even though it appears as if they are when browsing docs etc; instead, we had to rely on the version xml which is included in the android SDK.

resolves #592

@ktoso ktoso force-pushed the wip-android-api-version-xml branch 7 times, most recently from 0bbdc3d to 2976e08 Compare March 9, 2026 06:01
We parse the xml file and derive availability annotations for Android
using it. Turns out the @RequiresApi annotations are a lie and are not
present in classes in android.jar, even though it appears as if they are
when browsing docs etc; instead, we had to rely on the version xml which
is included in the android SDK.
@ktoso ktoso force-pushed the wip-android-api-version-xml branch from 2976e08 to f9f5add Compare March 9, 2026 06:14
@ktoso ktoso marked this pull request as ready for review March 9, 2026 06:37
@ktoso
Copy link
Collaborator Author

ktoso commented Mar 9, 2026

I also confirmed this actually works when doing a wrap-java on android.jar :-)

ktoso@cherudim [16:48:04] [~/code/swift-java-android-sdk]
-> % ack '@available\(Android' Sources/ | wc -l
   68752

@ktoso ktoso force-pushed the wip-android-api-version-xml branch from 1ad20ef to 9d3d6b3 Compare March 9, 2026 08:15
@ktoso ktoso merged commit cbe9d06 into swiftlang:main Mar 9, 2026
61 checks passed
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.

Use Android's api-versions.xml to inform availability of Android APIs

1 participant