Marc Knaup
10/15/2020, 12:47 AMif (coroutinesAvailable) GlobalScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) { … } else …
streetsofboston
10/15/2020, 12:57 AMZach Klippenstein (he/him) [MOD]
10/15/2020, 12:58 AMGlobalScope
class, and if it loads successfully, then make assume coroutines are available and actually make the calls. But watch out for version mismatches, you could get LinkageErrors if the runtime version of coroutines is different than what you compiled with. It’s pretty hacky, so i wouldn’t do that unless you have a really good reason.Marc Knaup
10/15/2020, 1:06 AMif (library x is installed) …
gildor
10/15/2020, 3:33 AMMarc Knaup
10/15/2020, 3:45 AMmy-lib-with-di-with-bson-with-graphql
my-lib-with-di-without-bson-with-graphql
my-lib-with-di-without-bson-without-graphql
…gildor
10/15/2020, 3:49 AMMarc Knaup
10/15/2020, 1:09 PMlog-library
-> log-library-slf4j
+ log-library-jul
etc.
I’m talking about breaking large libraries or frameworks into composable smaller libraries.
My framework has many components that you can mix as you need like MongoDB, GraphQL, Dependency Injection etc.
Now if you add “MongoDB” for example the component would dynamically check if you also use “Dependency Injection” and if so would provide “MongoDB”-specific dependencies through that DI component.
That only works if I can do that dynamically, otherwise I’d add a lot of dependencies although the user doesn’t use them.
Unfortunately compileOnly
is absolutely not usable on native 😕