https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Andrey Larionov

12/10/2023, 7:23 AM
Hello Why does including
dependsOn()
in any sourceSet remove the blue folder icon from
iosMain
? Now: 1.
iosMain
is only visible in Project View 2. There is no syntax highlighting 3. The
iosApp
configuration cannot be run AGP = 8.2.0 KMP = 1.9.20-RC2
j

Jeff Lockhart

12/10/2023, 8:07 AM
It's hard to say without seeing your full build configuration, but what I believe is the cause is that Kotlin 1.9.20 applies the default hierarchy template by default, so long as you don't manually specify any source set
dependsOn
relationships. But if you do, then it no longer applies the default template and assumes you are defining your hierarchy entirely manually. And the ios intermediate source set is defined by the default hierarchy template. You can manually apply the default template with
applyDefaultHierarchyTemplate()
and then specify the additional
dependsOn
relationships. Alternatively, you could also use the experimental hierarchy tree API to add your additional source sets, e.g.:
Copy code
@OptIn(ExperimentalKotlinGradlePluginApi::class)
applyDefaultHierarchyTemplate {
    common {
        group("platform") {
            withAndroidTarget()
        }
    }
}
Side note, is there a reason you're still using the Kotlin RC2 version? Kotlin 1.9.20 and now 1.9.21 are both released now.
♥️ 1
a

Andrey Larionov

12/10/2023, 10:31 AM
Thanks for this article I have no reason for RC2, just forgot to upgrade 😅 It works fine even with 2.0.0-Beta1
👍 1
2 Views