save-cli icon indicating copy to clipboard operation
save-cli copied to clipboard

Save: describe the library for plugins injection into the SAVE framework

Open orchestr7 opened this issue 4 years ago • 3 comments

orchestr7 avatar Mar 18 '21 09:03 orchestr7

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.

petertrr avatar Mar 18 '21 10:03 petertrr

Syntax to register custom plugins is save.properties:

plugins=my-plugin:com.example.plugins.MyPlugin

petertrr avatar Apr 27 '21 09:04 petertrr

We could use a more straightforward approach, like in ktor-client:

  • They have a global object engines in core module Loader.kt
  • Implementation of client enigine depends on core module, and inside init block 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 init will be called, but it could be worked around with some dummy stubs

petertrr avatar Aug 11 '21 14:08 petertrr