Closed madebr closed 1 week ago
@slouken Creating an Android package for SDL would be easy because it has 0 dependencies. But for the satellite libraries, the situation will complicate a lot. For SDL_image: will we provide support for third party libraries such as zlib, libjpeg, .... For SDL_ttf: libHarfbuzz and libFreetype are a hard requirement. Same applies to SDL_mixer.
Since creating an Android AAR is only a matter of re-packaging, I think this should be left to package maintainers.
Do most projects use .android in their namespace?
To be honest, I don't have much experience with packages from the OSS maven repo.
So far, I was only using dependencies from Google.
My logic to include the .android
is to make it clear it is for Android and it is not a java binding for example.
@slouken Would it be fine if we went ahead with this for SDL2 2.26.x?
Please register org.libsdl
here.
My username there is madebr
(=useful to allow others make releases).
To prove ownership, you'll have to create a TXT record at libsdl.org (which we'll know after we've registered).
Hey @madebr, just so you know I'm consuming a lot of your work with SDL2 on Android lately. It is a bit scattered around and I had to fill in some knowledge gaps here and there (NDK docs are very much lacking at times), but your prefab scripts helped me save a lot of hair, so kudos and thank you very much for making your scripts find their way to SDL's repos.
In the end I was able to run SDL2 + curl + SDL2_image on Android using local AAR prefab dependencies, but I agree that it would be easier if libsdl supported deploying official builds to a public maven repository. I would be willing to invest some time helping if you find two more hands would be great to have. I have experience with enterprise Java so it might come in handy.
This is on my list to look at once SDL3 changes slow down, thanks @madebr!
@ericoporto I think you commented in the wrong issue.
@slouken
Since https://github.com/libsdl-org/SDL/commit/45081db9d41eaaf92c61da8acde4e7f11a0bf302, the build-release.py script creates an android SDL3-3.1.2.aar
Android archive.
Do you intend to add these to the "official" release binaries?
If so, I'll need to add documentation to README-android.md
.
I need to chat with you about how all the different Android builds work together. Can you send e-mail to slouken@libsdl.org to coordinate?
I just shot you a mail, and a friend request on Discord.
Thinking more about this issue. Perhaps it's more fitting for the SDL project to simply provide a SDL3 aar Android archive. The SDL project does currently also not provide "official" binaries for other package managers. Interested packagers can always respin the aar-chive, and publish it themselves.
My idea is to simply publish e.g. SDL3-3.1.2.aar, alongside the source, windows and apple archives. This archive can then be used in Android gradle projects by adding it to their dependencies. An example Android aarchive can be found at the bottom of this page.
This sounds like a good plan. This means that users don't have to build SDL themselves and can drop an official release into their builds. Let's go with that.
Should we change the existing android-project framework to reflect this model? Can/should we fix buildandroid.sh to set up a project using this?
Should we change the existing android-project framework to reflect this model? Can/should we fix buildandroid.sh to set up a project using this?
I went the NIH way, and replaced buildandroid.sh
with create-android-project.py
in #10177
The python script has identical behavior of the sh script, with the extra capability to create a project making use of prefab aar archives (--variant aar
)
Sounds good.
Things left to do:
docs/README-android.md
@madebr, can you do the documentation portion of this for SDL 3.2?
@madebr, can you do the documentation portion of this for SDL 3.2?
Can do :)
I think using the aar is documented in https://github.com/libsdl-org/SDL/blob/main/docs/README-android.md#using-the-sdl3-android-archive-aar
It's used in libsdl-org/SDL_helloworld here
The repo now contains a script to build an android prefab archive. The next problem is how to get these published to Maven Central, so SDL becomes available in all new Android gradle projects.
This requires a few checks and actions:
[ ] Create Central Repository account: Maven documentation says OSS projects should apply to OSS Repository Hosting.
org.libsdl
by creating a new project.org.libsdl
so we can create as many subgroups as required (we currently only needorg.libsdl.android
).[ ] Versioning: Change/modification/deletion/updating a released packaged is impossible. So only create a release when we're confident it's ok.
-SNAPSHOT
suffixes to review the release progress.[ ] Project namespace. In the SDL and SDL_image pr, I made the executive decision to use
org.libsdl.android
as namespace for all SDL libraries. Is this fine for now (and eternity)?[ ] Comply with requirements. The current prefab aar is monolithic, so I might need to pull it apart. But I'm unsure how to do that for a non-Java project. I think https://github.com/libsdl-org/SDL/pull/6314 makes it compliant, but I'm not 100% sure.
[ ] The android docker image I used to develop the prefab script uses the latest android ndk/sdk version, which we probably don't want to use as build base. Should I look into creating a docker image using older sdk/ndk?