|
2 | 2 |
|
3 | 3 | ## General |
4 | 4 |
|
5 | | -To make it more language agnostic, the entry generator provides a set of model classes which represent the needed information about the source code by the entry genenerator. |
| 5 | +To make it more language agnostic, the entry generator provides a set of model classes which represent the needed information about the source code by the entry generator. |
6 | 6 | It expects this information to be gathered and assembled by the calling tool and to be provided in the entry point of the entry generator. |
7 | 7 |
|
8 | 8 | For Kotlin, Java and Scala, this tool is `godot-class-graph-symbol-processor`, which analyses the byte code, and gathers the information needed by the entry generator. |
9 | 9 | It then calls the entry generator which in turn generates the needed entry files. |
10 | 10 |
|
11 | | -## The godot-kotlin-symbol-processor |
| 11 | +## The godot-class-graph-symbol-processor |
12 | 12 |
|
13 | | -Previously, we implemented our own compiler plugin based on the [mpapt](https://github.com/Foso/MpApt) project. |
| 13 | +Previously, we implemented our own compiler plugin based on the [mpapt](https://github.com/Foso/MpApt) and [ksp](https://github.com/google/ksp) project. |
14 | 14 | Even though it worked very well, the code was far from easy to understand and as the compiler plugin API is not stable yet. |
15 | | -Furthermore, `MpApt` introduced a lot of maintenance work to keep it up to date with the ever evolving Kotlin compiler. |
| 15 | +Furthermore, `MpApt` introduced a lot of maintenance work to keep it up to date with the ever evolving Kotlin compiler and `Ksp` wasn't able to process Scala files. |
16 | 16 |
|
17 | | -To mitigate that problem we switched to [KSP (Kotlin Symbol Processing API)](https://github.com/google/ksp) which is basically a Kotlin Annotation Processor (KAPT) on steroids. |
18 | | -Meaning it in essence is a compiler plugin which lets you inspect the source code being compiled through a abstracted and simplified API. |
19 | | -This means for us that we can work against a more stable API and the work of keeping it up to date with Kotlin compiler changes is offloaded |
20 | | -to a well maintained open source project with far more people with better knowledge about the internal workings of the Kotlin compiler. |
| 17 | +To mitigate that problem we switched to [ClassGraph](https://github.com/classgraph/classgraph) which is Bytecode processor. |
| 18 | +Meaning it in essence is a compiler plugin which lets you inspect the compiled bytecode with an abstracted and simplified API. |
| 19 | +This means for us that we can work against a more stable API and the work of keeping it up to date with the Kotlin language is removed. |
21 | 20 |
|
22 | | -We use our implementation of a Kotlin Symbol Processing to gather all needed information for the entry generator and convert it into the format it understands. |
23 | | -With this it should be more easy to implement additional JVM languages as the entry generator itself can stay the same for all languages. Only the symbol processor has to change per language. |
24 | | - |
25 | | -## Default Value Extraction |
26 | | - |
27 | | -We extract the default values with the help of JetBrains' [Program Structure Interface (PSI)](https://plugins.jetbrains.com/docs/intellij/psi.html), |
28 | | -that is a language specific AST (Abstract Syntax Tree). But as the simplified API of KSP does not allow the introspection of the source code representation, |
29 | | -we implemented this ourselves in the `godot-kotlin-symbol-processor` as well. |
| 21 | +We use ClassGraph to gather all needed information for the entry generator and convert it into the format it understands. |
| 22 | +With this it should be far easier to implement additional JVM languages as ClassGraph is language agnostic and only minor tweak are necessary to support additional static languages. |
30 | 23 |
|
31 | 24 | ## Debugging |
32 | 25 |
|
33 | | -As `godot-kotlin-symbol-processor` is a Kotlin compiler plugin and thus the execution context of the entry generator is as well, |
| 26 | +TODO: Write the new way to debug the bytecode processing |
| 27 | + |
| 28 | +As `godot-class-graph-symbol-processor` is a Kotlin compiler plugin and thus the execution context of the entry generator is as well, |
34 | 29 | it cannot be debugged traditionally by just clicking the Debug button on the `build` task in IntelliJ IDEA like you would do normally for KAPT annotation processors. |
35 | 30 |
|
36 | 31 | To debug a project, open a terminal, change to project's root directory and type the following command: |
|
0 commit comments