jwharm / java-gi

GObject-Introspection bindings generator for Java
GNU Lesser General Public License v2.1
84 stars 7 forks source link

New GIR parser and code generator #82

Closed jwharm closed 7 months ago

jwharm commented 7 months ago

The GIR model and code generation have been split into separate packages and classes. This improves the organization and readability of the Java-GI code.

The GIR parser and model have been rewritten. The model is now mostly immutable, and very close to the actual GIR file. It is not mutated in any way after the parser is finished, so it's safe to use in parallel builds.

All patches have been rewritten to apply to the new GIR model. Patches don't update the GIR model in-place anymore, but are run as a transformation step while the GIR model is being built.

The code generator has been entirely rewritten with the JavaPoet code generation library. This results in several improvements:

The Gradle build now uses a Gradle Build Service that parses GIR files and keeps the models in a HashMap. Every module runs a generateSources task that requests the models from the build service. As a result, every GIR file is only parsed and patched once, the build is fully parallel, and is structured relatively simple.

There have been a few other, smaller improvements along the way. The entire buildSrc structure has basically been rewritten with this PR.

The runtime classes (under modules/.../src) have not been changed in any meaningful way.

This PR should not result in any functional changes (at least not on purpose). The API is still the same, except for the things that were explicitly deprecated in Java-GI 0.8.