Plugin: publish reloadable module contract
This commit is contained in:
4 files changed
+58
-1
No files matched your search
@@ -0,0 +1,2 @@
|
||||
build*/
|
||||
.cache/
|
||||
@@ -41,9 +41,12 @@ add_library(EchoionUrlShortenerExternalPlugin MODULE
|
||||
target_include_directories(EchoionUrlShortenerExternalPlugin PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
target_compile_features(EchoionUrlShortenerExternalPlugin PRIVATE cxx_std_26)
|
||||
target_compile_definitions(EchoionUrlShortenerExternalPlugin PRIVATE
|
||||
"ECHOION_COMPONENT_VERSION=\"${PROJECT_VERSION}\"")
|
||||
target_link_libraries(EchoionUrlShortenerExternalPlugin PRIVATE
|
||||
Echoion::ApiPlugin
|
||||
Echoion::ApiConfig
|
||||
Echoion::ApiModuleAbi
|
||||
Echoion::ApiPluginSdk
|
||||
Void::ShortUrl
|
||||
Void::Data
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"contractId": "echoion.plugin.url-shortener-external",
|
||||
"descriptor": "Void::Plugin::ModuleDescriptor",
|
||||
"moduleId": "url-shortener-external",
|
||||
"activationPolicy": "reloadable",
|
||||
"services": [
|
||||
{
|
||||
"id": "void.short-url",
|
||||
"version": 1,
|
||||
"type": "Void::ShortUrl::IShortener"
|
||||
}
|
||||
]
|
||||
}
|
||||
+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