Plugin: publish reloadable module contract
This commit is contained in:
4 files changed
+58
-1
No files matched your search
+39
-1
@@ -1,3 +1,4 @@
|
||||
#include <echoion/api/module/Module.hpp>
|
||||
#include <echoion/plugins/short_url/ExternalShortener.hpp>
|
||||
|
||||
#include <ExtensionPlugin.hpp>
|
||||
@@ -105,10 +106,47 @@ namespace Echoion::Plugins::ShortUrl
|
||||
bool dormant_ = false;
|
||||
};
|
||||
|
||||
std::unique_ptr<Void::Plugin::IModule> createModule()
|
||||
{
|
||||
return std::make_unique<ExternalShortenerPlugin>();
|
||||
}
|
||||
|
||||
const Void::Plugin::ModuleDescriptor& moduleDescriptor()
|
||||
{
|
||||
static const Void::Plugin::ModuleDescriptor descriptor{
|
||||
.module_id = "url-shortener-external",
|
||||
.component_version = {.major = 2, .minor = 0, .patch = 0},
|
||||
.abi_hash =
|
||||
"sha256:251e3fa0ee8228cb2eb79b399deee58524b64fbb4764c8a2644357b3502354fe",
|
||||
.abi_contract = Void::Json::object({
|
||||
{"schemaVersion", 1},
|
||||
{"contractId", "echoion.plugin.url-shortener-external"},
|
||||
{"descriptor", "Void::Plugin::ModuleDescriptor"},
|
||||
}),
|
||||
.dependencies =
|
||||
{
|
||||
{
|
||||
.module_id = "EchoionApi",
|
||||
.version_range = "^2.0.0",
|
||||
.abi_hash =
|
||||
"sha256:336492a52097dd12f222bb6d9acab19e8eb6a502eab45bb78127bce6d733fbd3",
|
||||
},
|
||||
},
|
||||
.activation_policy = Void::Plugin::ActivationPolicy::Reloadable,
|
||||
.create = createModule,
|
||||
};
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
} // namespace Echoion::Plugins::ShortUrl
|
||||
|
||||
extern "C" {
|
||||
|
||||
const Void::Plugin::ModuleDescriptor* echoion_module_query()
|
||||
{
|
||||
return &Echoion::Plugins::ShortUrl::moduleDescriptor();
|
||||
}
|
||||
|
||||
void* void_plugin_create()
|
||||
{
|
||||
return std::make_unique<
|
||||
@@ -128,7 +166,7 @@ Void::Plugin::PluginInfo void_plugin_info()
|
||||
return {
|
||||
.abi_version = Void::Plugin::ABI_VERSION,
|
||||
.name = "url-shortener-external",
|
||||
.plugin_version = "1.0.0",
|
||||
.plugin_version = ECHOION_COMPONENT_VERSION,
|
||||
.description = "Configurable external URL-shortening adapter",
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user