Skip to content

derive module name and version from metadata.json in templates#94

Open
tascvh wants to merge 1 commit into
logos-co:masterfrom
tascvh:metadata-as-source-of-truth
Open

derive module name and version from metadata.json in templates#94
tascvh wants to merge 1 commit into
logos-co:masterfrom
tascvh:metadata-as-source-of-truth

Conversation

@tascvh
Copy link
Copy Markdown

@tascvh tascvh commented May 8, 2026

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants