DGPv2: missing `dokkaGenerateHtml` and `dokkaGenerateJavadoc` lifecycle tasks
The DGPv2 migration docs reference tasks that don't exist
https://github.com/Kotlin/dokka/blob/fc574c855fb75a4fe30185aa9f12b74295b095d4/docs/topics/dokka-migration.md?plain=1#L405
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
dokkaGenerateHtmlanddokkaGenerateJavadoc. (ProbablydokkaGeneratePublicationHtml?) - [ ] 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
dokkaGeneratePublicationHtmlis a mouthful, and there's no obvious difference between it anddokkaGenerateModuleHtml, so a shorter lifecycle helper task could help.)
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
DokkaBasePluginwill generate thedokkaGeneratetask - The
DokkaHtmlPlugin(not sure where this gets instantiated) hashtmlas format name - The
DokkaHtmlPluginis a instance ofDokkaFormatPlugin - The
DokkaFormatPlugin(that has nowhtmlas format) create apublicationwithhtmland usepublication.formatNameas argument for theDokkaFormatTasks - The
publication.formatNameis identical to the original format name (so stillhtml) - The
DokkaFormatTaskshowever, only providesdokkaGeneratePublication(FormatName)anddokkaGenerateModule(FormatName)tasks. There is no sign of a genericdokkaGenerate(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")
}