https://kotlinlang.org logo
#dokka
Title
r

rbares

11/13/2020, 12:48 PM
Hi all, I'm trying to get dokka to include documentation for files generated from AIDL, which output to the build folder. How do you include additional sources in an Android project for dokka 1.4.10.2? The README suggests I should be putting config in
dokkaSourceSets { named("main") { ... } }
. I've managed to get
includeNotPublic.set
working in that block, but
sourceRoots.from
and
sourceRoots.setFrom
don't do anything.
m

Marcin Aman

11/13/2020, 1:20 PM
I suspect that they are not a part of a configured sourceSet. Is this project available publicly so i can take a look?
r

rbares

11/13/2020, 1:47 PM
m

Marcin Aman

11/13/2020, 1:48 PM
Thanks, ill take a look
👍 1
r

rbares

11/13/2020, 7:13 PM
as I have a package which exclusively contains AIDL generated classes, I am able to use the following workaround:
Copy code
task removeAidlSources(type: Delete) {
    delete "src/main/java/my/aidl/package/"
}

task addAidlSources(type: Copy) {
    from "$buildDir/generated/aidl_source_output_dir/release/out/my/aidl/package/"
    into "src/main/java/my/aidl/package/"
}

afterEvaluate {
    tasks.matching { it.name.startsWith("dokka") }.all {
        it.dependsOn addAidlSources
        it.finalizedBy removeAidlSources
    }
}
but it would be helpful if I didn't need to temporarily pollute the codebase with duplicate definitions
k

Kamil Doległo

11/14/2020, 5:07 PM
They may be suppressed by default. When configuring dokka source set (I believe it’s called
main
or similar on Android) you can just remove the default value of the
suppresedFiles
parameter (eg.
suppressedFiles.setFrom(...)
)
r

rbares

11/14/2020, 7:17 PM
Indeed I have been using "main". Unfortunately adding
suppressedFiles.setFrom
didn't change the behavior in the sample app provided. If the files were suppressed I would expect exclusively setting
sourceRoots.setFrom
to the generated path to result in no documentation at all. Instead I get the same result whether I try to set sourceRoots or not. This does make me wonder whether I have fallen into an edge-case where I am trying to use the syntax incorrectly but it isn't sufficiently wrong to show any errors.
k

Kamil Doległo

11/16/2020, 11:42 AM
This might be a bug on our side, give me a few hours to check that
Yeah, it’s actually a bug on our side which I don’t know how to solve properly yet
As a workaround you should just move your file somewhere outside the
generated
folder as it is filtered out by default
16 Views