Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publishing of Dokka-generated documentation in Kotlin API mode #463

Open
alexander-yevsyukov opened this issue Apr 5, 2023 · 1 comment
Labels
/Build Build tasks

Comments

@alexander-yevsyukov
Copy link
Contributor

alexander-yevsyukov commented Apr 5, 2023

This PR in base introduces separation of artifacts generated by Dokka for Kotlin- and Java-based API mode of documentation.

In addition to standard Dokka HTML publication artifact, which serves the Java API perspective, we need to have another artifact, which contains documentation from the Kotlin API perspective.

Dokka setup for Kotlin API mode should be be checked to support the facility similar to ExcludeInternal doclet which strips API elements annotated with @Internal. Please see Configuration Options as a source of inspiration of how it may be implemented. It currently works for Java API mode and hopefully should work for Kotlin out of the box.

Currently there's only one dokkaHtml task, which does not comply with KMM modules because it produces at least two publications: one for commonMain and one for jvmMain source sets.

We need to have two API modes for all the modules (both JVM-only and KMM):

  • Java API view for all the code.
  • Kotlin API view for all the code.

Here's the details of the issue that needs to solved. Java API mode is currently enabled by importing dokka-for-java script plugin. It adds a separate dependency for kotlin-as-java Dokka plugin:

fun DependencyHandlerScope.useDokkaForKotlinAsJava() {
    dokkaPlugin(Dokka.KotlinAsJavaPlugin.lib)
}

When it comes to KMM module, we cannot use this approach because there are at least to publications. And we probably need to have a separate Configuration for jvm documentation which handles the dependency dokkaPlugin(Dokka.KotlinAsJavaPlugin.lib).

The PR in base solves the above issue only partially as it uses Dokka for Kotlin mode for the logging module (which is KMM) and adds vanilla Javadoc artifact for the jvm publication:

publishing {
    publications.withType<MavenPublication> {
        if (name.contains("jvm", true)) {
            artifact(project.javadocJar())
        } else {
            artifact(project.dokkaKotlinJar())
        }
    }
}

Once the general documentation improvement is introduced as the result of addressing this issue, the base project (or the separate logging project, if we choose to extract it) needs to be adjusted accordingly.

@alexander-yevsyukov alexander-yevsyukov added the /Build Build tasks label Apr 5, 2023
@alexander-yevsyukov
Copy link
Contributor Author

@armiol, FYI.

@alexander-yevsyukov alexander-yevsyukov changed the title Add publishing of Dokka-generated documentation in Java API mode Add publishing of Dokka-generated documentation in Kotlin API mode Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
/Build Build tasks
Projects
None yet
Development

No branches or pull requests

1 participant