save-cli
save-cli copied to clipboard
Save: describe the library for plugins injection into the SAVE framework
Base class is defined in save-core. Need to find all implementations in library provided in runtime, based on names passed in configuration.
Possible option: dlopen/dlsym for .so files on Linux (link) (what about windows/mac then?). Need to check if it can be used from Kotlin/Native or at least via cinterop.
Syntax to register custom plugins is save.properties:
plugins=my-plugin:com.example.plugins.MyPlugin
We could use a more straightforward approach, like in ktor-client:
- They have a global object
enginesin core module Loader.kt - Implementation of client enigine depends on core module, and inside
initblock registers itself in this global collection: https://github.com/ktorio/ktor/blob/1bd92eaa4974dc0b09757c635895ce0e38474a95/ktor-client/ktor-client-curl/posix/src/io/ktor/client/engine/curl/Curl.kt#L28 - Implementation is also an object, so that this
initwill be called, but it could be worked around with some dummy stubs