Hey, i got a problem with my dokka documentation. ...
# dokka
n
Hey, i got a problem with my dokka documentation. My classes get printed 5 times and i got these logs in the console. Does anyone know, what causes this 'issue'?
1
j
Do you happen to have multiple source sets (or android variants) that contain the same class definitions?
n
I don't think we have multiple source sets. But we got multiple buildvariants like, debug, release, etc. And some build flavors. May that be the cause?
j
yeah, I think the build flavors will affect. Do you have the same classes in the different build flavors?
n
yeah, it uses the sam classes. Is there a way to build the documentation only for one flavor? Or to supress the other ones?
j
It’s a bit tricky but the way I did it is by disabling all dokkaSourceSets except the one for the variant name:
Copy code
// First disable all dokka source sets except the `variantName` one that will be used later
    dokkaSourceSets.configureEach {
      suppress.set(name != variantName)
    }
then manually add the source sets to the dokka source set:
Copy code
// To avoid undocumented inherited methods/classes we need to join all the source roots
    // related to the flavor release variant into one source set (`variantName`).
    dokkaSourceSets.named(variantName) {
      sourceSets.forEach {
        it.javaDirectories.forEach { javaDirectory ->
          sourceRoots.from(javaDirectory)
        }
      }
    }
sourceSets
can be acquired from the android plugin:
Copy code
libraryVariants.all {
   // here you can access sourceSets
}
Unfortunately, I can’t share my solution since it’s quite tight to our project. Hopefully this points you towards the right direction
n
Yeah, that looks great! Thank you so far! 🙂
i
Hey! Unfortunately, I don't know much about android and its build variants to suggest a better solution (if there's even one), but it would help if you could create an issue and describe your use case for why you want to do it or which problem it solves. There's a number of android-specific issues already, some of them are related to build variants, so hopefully one day we'll get to addressing them