I have a goal to inject some code invocations in m...
# arrow
r
I have a goal to inject some code invocations in my functions calls. Something like http://github.com/jakewharton/hugo (compiler plugin + AspectJ bytecode weaving + Android Gradle Transform API). And I remember
Arrow
team was working on better-compiler-plugin-environment-writing for Kotlin. Should I check it out?
a
Arrow Meta may offer you a simpler way to do that, indeed
đź‘Ť 1
j
In Arrow Inject we want to add “interceptors” which can help with this too
r
@Javier is there a ticket for that task?
j
No, we have a PR open for moving arrow inject to arrow proofs repo, but we haven't explored the interceptors feature yet
Well indeed the PR was merged
you can check the current state in the main branch
I recommend checking those tests to understand how it will work, but that is the basic DI part, nothing about interceptors https://github.com/arrow-kt/arrow-proofs/tree/main/arrow-inject-compiler-plugin/src/testData/box/context-receivers
❤️ 1
r
@Javier I've checked it out, looks good for injections like DI(at quick look). But I need a resulting code modification. Like adding analytics calls in generated code.
Copy code
@LogEvent(eventName="user_pressed_button)
fun onButtonPressed(){
    ...
}
And the generated code would be:
Copy code
fun onButtonPressed(){
...
sendAnalytics("user_pressed_button")
}
So it seems like
Meta
is my choice, what do you think @Javier
j
At this moment yes, that kind of injection will be available in arrow inject too