https://kotlinlang.org logo
#arrow-meta
Title
# arrow-meta
t

thanh

09/16/2019, 10:25 AM
I have one question about the plugin, If I have a library that uses arrow-meta plugin, when an app uses my library, does it need to use arrow-meta as well?
s

shikasd

09/16/2019, 11:43 AM
It doesn't, as libraries are published as compiled artifacts. All the magic will be done before you publish the library 🙂
r

raulraja

09/16/2019, 11:47 AM
For most use cases it won’t but some meta plugins would encourage this. For example if you are defining
@extension object Whatever: TypeClass<Whatever>
and you users want call site automatic resolution they would need the plugin so we can scan their call sites. Kotlin compiler plugins are much more than kapt and codegen and is not limited to stubs since you can also alter body function resolution like the Typeclass plugin does.
I think as a rule of thumb if you just plan on codegen then no, but if you want to provide compiler features for call sites you would need to since you would have to compile the user module with the plugin so call sites can be resolved by the compiler plugin and insert injections accordingly. Of course you don’t need to use it if you want on the call site a Kotlin vanilla experience that just consumes the generated code. For example the optics plugin would be like this since it would just generate codegen for a companion for the most part
t

thanh

09/16/2019, 12:16 PM
thanks, it's clear now 👍
👍 1
3 Views