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

DGPv2: missing dokkaGenerateHtml and dokkaGenerateJavadoc lifecycle tasks #3960

Open
3 tasks
adam-enko opened this issue Dec 18, 2024 · 1 comment
Open
3 tasks
Labels
bug runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin

Comments

@adam-enko
Copy link
Member

The DGPv2 migration docs reference tasks that don't exist

| Gradle task | `./gradlew :dokkaGenerateHtml` | `./gradlew :dokkaGenerateJavadoc` | `./gradlew :dokkaGenerate` |

The tasks should exist, and the tasks names are defined here, but for some unknown reason they are not registered as tasks (mistake while copying Dokkatoo? Or during another PR? Or were they intentionally removed?).

Tasks

  • Find out what tasks should be used instead of dokkaGenerateHtml and dokkaGenerateJavadoc. (Probably dokkaGeneratePublicationHtml?)
  • The docs should be updated to remove the references. Instead replace them with the above.
  • Investigate and determine if the tasks should be re-added. (I'm on the fence. I think it's confusing if there's too many tasks, but on the other hand dokkaGeneratePublicationHtml is a mouthful, and there's no obvious difference between it and dokkaGenerateModuleHtml, so a shorter lifecycle helper task could help.)
@adam-enko adam-enko added bug runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin labels Dec 18, 2024
@StefMa
Copy link
Contributor

StefMa commented Jan 7, 2025

Hi @adam-enko,

I also just ran into this problem.
I agree that it is super confusing for developers to have dokkaGeneratePublicationHtml and dokkaGenerateModuleHtml but no dokkaGenerateHtml. Actually you don't know the difference btween publication and module 👀

I just jumped within the code and observerd the following:

  • The DokkaBasePlugin will generate the dokkaGenerate task
  • The DokkaHtmlPlugin (not sure where this gets instantiated) has html as format name
  • The DokkaHtmlPlugin is a instance of DokkaFormatPlugin
  • The DokkaFormatPlugin (that has now html as format) create a publication with html and use publication.formatName as argument for the DokkaFormatTasks
  • The publication.formatName is identical to the original format name (so still html)
  • The DokkaFormatTasks however, only provides dokkaGeneratePublication(FormatName) and dokkaGenerateModule(FormatName) tasks. There is no sign of a generic dokkaGenerate(FormatName) task instantiation. Without having much knowledge about the code base, I think it should be here 👀 that is the reason why I mention it 🙃

I'm not sure if any of this helps 🙈
But just wanted to drop it here.

In case someone is searching why I faced this issue:
I had this before:

val dokkaJar = tasks.register<Jar>("dokkaJar") {
    dependsOn(tasks.dokkaHtml)
    from(tasks.dokkaHtml.flatMap { it.outputDirectory })
    archiveClassifier.set("javadoc")
}

And searched how to replace that.
This is the "new solution":

// New
val dokkaJar = tasks.register<Jar>("dokkaJar") {
    dependsOn(tasks.dokkaGenerate)
    from(tasks.dokkaGeneratePublicationHtml.flatMap { it.outputDirectory })
    archiveClassifier.set("javadoc")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

No branches or pull requests

2 participants