https://kotlinlang.org logo
#dokka
Title
# dokka
k

kenkyee

02/22/2024, 11:24 PM
Has anyone ever done multiple Dokka reports from the same codebase? E.g., I want separate Dokka html report/site for all "api" modules. And a different Dokka report for "all android device tests". And a different one for "test framework which is a bunch of different modules as well a subset of a module". The way multimodule is setup it, it seems like you can only do one report at the root.
m

mbonnin

02/23/2024, 5:04 PM
Try dokkatoo? I do an aggregation in a dedicated module that is not the root. I see no reason it wouldn't work for multiple modules
k

kenkyee

02/23/2024, 6:03 PM
How did I know about this? 😮 Thanks! 🎉 This should be built into Dokka 😛 😞
💯 1
m

mbonnin

02/23/2024, 6:04 PM
@Adam S is the one to thank, I'm just the messenger 🙂
👍 1
❤️ 1
k

kenkyee

02/23/2024, 6:10 PM
wrote up a Feature request issue: https://github.com/adamko-dev/dokkatoo/issues/174 I don't think it'll support aggregations...looks like it's just a friendlier layer over Dokka...
m

mbonnin

02/23/2024, 6:11 PM
What doesn't work with this:?
Copy code
plugins {
  id("dev.adamko.dokkatoo-html") version "$dokkatooVersion"
}

dependencies {
  // aggregate both subproject-hello and subproject-world
  // the subprojects must also have Dokkatoo applied
  dokkatoo(project(":subproject-hello"))
  dokkatoo(project(":subproject-world"))

  // If using Dokkatoo v2.1.0+ a dependency on all-modules-page-plugin is no longer required,
  // see <https://github.com/adamko-dev/dokkatoo/issues/14>
  //dokkatooPluginHtml("org.jetbrains.dokka:all-modules-page-plugin") 

  // Earlier versions of Dokkatoo must manually add a dependency:
  dokkatooPluginHtml(
     dokkatoo.versions.jetbrainsDokka.map { dokkaVersion ->
        "org.jetbrains.dokka:all-modules-page-plugin:$dokkaVersion"
     }
  )
}
k

kenkyee

02/23/2024, 6:14 PM
I want something like this:
Copy code
dokkatooPluginHtml {
   dokkatoo(project(":subproject-a"))
   outputdir = something
}
dokkatooPluginHtml {
   val projects = projects.filter { name.endsWith("test") }
   outputdir = somethingelse
}
dokkatooPluginHtml {
   val projects = projects.filter { name.endsWith("api") }
   dokkatoo(projects)
   outputdir = apidocs
}
m

mbonnin

02/23/2024, 6:16 PM
you can do this with different modules: • core-kdoc • test-kdoc • api-kdoc
If you want this in the root module, dokkatoo doesn't support multiple aggregations in the same module
So that's an issue. But I think the multiple module is fine? Might even be a feature to avoid having too many things in the root module/separation of concerns/etc...
k

kenkyee

02/23/2024, 6:19 PM
ahhh...that's a good hack. Thanks 🙂
💙 1
a

Adam S

02/23/2024, 7:50 PM
you should be able to manually create multiple aggregated publications from a single project with both DGP and Dokkatoo - you'll just have to set it up manually
🤔 1
but yes, creating multiple Gradle subprojects would be better and easier for a whole load of reasons
👍 1