I’m trying to get a generated .kt file to show up in the
dokkaHtml
output for my Gradle Android library module and I can’t get it to work. The file is generated in
build/generated/source/myDir/main
, is added to
android.sourceSets.main.java.srcDirs
, and is used in source code which successfully compiles.
I’ve tried a bunch of different permutations of configuration that looks like this:
dokkaHtml {
dokkaSourceSets {
configureEach {
jdkVersion.set 8
logger.lifecycle "$project adding sourceRoot $myDirRoot"
sourceRoot.from(file(stringsRoot))
}
}
}
With this exact configuration,
:myModule:dokkaHtml
fails due to “> NamedDomainObjectContainer#create(String) on GradleDokkaSourceSetBuilder container cannot be executed in the current context.” If I use
sourceRoot(
(without the
.from
), it doesn’t fail, but the generated class still doesn’t appear in the docs.
I’ve also tried adding it as a custom source set or setting
myDirRoot
as an absolute or relative path, to no avail. Any clue what I’m doing wrong?