Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated source folders are not included in documentation #2850

Closed
JakeWharton opened this issue Feb 6, 2023 · 2 comments
Closed

Generated source folders are not included in documentation #2850

JakeWharton opened this issue Feb 6, 2023 · 2 comments
Labels

Comments

@JakeWharton
Copy link

JakeWharton commented Feb 6, 2023

Describe the bug
Tasks which generate public API source do not have those sources included in generated documentation.

Expected behaviour
Documentation includes generated source content.

Screenshots
See below

To Reproduce
Given dokka-bug.zip:

  1. Build project.

    $ ./gradlew assemble`
    
  2. Observe generated sources included in .jar.

    $ unzip -l build/libs/dokka-bug-jvm.jar
    Archive:  build/libs/dokka-bug-jvm.jar
      Length      Date    Time    Name
    ---------  ---------- -----   ----
            0  02-01-1980 00:00   META-INF/
           25  02-01-1980 00:00   META-INF/MANIFEST.MF
           24  02-01-1980 00:00   META-INF/dokka-bug.kotlin_module
            0  02-01-1980 00:00   com/
            0  02-01-1980 00:00   com/example/
          484  02-01-1980 00:00   com/example/GeneratedApi.class
          475  02-01-1980 00:00   com/example/StaticApi.class
    ---------                     -------
         1008                     7 files
    
  3. Build Dokka HTML.

    $ ./gradlew dokkaHtml
    
  4. Observe generated sources not included in output.

    $ open build/dokka/html/index.html
    
    Screen Shot 2023-02-06 at 1 50 02 PM

Installation

  • Operating system: macOS/Windows/Linux
  • Build tool: Gradle 7.6
  • Dokka version: 1.7.20
@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented Feb 8, 2023

Thanks for the reproducer!

Seeing how the original issue is tagged with "PR welcome", I thought I'd return the favor by sending one :)

For some reason, generated sources are suppressed by Dokka by default - not sure what the reasoning behind the default value is.

However, there's an option that allows you to control it. For the reproducer project:

dokkaHtml {
  dokkaSourceSets {
    configureEach {
      suppressGeneratedFiles.set(false)
    }
  }
}

Perhaps, it should be automatically set to false (i.e document generated sources) in certain scenarios, as we sometimes have similar questions (such as #2821) that come from Android/KMP projects.

Like if certain libraries/plugins are used or code-generating tasks are present, given we can identify them somehow. Emitting a warning ("you have undocumented generated code") could be an option, but it might be annoying to see each time. Do you have any thoughts on that?

@IgnatBeresnev
Copy link
Member

I'll close the issue as the problem was fixed downstream, but any thoughts on my comment above would be appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants