KhronosGroup / KhronosGroup/KTX-Software
Synchronizing auto-generated files with bindings
- Dominant language
- C++
- Stars
- 1.4k
- Forks
- 317
- Avg merge
- 20h 12m
- Merged PRs (30d)
- 3
Description
(This came up as part of https://github.com/KhronosGroup/KTX-Software/issues/880, but applies to all bindings, and may therefore warrant its own issue)
There are some files that seem to be largely auto-generated. One of them is [`vkFormat2glInternalFormat.inl`](https://github.com/KhronosGroup/KTX-Software/blob/7b08daaaa2f1271d0040d9307156c651f55ad58a/lib/vkFormat2glInternalFormat.inl#L93).
These files usually have corresponding files in the bindings. For example
- [`KtxInternalFormat.java`](https://github.com/KhronosGroup/KTX-Software/blob/7b08daaaa2f1271d0040d9307156c651f55ad58a/interface/java_binding/src/main/java/org/khronos/ktx/KtxInternalformat.java) in the Java bindings
- [`gl_internalformat.py`](https://github.com/KhronosGroup/KTX-Software/blob/7b08daaaa2f1271d0040d9307156c651f55ad58a/interface/python_binding/pyktx/gl_internalformat.py) in the python bindings
As part of a general cleanup of the JNI part, I wanted to check whether these constants definitions are up to date. But
1. without knowing _which_ files are auto-generated, it's hard to decide what has to be done manually
2. doing this manually for all bindings sounds like a maintenance nightmare
I already did it manually for things like `KtxErrorCode.java`, which contains few values, is not auto-generated in the source, and expected to change rarely. But for most of these constants, any manual approach seems infeasible. Just looking at the number of constants, there seem to be 195 cases in `vkFormat2glInternalFormat.inl`, but only 84 cases in `KtxInternalFormat.java`, and there doesn't seem to be a reasonable way to "sync" them manually.
Are there any ideas or preferred ways for updating these files?
(I've seen that, for example, the [`VkFormat.java`](https://github.com/KhronosGroup/KTX-Software/blob/7b08daaaa2f1271d0040d9307156c651f55ad58a/interface/java_binding/src/main/java/org/khronos/ktx/VkFormat.java) already _is_ auto-generated, but I'm not sure how well this would scale to the other files)
In doubt, I'll do an update of the files in the JNI bindings, based on the latest state, with some TextPad macros and helper scripts. But I'm wondering about a more future-proof solution.
Contributor guide
Research direction
Start by comparing lib/vkFormat2glInternalFormat.inl with interface/java_binding/src/main/java/org/khronos/ktx/KtxInternalformat.java and interface/python_binding/pyktx/gl_internalformat.py. Inspect how interface/java_binding generates VkFormat.java, then determine which files are generated and how all bindings should stay synchronized. Done means the generation or maintenance approach is documented and the affected constants have a repeatable update path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, java, python
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100