Skip to content

Commit

Permalink
Add version information to generated module code (#150)
Browse files Browse the repository at this point in the history
* module loader template: pass project and version information to loader

This requires that the project version information is generated during
the build process and then this is passed down to the module loader class.

If this information is not available, then simple fallback values are used.

At the end, this allows to call the module on command line with parameter --version.

Signed-off-by: Michael Heimpold <[email protected]>

* Add missing GIT_VERSION

Signed-off-by: Kai-Uwe Hermann <[email protected]>

* Bump version to 0.2.0

Signed-off-by: Kai-Uwe Hermann <[email protected]>

---------

Signed-off-by: Michael Heimpold <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Co-authored-by: Michael Heimpold <[email protected]>
  • Loading branch information
hikinggrass and mhei authored Jun 14, 2024
1 parent 2ab347a commit 84534b5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ev-dev-tools/src/ev_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""EVerest command line utility."""
__version__ = '0.1.1'
__version__ = '0.2.0'
13 changes: 12 additions & 1 deletion ev-dev-tools/src/ev_cli/templates/ld-ev.cpp.j2
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@

#include <framework/runtime.hpp>
#include <utils/types.hpp>
#include <generated/version_information.hpp>
#ifndef PROJECT_NAME
#define PROJECT_NAME "undefined project"
#endif
#ifndef PROJECT_VERSION
#define PROJECT_VERSION "undefined version"
#endif
#ifndef GIT_VERSION
#define GIT_VERSION "undefined git version"
#endif

{% if info.enable_global_errors %}
#include <utils/error/error_manager_req_global.hpp>
Expand Down Expand Up @@ -137,7 +147,8 @@ std::vector<Everest::cmd> everest_register(const json& connections) {
int main(int argc, char* argv[]) {
auto module_loader = Everest::ModuleLoader(argc, argv, Everest::ModuleCallbacks(
module::register_module_adapter, module::everest_register,
module::LdEverest::init, module::LdEverest::ready));
module::LdEverest::init, module::LdEverest::ready),
{PROJECT_NAME, PROJECT_VERSION, GIT_VERSION});

return module_loader.initialize();
}

0 comments on commit 84534b5

Please sign in to comment.