Web: publish module descriptor

This commit is contained in:
faumaray committed 2026-07-28 23:32:34 +03:00
1 parent be961cd73d
commit a727f9c6cd
3 files changed
+84

No files matched your search

+8
View File
@@ -34,6 +34,11 @@ endif()
file(GLOB_RECURSE WEB_SOURCES CONFIGURE_DEPENDS "src/**.cpp")
add_library(EchoionWeb SHARED ${WEB_SOURCES})
add_library(Echoion::Web ALIAS EchoionWeb)
target_compile_definitions(EchoionWeb PRIVATE
ECHOION_MODULE_BUILD
ECHOION_COMPONENT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
ECHOION_COMPONENT_VERSION_MINOR=${PROJECT_VERSION_MINOR}
ECHOION_COMPONENT_VERSION_PATCH=${PROJECT_VERSION_PATCH})
set_target_properties(EchoionWeb PROPERTIES
EXPORT_NAME Web
OUTPUT_NAME echoion-web
@@ -64,6 +69,7 @@ find_package(Threads REQUIRED)
target_link_libraries(EchoionWeb
PUBLIC
Echoion::ApiConfig
Echoion::ApiModuleAbi
Void::Data
Void::Log
Void::Async
@@ -166,6 +172,8 @@ install(TARGETS EchoionWeb
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
INCLUDES DESTINATION include)
install(DIRECTORY include/ DESTINATION include)
install(FILES abi/module.json
DESTINATION "${CMAKE_INSTALL_DATADIR}/echoion/components/EchoionWeb/${PROJECT_VERSION}/abi")
install(EXPORT EchoionWebTargets
FILE EchoionWebTargets.cmake
NAMESPACE Echoion::
+14
View File
@@ -0,0 +1,14 @@
{
"schemaVersion": 1,
"contractId": "echoion.module.web",
"descriptor": "Void::Plugin::ModuleDescriptor",
"moduleId": "EchoionWeb",
"activation": "restart-required",
"dependencies": [
{
"moduleId": "EchoionApi",
"versionRange": "^2.0.0",
"abiHash": "sha256:336492a52097dd12f222bb6d9acab19e8eb6a502eab45bb78127bce6d733fbd3"
}
]
}
+62
View File
@@ -0,0 +1,62 @@
#include <echoion/api/module/Module.hpp>
#include <memory>
#include <string_view>
namespace Echoion::Web
{
namespace
{
class WebModule final : public Void::Plugin::IModule
{
public:
[[nodiscard]] std::string_view name() const noexcept override
{
return "EchoionWeb";
}
};
std::unique_ptr<Void::Plugin::IModule> createWebModule()
{
return std::make_unique<WebModule>();
}
} // namespace
const Void::Plugin::ModuleDescriptor& webModuleDescriptor()
{
static const Void::Plugin::ModuleDescriptor descriptor{
.module_id = "EchoionWeb",
.component_version = {
.major = ECHOION_COMPONENT_VERSION_MAJOR,
.minor = ECHOION_COMPONENT_VERSION_MINOR,
.patch = ECHOION_COMPONENT_VERSION_PATCH,
.pre_release = {},
.build = {},
},
.abi_hash =
"sha256:858dfd3a19804e42a63fa8694a70ebe07ee90485a886df1ac07cf91bb5d34316",
.abi_contract = Void::Json::object({
{"schemaVersion", 1},
{"contractId", "echoion.module.web"},
{"descriptor", "Void::Plugin::ModuleDescriptor"},
}),
.dependencies = {
{
.module_id = "EchoionApi",
.version_range = "^2.0.0",
.abi_hash = "sha256:336492a52097dd12f222bb6d9acab19e8eb6a502eab45bb78127bce6d733fbd3",
},
},
.activation_policy =
Void::Plugin::ActivationPolicy::RestartRequired,
.create = createWebModule,
};
return descriptor;
}
} // namespace Echoion::Web
extern "C" ECHOION_MODULE_EXPORT const Void::Plugin::ModuleDescriptor*
echoion_module_query()
{
return &Echoion::Web::webModuleDescriptor();
}