https://kotlinlang.org logo
Title
d

dave08

05/18/2023, 12:56 PM
Also, it seems like Optics is VERY handy for cleanly setting up fixtures in unit tests... but for now I'd rather not have all the deps of optics included in the main app, just the
@optics
annotation and have optics generate even the data classes from the main app code only for the testing environment. Is that possible?
s

simon.vergauwen

05/18/2023, 1:17 PM
Yes, that should be possible. KSP is the tool that decides where the code is generated. I remember doing this somewhere, but its been a long time I can’t remember where or where I left the code :/
d

dave08

05/18/2023, 1:27 PM
So just using
kspTest
will generate everything in the testing module (even from the main module), or does this need a special setup?
And is there a maven repo just for the
@optics
annotation, or do I need to include the whole optics core in the main module?
s

simon.vergauwen

05/18/2023, 3:38 PM
You can rely on arrow-annotations for just the annotation.
d

dave08

05/18/2023, 3:40 PM
It would be sooo nice if the docs for each module would have it's maven module/s there for handy reference... part of them are in getting started, but when one is reading the docs about optics, obviously they'd want to include that in their build, whereas not everyone getting started would.
The required module section there.