-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scan more than one component at the time #182
base: 2.0.0
Are you sure you want to change the base?
Conversation
let's go on branch v2 as it's a new feature / improvement proposal |
I propose to keep one dedicated annotation, with No doubling of Can you update your code? 🙏 |
@arnaudgiuliani |
*/ | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FIELD) | ||
annotation class ComponentScan(val value: String = "") | ||
annotation class ComponentScan(val values: Array<String> = [""]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be empty array here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or perhaps useless 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oki, I'll remove default empty string value.
CI failed. Can you look at this? @vivodikj :
|
@arnaudgiuliani about the CI failed. It's look like CI don't use new "updated" version of coin annotations. Maybe they don't use created mavenLocal repository but mavenCentral repository. Where is not new componentScan annotation with values array. We can edit build.gradle.kts (examples) to first check for dependencies in mavenLocal and then in mavenCentral. allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
}
} To: allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
}
} |
@vivodikj I'm about to merge your PR. We have a conflict in the sample project |
@arnaudgiuliani No more conflict :) |
Great job 👍 |
I'm sorry. I'm gathering all the release stuff. The problem is that we are breaking compatibility on @componentscan. This was also your proposal to add another annotation. :/ 🙏 Let's find how too mitigate that. We could use an extra Annotation property? 🤔 |
Yes, that's why I created another annotation in the first place. We could add extra new property to existing Ya, I think this PR with #131 will be very good combination. |
@arnaudgiuliani Maybe I found a pretty good solution. We can make value in |
Yeah, clearly. Let's add the /**
* Gather definitions declared with Koin definition annotation
* Will scan in the current package or an explicit package path name
* Also can scan across multiple package paths.
*
* @param value: path to scan
* @param paths : list of path to scan
*/
@Target(AnnotationTarget.CLASS, AnnotationTarget.FIELD)
annotation class ComponentScan(val value: String = "", val paths: Array<String> = []) What do you think? |
our messages get crossed. Yeah interesting proposal. Not sure people used @componentscan with |
Me and my team don't use |
Summary
This PR create an option for add more packages in scanning component feature, inspired by this issue. With this change, developers can use new
@ComponetsScan
annotation withvalues
parameter where they can add all needed packages. The original@ComponentScan
annotations is 100% preserved and now can cooperate with new@ComponetsScan
.All tests still passes like a charm and new test passed without any problem.
Examples
Before
After 1. variant
After 2. variant
After 1. variant if we want scan actual package
After 2. variant if we want scan actual package
NOTE:
If dev use
@ComponentsScan
or@ComponentsScan([])
or@ComponentsScan([""])
this will scan actual package like original@ComponentScan
.If dev add non existing or correct package name to
@ComponentsScan
values, the package will be ignored and nothing happens.If dev add multiple package names to
@ComponentsScan
values, only one will be used and multiple package names error is not shown.