Skip to content

Commit e288995

Browse files
committed
Add some docs
1 parent e0eecff commit e288995

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# bazel_rules_dokka
2+
3+
Bazel rules for [Dokka](https://github.com/Kotlin/dokka) (documentation engine for Kotlin)
4+
5+
## Features
6+
7+
- Easy docs generation
8+
- Default javadoc support
9+
- Extension point for generating other doc types
10+
11+
## Usage
12+
13+
### `WORKSPACE` configuration
14+
15+
```starlalrk
16+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
17+
18+
RULES_DOKKA_VERSION = "..."
19+
RULES_DOKKA_SHA = "..."
20+
21+
http_archive(
22+
name = "rules_dokka",
23+
sha256 = RULES_DOKKA_SHA,
24+
strip_prefix = "bazel_rules_dokka-{v}".format(v = RULES_DOKKA_VERSION),
25+
url = "https://github.com/Bencodes/bazel_rules_dokka/archive/v{v}.tar.gz".format(v = RULES_DOKKA_VERSION),
26+
)
27+
28+
load("@rules_dokka//dokka:dependencies.bzl", "rules_dokka_dependencies")
29+
rules_dokka_dependencies()
30+
31+
load("@rules_dokka//dokka:toolchains.bzl", "rules_dokka_toolchains")
32+
rules_dokka_toolchains()
33+
```
34+
35+
### `BUILD` configuration
36+
37+
```starlark
38+
load("@rules_dokka//dokka:defs.bzl", "dokka")
39+
40+
dokka(
41+
name = "sample_dokka_docs",
42+
srcs = glob(["src/main/kotlin/**/*.kt"]),
43+
)
44+
```
45+
46+
## Building
47+
48+
`$ bazel build //sample:sample_dokka_docs`
49+
50+
## Advanced
51+
52+
### Customizing the Dokka version
53+
54+
Call `rules_dokka_toolchains` with the `dokka_version` provided:
55+
56+
```starlark
57+
rules_dokka_toolchains(dokka_version = "1.4.0-rc")
58+
```
59+
60+
### Plugins
61+
62+
Download the Dokka Jeykell maven plugins by adding the following to your `WORKSPACE`. Don't forget to include the transitive dependencies!
63+
64+
```starlark
65+
DOKKA_VERSION = "1.4.0-rc"
66+
67+
maven_install(
68+
name = "sample_deps",
69+
artifacts = [
70+
maven.artifact("org.jetbrains.dokka", "jekyll-plugin", DOKKA_VERSION),
71+
...
72+
],
73+
)
74+
```
75+
76+
Override the `plugins` attribute in your `BUILD` file with your own Dokka plugin and provide the classpath jars:
77+
78+
```starlark
79+
dokka(
80+
name = "sample_dokka_docs",
81+
srcs = glob(["src/main/kotlin/**/*.kt"]),
82+
plugins = [
83+
"@sample_deps//:org_jetbrains_dokka_jekyll_plugin",
84+
...
85+
],
86+
)
87+
```

0 commit comments

Comments
 (0)