Describe the bug
The generated code uses calls to Module.viewModel { } that are referencing the "old" Koin 3.5.6 API. Warnings are then emitted to the build log when using Koin 4.0.0:
w: /src/project/build/generated/ksp/prodRelease/kotlin/org/koin/ksp/generated/KoinDefault--104252179.kt:8:63 'fun <reified T : ViewModel> Module.viewModel(qualifier: Qualifier? = ..., noinline definition: Scope.(ParametersHolder) -> T): KoinDefinition<T>' is deprecated. Moved ViewModel DSL package. Remove old imports and use org.koin.core.module.dsl.*.
This is an issue, because the generated code is treated as "normal" code due to adding the generated/ sources as part of the sourceSets. If building with allWarningsAsError, the build will fail. The only solution is to downgrade koin.
To Reproduce
Use both Koin-Annotations 1.4.0-RC4 and Koin 4.0.0 in the same project, declare a @KoinViewModel, build.
Expected behavior
The generated code should not emit warnings. Ideally, swapping to another code generation solution (a compiler plugin, maybe?) would remove the necessity to include the generated code in the sourceset. Otherwise, provide an option similar to KOIN_USE_COMPOSE_VIEWMODEL like arg("KOIN_USE_TARGETED_API", "4.0") to generate code based on the target. Not making it a simple true/false option would allow you to easily change code generation should something get deprecated in, say, 4.2
Koin project used and used version (please complete the following information):
koin-annotations 1.4.0-RC4
koin 4.0.0
Additional moduleDefinition
Add any other moduleDefinition about the problem here.
Describe the bug The generated code uses calls to
Module.viewModel { }
that are referencing the "old" Koin 3.5.6 API. Warnings are then emitted to the build log when using Koin 4.0.0:This is an issue, because the generated code is treated as "normal" code due to adding the generated/ sources as part of the sourceSets. If building with allWarningsAsError, the build will fail. The only solution is to downgrade koin.
To Reproduce Use both Koin-Annotations 1.4.0-RC4 and Koin 4.0.0 in the same project, declare a @KoinViewModel, build.
Expected behavior The generated code should not emit warnings. Ideally, swapping to another code generation solution (a compiler plugin, maybe?) would remove the necessity to include the generated code in the sourceset. Otherwise, provide an option similar to KOIN_USE_COMPOSE_VIEWMODEL like arg("KOIN_USE_TARGETED_API", "4.0") to generate code based on the target. Not making it a simple true/false option would allow you to easily change code generation should something get deprecated in, say, 4.2
Koin project used and used version (please complete the following information): koin-annotations 1.4.0-RC4 koin 4.0.0
Additional moduleDefinition Add any other moduleDefinition about the problem here.