godot-kotlin-jvm icon indicating copy to clipboard operation
godot-kotlin-jvm copied to clipboard

Experimental: Split core and api

Open CedNaru opened this issue 1 year ago • 0 comments

Not meant to be merged but more an experiment to see if we can properly split the current godot-library into 2. So we can keep the api gen outside the core library. The line changes are huge, but at the end of the day, it's just moving stuff around and renaming some packages.

I encourage you to just check out the branch directly and check for yourself. Most of the changes are in the api generator.

The main idea is that the now "core" layer contains Godot global enum + Object + RefCounted, as well as the numbered generic Callable and Signal. Everything else is then generated in the "Api" layer.

The biggest challenge with splitting the library are the circular references between the core and api types. The core layer is fully standalone, it only requires Object and Refcounted to be implemented in it to work. The Api layer needs core as a dependency, the main issue is that now some core internal classes and methods are not available. For this, I now rely on a "hack", I added a public object Internals that indirectly expose the internal methods I need to access. I don't want to keep that hack around, but once everything compile and pass the unit test, it will be much easier to see the set of classes and methods having a visibility issue, and we can proceed forward with improving that.

CedNaru avatar Oct 11 '24 02:10 CedNaru