Hi, When configuring a project with the `kotlin("...
# multiplatform
g
Hi, When configuring a project with the
kotlin("multiplatform")
plugin we can do something like:
Copy code
val jvmMain by getting {
...
}
but how our build process knows that if we write
jvmMain2
in the variable name instead of
jvmMain
our sourceset does not exist? My motivation is that I would like to do something similar, probably using my
buildSrc
, but I don’t know which kind of magic we are using here. Is the kotlin build process somehow extracting the variable names and comparing them with the available sourcesets?
r
Extracting the variable name part comes from property delegates feature. You get reflected property instance from which you can get the name. https://kotlinlang.org/docs/reference/delegated-properties.html As for the sourcesets, you just check the model of the project you have.
g
Hum, thanks, indeed. I’ve already read the delegates documentation but I wasn’t remembering that we could get the property name there. Thanks