outadoc
09/03/2025, 5:10 PMDokkaTask, and suppress the source sets I'm not interested in.
How would I achieve this with V2, as registering Dokka tasks now seems to be unsupported?outadoc
09/04/2025, 12:43 PMdokka {
moduleName = "Sample"
pluginsConfiguration {
html {
footerMessage = "© Hello World"
}
}
dokkaSourceSets.configureEach {
suppress = true
perPackageOption {
matchingRegex.set(".*\\.internal(\\..*)?")
suppress = true
}
}
dokkaPublications.configureEach {
suppressInheritedMembers = true
}
}
android.libraryVariants.configureEach { variant ->
tasks.register("dokkaGeneratePublicationHtml${variant.name.capitalize()}") {
group = "dokka"
dependsOn(tasks.named("dokkaGeneratePublicationHtml"))
dokka {
dokkaSourceSets.create("custom_${variant.name.capitalize()}") {
displayName = variant.name
suppress = false
suppressGeneratedFiles = false
sourceRoots.from(
dokkaSourceSets.getByName(variant.buildType.name).sourceRoots,
dokkaSourceSets.getByName(variant.flavorName).sourceRoots,
dokkaSourceSets.getByName(variant.name).sourceRoots,
dokkaSourceSets.getByName("main").sourceRoots,
)
}
}
}
}Oleg Yukhnevich
09/05/2025, 11:35 AMformat tasks, but the sourceSets configuration will be shared across all tasks/formats.
Do you mind sharing the use case on why you need to generate completely independent HTML sites for each build variant? Is it like an internal multi-flavor library? It would help to better understand the requirements and possibilities
Coming back to your example, I'm not sure that this will work correctly when building documentation for all variants simultaneously, as those source sets will be shared across all tasks.
One option, if that's fine, could be to create a Gradle property, and select (or suppress) specific variants based on it, so that you will be able to do something like this:
./gradlew :dokkaGenerate -PuseVariantForDokka=mainoutadoc
09/05/2025, 11:55 AMOleg Yukhnevich
09/12/2025, 12:20 PMoutadoc
09/12/2025, 12:28 PM