dokka icon indicating copy to clipboard operation
dokka copied to clipboard

Fix classpath when source set has no metadata compilations

Open adam-enko opened this issue 2 months ago • 3 comments

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

adam-enko avatar Oct 14 '25 15:10 adam-enko

JIC: my attempt to fix isMetadata failed because of an issue in AA - https://github.com/Kotlin/dokka/pull/4263

whyoleg avatar Oct 17 '25 13:10 whyoleg

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...

adam-enko avatar Nov 26 '25 17:11 adam-enko

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...

adam-enko avatar Dec 15 '25 10:12 adam-enko