In this example <https://github.com/Kotlin/dokka/b...
# dokka
a
In this example https://github.com/Kotlin/dokka/blob/master/examples/gradle-v2/basic-gradle-example/build.gradle.kts And the docs https://kotlinlang.org/docs/dokka-gradle.html#single-project-configuration There is “.main” as below:
Copy code
dokka {
  dokkaSourceSets.main {
  }
}
But this errors in AS Quail (2026.1.1). I am using dokka 2.2.0 and kotlin 2.3.21
c
which gradle version do you use?
also check that the
from
is a method of
ConfigurableFileCollection
. in the screenshot the code highlight looks like an extension function.
a
Thanks, I am using Gradle 9.5.0. If I don’t use
.main
like below, it at least compiles:
Copy code
dokka {
    dokkaSourceSets.configureEach {
        includes.from("Readme.md")
    }
}
I don’t see a
.main
extension
c
Then use
.named(“main“)
. Also I guess you cleared Gradle change and did all the other shenanigans, right? And is the original version only an IDE issue or actually a Gradle error?
a
What source sets are available? You can print all names:
Copy code
dokka {
  dokkaSourceSets.all {
    println("dokkaSourceSet: $name")
  }
}
a
@Adam Semenenko I got this on the console
Copy code
dokkaSourceSet: debug
dokkaSourceSet: release
dokkaSourceSet: debugAndroidTest
dokkaSourceSet: debugUnitTest
I have a simple multi-module app, and I’m only using dokka in a library module
Copy code
:app
:filedownload <-- this one has:

alias(libs.plugins.dokka)
dokka { ... } block you posted above
a
Thanks for the info. Unfortunately, the UX isn't great here. The names of the DokkaSourceSets are a 1-on-1 match with the Kotlin source sets. There's no 'main' source set in AGP projects, so
dokkaSourceSets.main {}
won't work.
dokkaSourceSets.release {}
should work... however, AGP registers the Kotlin source sets lazily, which means it doesn't work https://github.com/Kotlin/dokka/issues/4499 Given that you only have a single 'documentable' source set (release), for your project I'd just do:
Copy code
dokka {
  dokkaSourceSets.configureEach {
    // ...
  }
}
This will lazily configure all DokkaSourceSets. Which could be problematic if you have multiple documentable source sets.
👍 1
a
I thought
src/main/kotlin
would be the main sourceset, but I must be confused
a
yeah, it's confusing. In KGP the name of the source dir is related to the name of the SourceSet. But in the AGP world the source dir,
src/main/kotlin
, belongs to SourceSets with other names.
👍 1