derive module name and version from metadata.json in templates#94
Open
tascvh wants to merge 1 commit into
Open
derive module name and version from metadata.json in templates#94tascvh wants to merge 1 commit into
tascvh wants to merge 1 commit into
Conversation
Before this change, a module's name and version appeared in three places: metadata.json, the CMakeLists.txt NAME argument, and the name()/version() return values in the plugin header. Renaming a module meant updating all three manually and keeping them in sync. metadata.json is the single source of truth for module identity. `name` and `version` is now set once in metadata.json and read at configure time (via string(JSON ...)), generating module_config.h into the build directory. Plugin headers include this header and return MODULE_NAME / MODULE_VERSION instead of hardcoded string literals. Does not apply to ui-qml — it has no C++ plugin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
iurimatias
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently name() and version() must be implemented in PluginInterface, but they need to be changed manually whenever the module's identity changes. The name also has to be set separately in CMakeLists.txt. This means renaming or versioning a module touches at least three places and they can drift out of sync.
This patch makes metadata.json the single source of truth for every plugin. During the Nix build, CMake reads name and version from metadata.json and generates a module_config.h into the build directory. Plugin headers include this generated header and return MODULE_NAME / MODULE_VERSION instead of hardcoded string literals. The logos_module() NAME argument is also driven from the same read, so renaming and versioning is now managed entirely from metadata.json