Does anyone have a crash course how compilation vs...
# gradle
m
Does anyone have a crash course how compilation vs source sets work in KGP? Can I add a dependency to a compilation? Without having to go through source sets?
👀 2
a
I am also very interested in this from a multiplatform setting ofcourse
m
Yea, KMP is where it gets interesting. I've been monkey adding dependencies for years now but for the sake of me I cannot grasp the magic that ties it all together
t
KotlinCompilation
and
KotlinSourceSet
have very blurred borders between each other. Regarding your question: • you could access main source set for give compilation via KotlinCompilation.defaultSourceSet •
KotlinCompilation
currently also extends HasKotlinDependencies interface, but we are deprecating it in 2.3.0 release
👀 1
👍🏾 1
m
So the default sourceSet is
jvmMain
for an example, right? It's the "leaf" source set, right?
t
yes, for JVM target
main
compilation it is
jvmMain
thank you color 1
m
That could work for my use case!
(I'm trying to set
kotlin-stdlib
to a certain version on JVM compilations and another version on all the other ones, still chewing that bone)
🦴 1