Hi, I am documenting my company's code using Dokka...
# dokka
v
Hi, I am documenting my company's code using Dokka I am facing a few issues can someone please guide me a bit. My output format is html 1. Private members are not visible in the final output 2. All the class names are fully qualified making it harder to navigate and verbose. 3. The navigation has a flat structure and doesn't represent the actual folder hierarchy. I have added this in repo issues too: https://github.com/Kotlin/dokka/issues/3994#issue-2787268324
m
Delete as missing some extensions that I'm using internally in my code
a
This answer isn't correct. It references properties that Dokka doesn't have. Is it AI generated? If so, please delete it.
🙌 1
m
@Adam Semenenko apologise, not AI generated, I forgot that I have these extension in my code, I will delete it and write the full one
a
Thanks for clarifying!
m
One point though, my handler is @Moussa, you are mentioning someone else 👀
🤦 1
a
d'oh, thanks for pointing that out!
👌 1
Sorry for the diversion @vignesh, back to your question....
From comparing the config you provided in the issue with the example, it looks correct. Could you provide a complete reproducer project in the issue?
m
Okay, so I rewrote the logic (sorry about before 🙏 we had a wrapper for using the old and new version while using the same old APIs for convenience until
Dokka
team fully enable the new
Dokka Gradle plugin
and exit experimental phase) using only
Dokka
apis but the bellow is using their new
Dokka Gradle plugin v2
In
gradle.properties
Copy code
# Dokka
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
In
build.gradle.kts
Copy code
plugins {
    kotlin("jvm") version "2.1.0"
    // OR
    kotlin("multiplatform") version "2.1.0"
    id("org.jetbrains.dokka") version "2.0.0"
}

buildscript {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
        classpath("com.android.tools.build:gradle:8.7.3")
        classpath("org.jetbrains.dokka:dokka-base:2.0.0")
    }
}

apply(plugin = "org.jetbrains.dokka")
dokka {
    dokkaSourceSets.configureEach {
        jdkVersion.set(20)
        languageVersion.set("2.1.0")
        apiVersion.set("2.0")
        reportUndocumented.set(true)
        documentedVisibilities(
            VisibilityModifier.Public,
            VisibilityModifier.Private,
            VisibilityModifier.Internal,
            VisibilityModifier.Protected
        )
        sourceLink {
            localDirectory.set(projectDir.resolve("src/commonMain/kotlin"))
            remoteUrl("<https://github.com/$USER/$REPO_NAME/tree/main/src>")
            remoteLineSuffix.set("#L")
        }
    }
    pluginsConfiguration {
        html {
            customAssets.from(rootDir.resolve("Logo.png"))
            footerMessage.set("(c) 2025 $COMPANY_NAME Copyright")
        }
    }
}
And it is working as expected and generating the documentation and including the
Private
members
v
@Adam Semenenko, sorry but what do you mean by reproducer project? should i create a sample proeject and provide its link ?
a
yes that's right, just a standalone project that I can checkout and run locally to help identify the problem
v
working on it, is there any specific thing I need to add ? for not showing the fully classified name ? also what about the structure of navigation ?
a
hold on, I think I might have reproduced it myself...
I can reproduce it in DGPv1, but modifying the visibilities seems to work in DGPv2
v
will try with v2, initially I had tried with v2 then I came back to v1
a
actually I can get it working with DGPv1 if I use this config (kts script)
Copy code
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.DokkaConfiguration.Visibility

tasks.withType<DokkaTask>().configureEach {
    dokkaSourceSets.configureEach {
        documentedVisibilities.set(Visibility.values().toSet())
    }
}
Do you have multiple subprojects? Because that config will need to be applied to each of them
v
yes, but initially i am trying to get to work with the main app module
i am using .gradle actually
Hi, Is it possible to maintain the folder hierarchy when creating the html output doc ?
o
Hi, Is it possible to maintain the folder hierarchy when creating the html output doc ?
Hey, no, it's not possible. Could you tell me about why you might need it?
v
@Oleg Yukhnevich as i have many folders the navigation looks cluttered when the view is flat.
thank you color 1