While diagnosing a publishing issue on my KMP proj...
# dokka
s
While diagnosing a publishing issue on my KMP project, I ran a gradle publish task with --info. The project is using
applyDefaultHierarchyTemplate()
so all the sourceSet names fit that template. Dokka produced a number of messages that surprised me, as if it doesn't understand the default hierarchy template. I posted the messages as a reply in this thread. Basically all the source sets that aren't leaf nodes in the default template are getting labeled as common. That seems to lead to it generating doc from appleMain into all the platforms, not just the Apple ones, etc. Is this expected behavior?
Copy code
[:KmpIO] source set nativeMain has 1 dependents commonMain
[:KmpIO] Dokka could not determine KotlinPlatform for nativeMain from targets [iosArm64, iosSimulatorArm64, iosX64, linuxArm64, linuxX64, macosArm64, macosX64, metadata, metadata, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for nativeMain from targets [iosArm64, iosSimulatorArm64, iosX64, linuxArm64, linuxX64, macosArm64, macosX64, metadata, metadata, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for macosMain from targets [macosArm64, macosX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for macosMain from targets [macosArm64, macosX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for linuxMain from targets [linuxArm64, linuxX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for linuxMain from targets [linuxArm64, linuxX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for iosMain from targets [iosArm64, iosSimulatorArm64, iosX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for iosMain from targets [iosArm64, iosSimulatorArm64, iosX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for commonMain from targets [android, android, iosArm64, iosSimulatorArm64, iosX64, jvm, linuxArm64, linuxX64, macosArm64, macosX64, metadata, metadata, metadata, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [AndroidJVM, Native, JVM, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for commonMain from targets [android, android, iosArm64, iosSimulatorArm64, iosX64, jvm, linuxArm64, linuxX64, macosArm64, macosX64, metadata, metadata, metadata, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [AndroidJVM, Native, JVM, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for appleMain from targets [iosArm64, iosSimulatorArm64, iosX64, macosArm64, macosX64, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
[:KmpIO] Dokka could not determine KotlinPlatform for appleMain from targets [iosArm64, iosSimulatorArm64, iosX64, macosArm64, macosX64, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
This can be recreated with github repo Dokka V2 example repo for KMP.
o
@Adam Semenenko could you take a look?
a
I'll look more deeply, but my first guess is https://github.com/Kotlin/dokka/issues/4081
thank you color 1
okay, I've looked and it seems to be behaving correctly to me. The source sets being logged are: • commonMain • iosMain • linuxMain • macosMain • nativeMain Technically these are 'common' source sets, as in they are all parents for target specific source sets. For example, linuxMain is a common source set for linuxArm64Main and linuxX64Main. I added that log message to help us diagnose any misconfiguration, in case DGP mistakenly assumed a target source set was common, or a common source set actually had a target. Here log message tells us the shared source sets are correctly being considered as 'common'.
o
Thanks! I agree that e.g.,
linuxMain
should be currently treated as
common
in Dokka, but for me, the log message is a bit misleading, for example:
Copy code
Dokka could not determine KotlinPlatform for linuxMain from targets [linuxArm64, linuxX64, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
or
Copy code
Dokka could not determine KotlinPlatform for nativeMain from targets [iosArm64, iosSimulatorArm64, iosX64, linuxArm64, linuxX64, macosArm64, macosX64, metadata, metadata, metadata, metadata, metadata]. Dokka will assume this is a Common source set. (All platforms: [Native, Common])
It's hard to decipher what is
metadata
and where they are coming from... At my side, I would be very confused seeing such a message in logs (as was a topic-started). Maybe we can do something about it?
That seems to lead to it generating doc from appleMain into all the platforms, not just the Apple ones, etc.
Coming back to the original question, could you expand on what you mean here? Maybe some specific example of what's going wrong?