utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
614 stars 44 forks source link

Kotlin reflection not always applied to bootstrap jar in exported projects #571

Closed chippmann closed 6 months ago

chippmann commented 8 months ago

In editor everything works as expected. The bootstrap jar we ship with the editor build does include kotlin-reflect (full and jvm) due to: #452 .

As a reminder for the following; currently the exported bootstrap jar is not the same as the one we ship with the editor. The one that get's actually exported is built together with the users project. Whether this still makes sense or not is not part of this issue and should be looked at individually later on in a follow up issue!

In simple reflection use cases, exported projects do work. The exported bootstrap jar does contain the necessary reflect classes. If one however defines the following jackson dependency in the project (i strongly assume there are many other such dependencies out there) implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.16.1"), the reflect classes are suddenly missing from the exported bootstrap jar and upon reflection usage, a crash occurs stating that kotlin-reflect is missing.

If a user manually replaces the built bootstrap jar in the build directory before exporting the game, the code works as the reflection classes are present. Some other classes are stripped as well but these are expected (such as tool classes only used for editor builds).

chippmann commented 8 months ago

@MartinHaeusler FYI And please add further information if i forgot something