-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Godot Android plugin re-architecture #80740
Godot Android plugin re-architecture #80740
Conversation
Will wait on the documentation to be completed, to test both the documentation and plugin architecture itself |
Thanks! Looking through the PR and the sample, it looks like including a GDExtension as part of an Android plugin works like this:
... so that the .so file doesn't get include in the export like it normally would with a GDExtension.
Do I have this right? If so, this seems a little convoluted. Is there a reason we couldn't skip step nr 2, by having an
I'm also a little unclear on why Sorry for all the dumb questions - I think I'm missing a bunch of context around how Android plugins work :-) |
That's correct, the plugin's aar binary contains the .so file so we need to let
Following #78958, all Android plugins are now From that perspective, this PR adds a new capability (gdextension) to 4.x Android plugins, so the approach then is to base off the
The proposed architecture covers two primary use-cases:
When using a Godot Android plugin and exporting from the Godot Editor, the normal mechanism does pick up and load the GDExtensions and However the normal mechanism is set up by the Godot Editor export logic and it's not available when using different tools / IDEs.
Yes, when the
No dumb at all and please keep them coming! They help me figure out what I need to cover in the (in-progress) documentation! |
Ok, thanks for the detailed explanation! This is definitely making a little more sense to me. :-)
In the case of Android plugins that don't need to do anything special in the editor, would they still need to provide an Or, if the I think part of what feels weird here is that we're doing half of the export customization work in a custom In any case, I think I need to spend a little more time poking at the samples to improve my understanding of all this. |
ARCore plugin is actually a good example for the functionality added by the Here's an example from the OpenXR plugin: https://github.com/GodotVR/godot_openxr_loaders/blob/master/demo/addons/godotopenxr/export/meta/godot_openxr_meta_editor_export_plugin.gd#L88-L147 When nothing special is required besides providing access to the AAR binary, then export logic is fairly simple: https://github.com/m4gr3d/Godot-Android-Samples/blob/master/plugins/hello_world/src/main/assets/addons/hello_world_plugin/.export/hello_world_editor_export_plugin.gd
That was the first approach I looked into; the issue is that the As such the only mean I found to change its behavior is via the .gdextension config files. |
What if we change it in a more Android-specific way? Like I mentioned above, I'm not sure I can think of any other use case for the What if we added a different section like in my first comment, ex:
And then modify That has the advantage of (1) putting both these complementary export customizations in the same place, and (2) not having the super generic |
d34a150
to
a7787c8
Compare
As a follow-up from the GDExtension discussion, I've updated the configuration for Android plugins' gdextension:
The presence of that field (with a |
…e Android plugin refactor PR See godotengine/godot#80740 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Added a
android_aar_plugin = [ true | false ]
key to theconfiguration
section
I like the inclusion of "aar" in the name of the setting, that'll make it even more clear what this is for (as opposed to just android_plugin
).
With regard to the GDExtension changes, I'm personally happy with this now!
I'm not really qualified to review the Android changes, but insofar as I've come to understand the Android plugin stuff while reviewing this, it generally makes sense to me how someone would include a GDExtension in their Android plugin.
Alright I tried the PR on top of my ARCore PR changes. There are several errors that I get but it could be that I just haven't implemented the binding side in the extension correctly: Error Message
Edit: After looking through your sample project Fredia I noticed that there is still a lot of configuration work on the plugin side needed to comply with the system you set and also to debug the bugs I encountered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comment style pointers
a7787c8
to
8a1321a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Something to keep in mind once we put a template together, and possibly also for the documentation, is that with GDExtensions in Godot 4 it is imperative that extensions are compiled not just for Android, but also for the OS in which the developer is running the IDE, or the developer won't be able to actually write code that accesses the plugin. This may involve creating dummy plugins for the host OS just so the API is published to the editor.
It would be nice if the examples in godot-cpp could be enhanced to package up plugins in an AAR to show how cross platform plugins can be build.
The example in godot-cpp was removed in favor of automated tests with the plan to eventually create a repo with several examples. This is something that could be added there! Although, there's already https://github.com/m4gr3d/Godot-Android-Samples with the one GDExtension example |
8a1321a
to
27316a8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed during the production meeting and we approve with the PR.
efcd934
to
2cf00e8
Compare
2cf00e8
to
8cc7739
Compare
Thanks! |
@tokengamedev Early draft for the documentation update available in godotengine/godot-docs#7884 |
Third scheduled Android refactor (after #76821 and #78958) for the upcoming Godot 4.2 release.
TLDR;
This refactor focuses on cleaning up and restoring full functionality for Godot Android plugins, which have effectively been (partially) broken since the Godot 4.0 release.
Godot 4.x Android plugins (v2)
Versioning
In Godot 3.x, the following metadata was required in the plugin's AndroidManifest to declare it:
For Godot 4.2 and higher, the metadata remains mostly the same, but the version is bumped to
v2
:At runtime, the engine only loads plugins with the
org.godotengine.plugin.v2
prefix. TheGodotPlugin
base class has been modified in a non-backward compatible manner, so Godot 3.x Android plugins (with theorg.godotengine.plugin.v1
prefix) are no longer supported in Godot 4.2 and higher.Packaging
The plugin's packaging was re-done in #78958, deprecating the use of the
.gdap
format used in Godot 3.x in order to better align with Godot other plugin types. The documentation will be updated in a follow-up PR to describe the new packaging format.GDExtension integration
In Godot 3.x, Godot Android plugins provided the ability to integrate GDNative functionality.
Similarly, this PR adds the ability for v2 Godot Android plugins to integrate with GDExtension functionality starting with Godot 4.2.
In addition, this PR fixes the issue that prevented the Godot Android editor from loading and using GDExtension plugins
Samples
Remaining TODOs