Closed jakoss closed 1 year ago
Thank you for the PR!
There is one issue @mcarleio - i believe it's something with the proxy. When i'm trying to pass TestScope::class as annotation parameter the ksp fails (cannot resolve that class name). There is a failing test with repro named factoryScopedWithClass, please take a look at a spare time.
Yeah, I had the same problem with e.g. @KonvertTo
and could only solve it, by not using getAnnotationsByType
. That is the main reason for the AnnotationData. The problem is, that you can reference a class, which is being compiled at the same time and then the ksp method is sadly not working as expected.
- Pass ksp options to injector, so we can use some options directly in injectors themselves. This is related to the next feature
- Add option to specify default injecting annotation for all mappers. For example - i know the 99% of my mappers will be simply annotated with a @Factory without any additions. So instead of adding @KFactory to every single interface i create maybe it would be nice to add some ksp option, like konvert.koin-injector.default-annotation: @KFactory
This should already be possible, but is not documented well. You can simply access the configuration via
import io.mcarle.konvert.converter.api.config.Configuration
Configuration.CURRENT.get("konvert.koin-injector.default-annotation")
I think it would be good to have all possible configuration keys in KonvertOptions. To simplify usage, I would recommend to implement something like this and use it in your injector.
Also it would be beneficial to run build action in pull requests too :)
I would have thought that GitHub will show a "Approve and run" button in this PR, because you are a First-time contributor here. But there is no button and I am unsure why. I suspect the
permissions:
packages: write
part, so maybe I have to extract the release part from the build.yml
.
There is one issue @mcarleio - i believe it's something with the proxy. When i'm trying to pass TestScope::class as annotation parameter the ksp fails (cannot resolve that class name). There is a failing test with repro named factoryScopedWithClass, please take a look at a spare time.
Yeah, I had the same problem with e.g.
@KonvertTo
and could only solve it, by not usinggetAnnotationsByType
. That is the main reason for the AnnotationData. The problem is, that you can reference a class, which is being compiled at the same time and then the ksp method is sadly not working as expected.
I'll look at that tomorrow.
I would have thought that GitHub will show a "Approve and run" button in this PR, because you are a First-time contributor here. But there is no button and I am unsure why. I suspect the
permissions: packages: write
part, so maybe I have to extract the release part from the
build.yml
.
Don't you need to add
on:
pull_request:
types: [ opened, synchronize, reopened ]
to your workflow?
Don't you need to add
on: pull_request: types: [ opened, synchronize, reopened ]
to your workflow?
Oh, you are right, I have no pull_request
defined... I just added it (and split the build and release workflows) - hope it works now :+1:
Yeah, I had the same problem with e.g.
@KonvertTo
and could only solve it, by not usinggetAnnotationsByType
. That is the main reason for the AnnotationData. The problem is, that you can reference a class, which is being compiled at the same time and then the ksp method is sadly not working as expected.
I think i figured it out, but please take a look if you can spot something fishy.
I can add the default factory injectors in another PR
Patch coverage: 88.46
% and project coverage change: +0.08
:tada:
Comparison is base (
76e51e6
) 82.13% compared to head (c851cb1
) 82.22%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
I think i figured it out, but please take a look if you can spot something fishy.
Feels a bit strange to have to handle the annotations like that, but I also have no other good idea 🤔
Could you please amend the KoinInjector
to do the same logic for these examples:
@KFactory(Factory(binds=[SomeClass::class]))
@KSingle(Single(binds=[SomeClass::class]))
@KScoped(Scoped(binds=[SomeClass::class]))
To have to test coverage collected for the new modules, please amend the root build.gradle.kts
and add
kover(project(":injectors:koin-annotations"))
kover(project(":injectors:koin-injector"))
Sure, will do
@mcarleio I'm just running both methods on all annotations now, i think that covers all of possible use cases
Implements adding Koin annotations defined in here: https://insert-koin.io/docs/reference/koin-annotations/definitions
There is one issue @mcarleio - i believe it's something with the proxy. When i'm trying to pass
TestScope::class
as annotation parameter the ksp fails (cannot resolve that class name). There is a failing test with repro namedfactoryScopedWithClass
, please take a look at a spare time.As to injectors themselves - super solution, adding new one was very easy. There are two features i'd love to have:
@Factory
without any additions. So instead of adding@KFactory
to every single interface i create maybe it would be nice to add some ksp option, likekonvert.koin-injector.default-annotation: @KFactory
Also it would be beneficial to run build action in pull requests too :)