Fix classpath when source set has no metadata compilations
When an intermediate KotlinSourceSet has no metadata compilation (e.g. webMain, mingwMain), the classpath misses the required dependencies (e.g. kotlin-stdlib, or those defined in buildscripts).
This PR updates the logic for determining the classpath. If a source set has no primary compilations, and it has no metadata compilations, then the classpath should be aggregated from the 'leaf' source sets.
Additionally, update kotlin-multiplatform-example to compile(!), and test webMain.
Workaround for:
- https://youtrack.jetbrains.com/issue/KT-80551
- https://github.com/Kotlin/dokka/issues/4116
JIC: my attempt to fix isMetadata failed because of an issue in AA - https://github.com/Kotlin/dokka/pull/4263
I've discussed more with @abdulowork and we think we've found a better workaround. We can use IdeMultiplatformImport to get the same data that IJ uses.
I'll have another attempt...
Unfortunately while IdeMultiplatformImport returns the required klibs, it doesn't seem to be very stable. The KGP task that uses IdeMultiplatformImport disables CC and caching. In DGP it triggers lots of warnings when used with AGP:
Configuration 'jvmCompileClasspath' was resolved during configuration time.
This is a build performance and scalability issue.
See https://github.com/gradle/gradle/issues/2298
Investigations are ongoing...