Is there any way to tell the Dokka plugin what fla...
# dokka
k
Is there any way to tell the Dokka plugin what flavor it should build in an Android project? E.g., when trying to run "./gradlew dokkaHtmlMultiModule --no-configuration-cache", it builds this task: "compileReleaseIntKotlin" which is a release flavor. (Release Internal) I'd like to force it to build only the "Debug" variant/flavor or at least tell it not to build ReleaseInt. p.s., this also might be why Dokka is so slowww. Why does it need to build all the flavors?
o
On current moment Dokka has no additional support for android flavours out of the box. By default, Dokka will be executed on all kotlin sourceSets inside module, so in case of android flavours, every flavour has it's own sourceSet, and so in the end Dokka will be executed over all sourceSets of all flavours at once. I think, that it should be possible to just
suppress
sourceSets which are not needed and leave only sourceSet which corresponds to
debug
flavour. Example:
Copy code
tasks.withType<AbstractDokkaTask>().configureEach {
    dokkaSourceSets {
       // releaseInt - flavour to suppress
       named("releaseInt") {
         suppress.set(true)
       }
    }
}
You can also check which sourceSets are enabled to make sure that you've excluded all by adding this code (only during setup, don't forget to remove it later 🙂 ):
Copy code
tasks.withType<AbstractDokkaTask>().configureEach {
  dokkaSourceSets.all {
    println("$name: ${suppress.get()}")
  }
}
k
So this is what I set it to but for some reason, it still tries to build the releaseInt variant 🤔 I know this because there's a missing resource in this variant. I can also confirm that the logger.lifecycle msg prints out in module I added Dokka to that includes all the build variants (the app module). No all modules have Dokka set up (intention is only API modules and this app module). Definitely would explain why Dokka is perceived to be slow if it's building all Android variants...
135 Views