We are looking for (beta) testers of the new Arrow...
# arrow
a
We are looking for (beta) testers of the new Arrow Optics Gradle plugin This new plugin makes it easier to configure and use Arrow Optics. No more tinkering with KSP or define useless companion objects! However, we need you help to ensure the plugin works. If you want to help, follow these steps: 1. Remove any previous configuration you had about Arrow Optics KSP plugin 2. Add
id("io.arrow-kt.optics") version "2.2.0-beta.8"
in your
plugins
block 3. Add
gradlePluginPortal()
to your
repositories
(
dependencyResolutionManagement.repositories
) block 4. Add a call to
arrowOptics()
at the end of your
kotlin
block (doesn't matter if its a JVM or KMP project) Then try to run the compilation and see nothing fails. Afterwards, try to remove useless companion objects tyou created only for Arrow Optics and see whether everything still works. Thanks in advance for all your help!
👀 2
s
It seems I need to add
gradlePluginPortal()
not only to my
pluginManagement.repositories
, but also to
dependencyResolutionManagement.repositories
. Is that intentional?
a
It is not intentional, but a side effect of the architecture of the plugin (the same binary bundles a Gradle and a Kotlin compiler plugin) 😕
s
Got it working now. First thing I notice is that it doesn't seem to generate
internal
companion objects for internal data classes. That unfortunately causes a compiler error. This is generated properly:
Copy code
@optics
data class SomePublicDataClass(val name: String)
This does not compile:
Copy code
@optics
internal data class SomeInternalDataClass(val name: String)
Writing the internal companion object manually still works, though, even with the plugin applied.
Copy code
@optics
internal data class SomeInternalDataClass(val name: String) {
    internal companion object
}
👍 1
Out of curiosity, is the split now that a compiler plugin generates the companion object, and KSP still generates the regular optics code? And is the end goal to have everything generated by the compiler plugin? Cause right now it's a little awkward with the KSP-generated code referencing a companion object that “doesn't exist” (when reading build/generated/ksp/ in the editor).
a
Yes, that's exactly how it works. The long-term strategy is to migrate everything to a compiler plugin, but we lack the manpower to make this transition now, so we're trying to pluck the low-hanging fruit
s
Perfect. Thanks! Also, from most of my testing now, this works very well! Looking forward to not having to create empty companion objects! 🙌
🎉 2
kodee loving 1
a
The new
beta.11
no longer requires adding
gradlePluginPortal
to your
reposiotories
🙂 @sindrenm would you mind checking if this still works for you?
s
Oh, awesome! But I'm away from my computer for a few weeks now (going on vacation), so I won't be able to check until I get back. 😅
a
enjoy your holidays then 🏝️ / ⛷️ / 🏛️
s
Thanks a lot! 😀
Well, a bit late, but it definitely works now! 😀
🎉 1