Michal Klimczak
05/05/2022, 10:43 AMjava {
withSourcesJar()
withJavadocJar()
}
Karel Petránek
05/05/2022, 10:48 AMMichal Klimczak
05/05/2022, 10:52 AMMichal Klimczak
05/05/2022, 10:53 AMephemient
05/05/2022, 11:04 AMMichal Klimczak
05/05/2022, 11:06 AMimplementation(":lib")
(tried via implementation(files("libs/lib.jar)"
too)Karel Petránek
05/05/2022, 12:18 PM-javadoc.jar
suffix?Michal Klimczak
05/05/2022, 12:27 PMlib.jar
lib-javadoc.jar
Then it doesn't work.
But with
lib.jar
lib-javadoc.jar
lib-sources.jar
It does work. But contains full sources.
And I want something in between. I think I've seen libraries having stuff like this, though, that's why I'm asking about stripped sources.
fun method(params: Params){
//undefined
}
Karel Petránek
05/05/2022, 3:06 PMIgnat Beresnev
05/05/2022, 3:49 PMephemient
05/05/2022, 5:37 PMlibs/*.jar
, as that allows other dependency featuresMichal Klimczak
05/06/2022, 12:53 PMIgnat Beresnev
05/06/2022, 12:57 PMand dokka is the only way to generate javadocs for kotlin code, right?I believe so
Ignat Beresnev
05/06/2022, 1:02 PM@ephemient this is a very specific use case - a self contained project that serves as a recruitment task for candidates and the closed source sdk is a mock-backend-api. So I was looking for something simple.You can still document the SDK and build and host Dokka's HTML format docs, here's an example. You can use github pages or a webserver, you must be running nginx somewhere already 🙂 No body source code and no private functions will be visible The search works well for finding classes/functions by signature. It's not as convenient as having documentation right in the IDE, but it still can be used as reference for not self explanatory API -- definitely better than nothing
Michal Klimczak
05/06/2022, 1:07 PMIgnat Beresnev
05/06/2022, 1:24 PMI'm torn betwen this and just writing a few sentences in the readme, because it's really a tiny API. Nevertheless, it's good to know what we can and what we can't do.You could generate
gfm
format docs and embed it into the README
file :)) However, gfm
format is also at it's early stages and has some noticable bugs, so you may need to modify it. ./gradlew dokkaGfm
. Here's an example: https://square.github.io/okhttp/4.x/okhttp/okhttp3/
but afaiu it's not a dokka issue, it's more of an intellij thingI would say it's primarily Dokka's issue since it's responsible for generating javadoc pages. Rendering-wise, Intellij platform works well with Java's
javadoc
output, no questions there. So if Dokka were to generate "correct" javadocs (that is abiding by all rules and quirks of the format), it would work well.
But thing is, I don't think it's possible to generate 100% identical and idiomatic javadocs when not using java's javadoc
task. Javadocs generated by Dokka look like Java's javadocs visually, some of the styles are the same, but everything under the hood is different, beginning with how sources are traversed and looked up and ending with the rendering (for Dokka it's template-based). Moreover, Kotlin has features that are difficult to display in Java's javadoc styling, since it was never intended to have this information - companion objects, extension functions, package-level functions, etc
Moreover, I don't think that Dokka should strive to generate such javadocs that could be read well by the IntelliJ Platform. Instead, a machine-readable output format (like xml
) could be used instead to generate documentation, and then it could be imported into Intellij IDEA to have the same inside-editor quick docs as if imported from javadocs. This can be done already by custom dokka and intellij plugins, but we don't have the resources. Good idea for a pet / practice project 🙂