dokka icon indicating copy to clipboard operation
dokka copied to clipboard

Dokka 2.0.0 documenting files generated by Room

Open jordyamc opened this issue 4 months ago • 3 comments

Describe the bug Dokka is documenting _impl files generated by Room even when enabling suppressGeneratedFiles

Expected behaviour _impl files not documented

Screenshots Image

To Reproduce

  • Create an Android library project using Room
  • Generate dokka

Dokka configuration

dokka {
    moduleName.set("Hydra core")
    dokkaSourceSets.main {
        includes.from("${rootProject.projectDir}/core/README.md")
        enableAndroidDocumentationLink = false
        suppressGeneratedFiles = true
        sourceLink {
            localDirectory.set(file("src/main/java"))
            remoteUrl("https://github.com/hydra-app/core/tree/master/core/src/main/java")
            remoteLineSuffix.set("#L")
        }
    }
    pluginsConfiguration.html {
        customAssets.from("${rootProject.projectDir}/logo-icon.svg")
        footerMessage = "© 2021-2025 Copyright KNF Apps"
    }
    dokkaPublications.html {
        suppressInheritedMembers.set(true)
        outputDirectory.set(layout.buildDirectory.dir("$rootDir/docs"))
    }
    dokkaPublications.javadoc {
        suppressInheritedMembers.set(true)
        outputDirectory.set(layout.buildDirectory.dir("$rootDir/javadoc"))
    }
}

Installation

  • Operating system: Windows
  • Build tool: Gradle v8.5
  • Dokka version: 2.0.0

jordyamc avatar Aug 19 '25 00:08 jordyamc

Also I'm getting this warnings:

> Task :core:dokkaGeneratePublicationHtml
w: [:core:dokkaGeneratePublicationHtml] For [androidJvm]ModulePreferenceDB_Impl: expected 1 page, but got 2
w: [:core:dokkaGeneratePublicationHtml] For [androidJvm]ModulePreferenceDao_Impl: expected 1 page, but got 2

> Task :core:dokkaGeneratePublicationJavadoc
w: [:core:dokkaGeneratePublicationJavadoc] For ModulePreferenceDB_Impl: expected 1 page, but got 2
w: [:core:dokkaGeneratePublicationJavadoc] For ModulePreferenceDao_Impl: expected 1 page, but got 2

jordyamc avatar Aug 19 '25 05:08 jordyamc

I'm getting the same warning with a module that uses Hilt via KSP:

> Task :modules:di:hilt:dokkaGeneratePublicationHtml
w: [:modules:di:hilt:dokkaGeneratePublicationHtml] For [androidJvm]_example_di_hilt_ProvidesHttpModule: expected 1 page, but got 2

Dokka 2.0.0, near-barebones config:

dokka {
  dokkaSourceSets.configureEach {
    suppressGeneratedFiles.set(true)
  }
}

I then tried adding another line for testing like below:

dokka {
  dokkaSourceSets.configureEach {
    suppressGeneratedFiles.set(true)
+    suppressedFiles.from(layout.buildDirectory.dir("generated"))
  }
}

and it started working (AKA ignoring the generated code) on the Hilt/KSP module, but all other modules started failing like:

A problem was found with the configuration of task ':example:compileReleaseJavaWithJavac' (type 'JavaCompile').
  - Gradle detected a problem with the following location: '/home/path/to/example/build/generated/ap_generated_sources/release/out'.
    
    Reason: Task ':example:dokkaGeneratePublicationHtml' uses this output of task ':example:compileReleaseJavaWithJavac' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    
    Possible solutions:
      1. Declare task ':example:compileReleaseJavaWithJavac' as an input of ':example:dokkaGeneratePublicationHtml'.
      2. Declare an explicit dependency on ':example:compileReleaseJavaWithJavac' from ':example:dokkaGeneratePublicationHtml' using Task#dependsOn.
      3. Declare an explicit dependency on ':example:compileReleaseJavaWithJavac' from ':example:dokkaGeneratePublicationHtml' using Task#mustRunAfter.
    
    For more information, please refer to https://docs.gradle.org/9.1.0/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

So in the short term we can just configure suppressedFiles on the module that needs it, but suppressGeneratedFiles doesn't seem to be picking up the files generated by KSP.

jonapoul avatar Oct 02 '25 19:10 jonapoul

After @jonapoul 's answer, it suppresses in Dokka 2.1.0 by:

dokkaSourceSets.configureEach {
-     suppressGeneratedFiles.set(true)
-     suppressedFiles.from(layout.buildDirectory.dir("generated"))

+    suppressedFiles.from(layout.buildDirectory.dir("generated/ksp"))
}

beigirad avatar Nov 13 '25 07:11 beigirad