You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
org.jetbrains.dokka.gradle.ConfigurationExtractor.getMainCompilation(KotlinTarget) only works if there is a target.compilations.getByName("main"). On Android projects, there is no "main" compilation (typically just "debug", "release", and a few others for tests).
The first problem is that getByName(String) throws an exception if the named element cannot be found. Since Android does not create a "main" compilation, this was causing the build to fail. To work around that exception, I first changed this to findByName("main"), and that resolved the exception. However, even after this, the generated documentation was empty, because it was not able to locate any sources or classpath.
I tried adding kotlinTasks { ["compileReleaseKotlin"] }, based on what I found in the testData examples, but that did not change anything and it would still produce empty documentation. I wasn't able to find out how to run the integration tests to check whether it was expected to work or not.
What finally ended up working for me, was one of these changes:
Now it's able to locate the "release" compilation, finds the sources and classpath, and the documentation is generated successfully.
It might make sense to run this only for release variants, in which case it would be nice if the dokka-android plugin would create the tasks only for release variants, or at least generate separate DokkaAndroidTask for separate variants that will utilize the matching KotlinCompilation. But as I'm not familiar with the roadmap for where you intend to take this, I don't really know the best way to address this in order to create a PR.
The text was updated successfully, but these errors were encountered:
org.jetbrains.dokka.gradle.ConfigurationExtractor.getMainCompilation(KotlinTarget)
only works if there is atarget.compilations.getByName("main")
. On Android projects, there is no"main"
compilation (typically just"debug", "release"
, and a few others for tests).The first problem is that
getByName(String)
throws an exception if the named element cannot be found. Since Android does not create a"main"
compilation, this was causing the build to fail. To work around that exception, I first changed this tofindByName("main")
, and that resolved the exception. However, even after this, the generated documentation was empty, because it was not able to locate any sources or classpath.I tried adding
kotlinTasks { ["compileReleaseKotlin"] }
, based on what I found in the testData examples, but that did not change anything and it would still produce empty documentation. I wasn't able to find out how to run the integration tests to check whether it was expected to work or not.What finally ended up working for me, was one of these changes:
Now it's able to locate the
"release"
compilation, finds the sources and classpath, and the documentation is generated successfully.It might make sense to run this only for release variants, in which case it would be nice if the dokka-android plugin would create the tasks only for release variants, or at least generate separate DokkaAndroidTask for separate variants that will utilize the matching KotlinCompilation. But as I'm not familiar with the roadmap for where you intend to take this, I don't really know the best way to address this in order to create a PR.
The text was updated successfully, but these errors were encountered: