dokka icon indicating copy to clipboard operation
dokka copied to clipboard

Source sets without standard 'Main' suffix has invalid displayName convention (Why is my part of my code missing source links?)

Open iseki0 opened this issue 8 months ago • 3 comments

Question I configured the source link and I think it was configured correctly. But some code have (Source) link and some are not. And, some docs pages look buggly.

Screenshots

Link Image

Image

Installation

  • Operating system: Linux
  • Build tool: Gradle v8.13
  • Dokka version: 2.0.0

Additional information Project URL: https://github.com/iseki0/Executables

iseki0 avatar Apr 11 '25 04:04 iseki0

Hey! Thanks for the report! The issue is rather cumbersome, but I was able to decipher what happened.

I opened the project locally and found that the Dokka configuration created by DGP contained two source sets with different sourceSetID but the same displayName (= common). So, our front end was not ready for this. It happened because, in the project, there was a source set named nativeFileUnsupported (without the Main or Test suffix). So it caused the following branch to be executed, so causing nativeFileUnsupported sourceSet to have display name equals to common.

As for the workaround/fix, it's better to rename nativeFileUnsupported to nativeFileUnsupportedMain to follow convention—in this case, there will be no errors. (Additionally, target hierarchy similar to this one could help).

As for the fix inside DGPv2, we could probably change the fallback to just the name of the sourceSet instead of platform.displayName? cc @adam-enko May be it would be nice to even add a check for displayName similar to what we already have for sourceSetID. @vmishenev WDYT?

whyoleg avatar Apr 15 '25 12:04 whyoleg

As for the fix inside DGPv2, we could probably change the fallback to just the name of the sourceSet instead of platform.displayName? cc @adam-enko

Yeah, that makes sense to me.

In case it helps with figuring out if changing the default name is okay, I believe the logic is the same as in DGPv1 here.

adam-enko avatar Apr 15 '25 13:04 adam-enko

In case it helps with figuring out if changing the default name is okay, I believe the logic is the same as in DGPv1 here.

Thanks! Yeah, it looks like DGPv1 has the same logic as my proposal

whyoleg avatar Apr 15 '25 13:04 whyoleg