There are three main ways you can contribute to Dokka's development:
- Submitting issues.
- Submitting fixes/changes/improvements via pull requests.
- Developing community plugins.
Bug reports, feature requests and questions are welcome. Submit issues here.
- Search for existing issues to avoid reporting duplicates.
- When submitting a bug report:
- Test it against the most recently released version. It might have been fixed already.
- Include code that reproduces the problem. Provide a complete reproducer, yet minimize it as much as possible. A separate project that can be cloned is ideal.
- If the bug is in behavior, explain what behavior you expected and what the actual result is.
- When submitting a feature request:
- Explain why you need the feature.
- Explaining the problem you face is more important than suggesting a solution. Report your problem even if you have no proposed solution.
Dokka has extensive Developer Guides documentation which goes over the development Workflow and Dokka's architecture, which can help you understand how to achieve what you want and where to look.
All development (both new features and bugfixes) takes place in the master
branch, it contains sources for the next
version of Dokka.
For any code changes:
- Follow Kotlin Coding Conventions. Use 4 spaces for indentation.
- Build the project to make sure it all works and tests pass.
- Write tests that reproduce the bug or test new features.
- PRs without tests are accepted only in exceptional circumstances if it is evident that writing the corresponding test is too hard or otherwise impractical.
- If you add new or change old public API, update public API dump, otherwise it will fail the build.
Please contact maintainers in advance to coordinate any big piece of work.
Building Dokka is pretty straightforward:
./gradlew build
This will build all subprojects and trigger build
in all composite builds. If you are working on a
runner, you can build it independently.
Checks that are performed as part of build
do not require any special configuration or environment, and should
not take much time (~2-5 minutes), so please make sure they pass before submitting a pull request.
Below you will find a bare-bones instruction on how to use and test locally built Dokka. For more details and examples, visit Workflow topic.
- Publish a custom version of Dokka to Maven Local:
./gradlew publishToMavenLocal -Pversion=1.9.20-my-fix-SNAPSHOT
- In the project for which you want to generate documentation add Maven Local as a buildscript/dependency
repository (
mavenLocal()
) - Update your Dokka dependency to the version you've just published:
plugins {
id("org.jetbrains.dokka") version "1.9.20-my-fix-SNAPSHOT"
}
There is an automation script for this routine, see testDokka.sh.md for details.
To update Gradle, follow these steps:
-
Open https://gradle.org/release-checksums/ and copy the "Binary-only (-bin) ZIP" checksum corresponding to the desired Gradle version.
-
Update the Gradle version and checksum by either:
-
Using the wrapper task:
Run
./gradlew wrapper --gradle-version=<new version> --gradle-distribution-sha256-sum=<new checksum>
-
OR update
./gradle/wrapper/gradle-wrapper.properties
:- distributionSha256Sum=<old checksum> + distributionSha256Sum=<new checksum> - distributionUrl=[...]/distributions/gradle-<old version>-bin.zip + distributionUrl=[...]/distributions/gradle-<new version>-bin.zip
-
-
⚠️ Run./gradlew wrapper
to update the Gradle wrapper files.(Don't forget to run the
wrapper
task after updating the versions, otherwise Gradle won't update its wrapper files.)
Binary Compatibility Validator is used to keep track of public API changes.
Run ./gradlew apiDump
to update API index files after introducing new or changing old public API. Commit updated
API indexes together with other changes.
Dokka's integration tests help check compatibility with various versions of Kotlin, Android, Gradle and Java. They apply Dokka to real user-like projects and invoke Gradle / Maven / CLI tasks to generate the documentation.
Integration tests require a significant amount of available RAM (~20-30GB), take 1+ hour and may require additional environment configuration to run. For these reasons, it's not expected that you run all integration tests locally as part of the everyday development process, they will be run on CI once you submit a PR.
However, if you need to run all integration tests locally, you can use the integrationTest
task:
./gradlew integrationTest
If you need to run a specific test locally, you can run it from your IDE or by calling the corresponding Gradle
task (for example, :dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines
).
It's possible to run integration tests with a custom Dokka version published to
MavenCentral,
dev,
test or
mavenLocal
via org.jetbrains.dokka.integration_test.dokkaVersionOverride
Gradle property:
./gradlew :dokka-integration-tests:gradle:testExternalProjectKotlinxCoroutines -Porg.jetbrains.dokka.integration_test.dokkaVersionOverride=2.0.0-dev-329
Additionally, it's possible to open the Gradle integration test projects in IDEA. Instructions are located in README.md of Gradle integration tests.
To minimize compatibility problems, Gradle's Java toolchains are used to build and test the project.
When run, Gradle tries to auto-detect the required JRE/JDK installation locally, but it may fail if you don't have that version of Java installed or if it's installed in an unusual location. Please refer to Gradle's documentation on toolchains for customization and problem resolution questions.
You can use the following Gradle properties to build/test Dokka with a different version of Java:
Property | Default value | Description |
---|---|---|
org.jetbrains.dokka.javaToolchain.mainCompiler |
8 |
The version used to build Dokka projects. |
org.jetbrains.dokka.javaToolchain.testLauncher |
8 |
The version used run unit and integration tests. |
Separating the compiler and test versions is needed to check Dokka's compatibility with various Java versions. For example, the GitHub Actions based unit tests are run under multiple versions of Java at the same time.
The majority of automated checks and builds are run as GitHub Actions workflows.
The configuration for Dokka's workflows can be found in .github/workflows
.
For your first PR, a maintainer will need to approve the workflow runs manually. For your subsequent PRs, the workflows will be triggered and run automatically on every PR commit.
While GitHub Actions checks can expose real problems, TeamCity-based integration tests need to be run for any significant changes as they have more thorough compatibility checks.
Notable workflows:
- Publish preview to GitHub Actions Artifacts
builds the HTML API reference of several libraries like
kotlinx.coroutines
, and publishes the results aszip
archive artifacts. You can use it to preview your changes. The workflow is triggered for all commits. - Publish preview to web (S3)
does the same thing as
Publish examples to GitHub Actions Artifacts
, but publishes the generated documentation to S3, so it can be accessed from any browser without the need to download anything. The web link will be printed under thePrint link
job step. This workflow is triggered by maintainer commits only as it requires encrypted secrets to be run.
Notes:
- Some workflow job runs are flaky, but if more than a couple are failing at the same time or repeatedly - it indicates a problem in the PR that needs to be addressed.
- While a Java version can be configured in
the
setup-java
action, it is not necessarily the version of Java that will be used to build/test the project. See the Java version section for more details.
TeamCity is used for a subset of important / longer builds and checks, including artifact publication.
The runs are triggered automatically by maintainer commits, or can be started manually by maintainers. External contributors can view the results in guest mode.
Notable builds:
- Dokka Integration Tests runs Dokka's integration tests, which are designed to test compatibility with different Kotlin versions, with different multiplatform targets and with various user scenarios.
Gradle Build Scans can provide insights into a Dokka Build. JetBrains runs a Gradle Develocity server. that can be used to automatically upload reports.
To automatically opt in add the following to $GRADLE_USER_HOME/gradle.properties
.
org.jetbrains.dokka.build.scan.enabled=true
# optionally provide a username that will be attached to each report
org.jetbrains.dokka.build.scan.username=Hannah Clarke
A Build Scan may contain identifiable information. See the Terms of Use https://gradle.com/legal/terms-of-use/.
- If something cannot be done, not convenient, or does not work — submit an issue.
- Discussions and general inquiries — use
#dokka
channel in Kotlin Community Slack.