-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4eb3f4
commit b4f8ccc
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# KDoc Preprocessing | ||
|
||
You might have spotted some notations like `{@include [Something]}` in the KDocs of DataFrame's source code. | ||
These are special notations for the [KDoc preprocessor](https://github.com/Jolanrensen/docProcessorGradlePlugin) | ||
that we use to generate parts of the KDoc documentation. | ||
|
||
Kotlin libraries like DataFrame use KDoc to document their code and especially their public API. This allows users | ||
to understand how to use the library and what to expect from it. However, writing KDoc can be a tedious task, especially | ||
when you have to repeat the same information in multiple places. The KDoc preprocessor allows us to write the information | ||
only once and then include it in multiple places. | ||
|
||
This document explains how to use the KDoc preprocessor in the DataFrame project. | ||
|
||
## How the Processing Works | ||
|
||
Unlike Java, Kotlin library authors | ||
[don't have the ability to share a jar file with documentation](https://github.com/Kotlin/dokka/issues/2787). They have | ||
to share their documentation along with their `sources.jar` file which users can attach in their IDE to see the docs. | ||
DataFrame thus uses the preprocessor in Gradle to copy and modify the source code, processing the KDoc notations, | ||
and publishing the modified files as the `sources.jar` file. | ||
|
||
This can be seen in action in the `core:processKDocsMain` and `core:changeJarTask` Gradle tasks in the | ||
[core/build.gradle.kts file](core/build.gradle.kts). When you run any `publish` task in the `core` module, the | ||
`processKDocsMain` task is executed first, which processes the KDocs in the source files and writes them to the | ||
`generated-sources` folder. The `changeJarTask` task then makes sure that any `Jar` task in the `core` module uses the | ||
`generated-sources` folder as the source directory instead of the normal `src` folder. | ||
|
||
`core:processKDocsMain` can also be run separately if you just want to see the result of the KDoc processing. | ||
|
||
To make sure the generated sources can be seen and reviewed on GitHub, since [PR #731](https://github.com/Kotlin/dataframe/pull/731), | ||
there's a [GitHub action](.github/workflows/generated-sources.yml) that runs the `core:processKDocsMain` task and | ||
comments the results on the PR. After a PR is merged, [another action](.github/workflows/generated-sources-master.yml) | ||
runs on the master branch and commits the generated sources automatically. | ||
This way, the generated sources are always up-to-date with the latest changes in the code. | ||
This means you don't have to run and commit the generated sources yourself, though it's | ||
still okay if you do. | ||
|
||
## Previewing the Processed KDocs in IntelliJ IDEA | ||
|
||
## The Notation | ||
|
||
## KDoc Preprocessor Conventions in DataFrame | ||
|
||
## KDoc -> WriterSide |