It can be convenient to use the delegated property when you want to re-use the variable, for example, creating a hierarchy
Copy code
sourceSets {
val commonMain by getting {}
val commonTest by getting {}
val nativeMain by creating { dependsOn(commonMain) }
val nativeTest by creating { dependsOn(commonTest) }
But yes, the ‘unused variable’ warning is annoying
k
Kevin S
03/16/2023, 5:16 PM
cool thanks! So is
by getting
the recommended approach for multiplatform sourcesets?
a
Adam S
03/16/2023, 5:17 PM
no problem! I’m not sure if
by getting
is recommended per se, but it’s certainly more common in the documentation
j
jw
03/16/2023, 5:17 PM
It doesn't matter. It's more your level of tolerance for the extreme cuteness of the Kotlin DSL or not