2

I am unable to configure Dokka to include the documentation of my packages without using a full absolute path from the root of the file system. I have in my Gradle file (the includes line is the one in problem):

dokka {
    outputFormat = 'html'
    outputDirectory = "$projectDir/../doc"


    configuration {
        // Use to include or exclude non public members.
        includeNonPublic = false

        // Do not output deprecated members. Applies globally, can be overridden by packageOptions
        skipDeprecated = false

        // Emit warnings about not documented members. Applies globally, also can be overridden by packageOptions
        reportUndocumented = true

        // Do not create index pages for empty packages
        skipEmptyPackages = true

        includes = ["${projectDir}/app/src/main/kotlin/com/biexpertise/simplewebview/packages.md"]
    }
}

When, I run ./gradlew dokka if I have this error:

> Task :app:dokka FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dokka'.
> org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String

If I remove $projectDir and use an absolute path, things are working. It is possible to use a relative path instead?

Pierre Thibault
  • 1,895
  • 2
  • 19
  • 22

1 Answers1

0

So that's in fact a problem with dokka's Gradle plugin, or to be more specific, with Groovy String implementation. Groovy uses it's own GStringImpl for strings, instead of the String class, which leads to a problem when casting a List<GStringImpl> to List<String> (this cast doesn't succeed).

The easiest solution is to call .toString() on your include, like this:

includes = ["${projectDir}/app/src/main/kotlin/com/biexpertise/simplewebview/packages.md".toString()]

This should be fixed on the dokka side though, you can file a bug report on GitHub