Hello again, related to my issue above (https://kotlinlang.slack.com/archives/C19FD9681/p1713353555262869) on missing dependencies, I actually remembered a similar use case of when we transitioned from 1.8.22 to 1.9.+. kotlin-annotation-processing-gradle was a runtime dependency of the kotlin-gradle-plugin and that was dropped in 1.9.+. Is this another use case of the dynamic addition of dependencies?
t
tapchicoma
04/18/2024, 4:52 PM
Gradle has two separate and isolated "sets" of dependencies - one that are used to run the build tool itself (plugins) and another are used for actual build (compilation) process.
To simplify life for users KGP adds some of such commonly build process dependencies automatically (e.g. Kotlin compiler, stdlib, etc.). But KGP should not directly depends on dependencies required only for build process as they will end up in the build tool dependencies. That is why it will be not possible to configure such build process dependencies as
runtimeOnly
for KGP.
Historically KGP has a direct dependency on Kotlin compiler, that is why you don't see the problem with it. It was costly decision and we will remove such in 2.1.0 release.
h
Hugo Costa
04/18/2024, 4:58 PM
Ok, so for my specific use case, it's best if we maintain a "additional runtime dependencies" list to add on top of the ones listed on Maven? There is no chance of having them listed as optional since, in practice, there are use cases where these libraries are used?
t
tapchicoma
04/18/2024, 5:02 PM
such dynamic dependencies version may differ based on project configuration. For example, there is a feature request for 2.0.20 to use stdlib version based on the configured
apiVersion
.
if we maintain a "additional runtime dependencies" list to add on top of the ones listed on Maven
Currently I would say - yes.
tapchicoma
04/18/2024, 5:03 PM
still you could open a Kotlin issue describing your use case
h
Hugo Costa
04/18/2024, 5:23 PM
interesting, indeed that would be something we could not support with our existing tooling
Hugo Costa
04/18/2024, 5:25 PM
I'll open up a case, I imagine that my use case isn't unique, even with that dynamic versioning, it might make sense to have the optional deps there. Thank you 🙂