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

Add GDNative libraries to Android custom Gradle builds #49911

Merged
merged 1 commit into from
Jun 29, 2021

Conversation

madmiraal
Copy link
Contributor

Currently, GDNative libraries are not being copied into the custom build project directories when doing an Android Custom Build. The files are simply ignored:

Error ignore_so_file(void *p_userdata, const SharedObject &p_so) {
return OK;
}

This PR ensures the GDNative libraries are copied to the correct directory; so that they're automatically included when Gradle builds the project.

Fixes #49878

Copy link
Contributor

@m4gr3d m4gr3d left a comment

Choose a reason for hiding this comment

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

The logic looks straightforward! I'm wondering if we need to delete the added so files on rebuild. Otherwise it seems like a previously added so file might continue to be included in the generated binary even if it's removed from the project.

platform/android/export/export.cpp Show resolved Hide resolved
@madmiraal
Copy link
Contributor Author

I'm wondering if we need to delete the added so files on rebuild.

I thought about that. The problem is, it's impossible to tell what library has been removed, and we don't want to simply remove all the libraries, because the user may, as part of their custom build, be including other libraries manually.

@pouleyKetchoupp
Copy link
Contributor

I'm wondering if we need to delete the added so files on rebuild.

I thought about that. The problem is, it's impossible to tell what library has been removed, and we don't want to simply remove all the libraries, because the user may, as part of their custom build, be including other libraries manually.

We could include a .json file (or equivalent) in the export folder that lists the GDNative library files that have been included, so on rebuild the process can know which files to remove.

@madmiraal
Copy link
Contributor Author

Updated to use a JSON to store copied .so files, which are removed at the start of a new build.

platform/android/export/export.cpp Outdated Show resolved Hide resolved
platform/android/export/export.cpp Outdated Show resolved Hide resolved
@akien-mga akien-mga merged commit 52e3f98 into godotengine:master Jun 29, 2021
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android export does not include native libraries when using Custom Template
4 participants