Skip to content

Commit c1f6d80

Browse files
authored
README + Release Note Refresh (#1296)
I noticed that the `README.md` didn't contain any details about bzlmod support + integration so thought it'd be nice to give it a small refresh. It looked like the repo integration snippet was also out of date so I decided to point it at the releases page instead like many other rulesets do; however it required adding in some of the extra repo function calls. I updated the release prep script with this and left the existing `WORKSPACE` integration snippet for now until the next release is cut with those added function calls.
1 parent fb26ad6 commit c1f6d80

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.github/workflows/release_prep.sh

+6
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,11 @@ http_archive(
3535
sha256 = "${SHA}",
3636
url = "https://github.com/bazelbuild/rules_kotlin/releases/download/${TAG}/${ARCHIVE}",
3737
)
38+
39+
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
40+
kotlin_repositories() # if you want the default. Otherwise see custom kotlinc distribution below
41+
42+
load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
43+
kt_register_toolchains() # to use the default toolchain, otherwise see toolchains below
3844
\`\`\`
3945
EOF

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ Generated API documentation is available at
5151

5252
# Quick Guide
5353

54-
## `WORKSPACE`
54+
## Installation
55+
Copy from the
56+
[release you wish to use](https://github.com/bazelbuild/rules_kotlin/releases) either the Bzlmod or WORKSPACE snippet into your `MODULE.bazel` or `WORKSPACE` file respectively.
57+
58+
### `WORKSPACE`
5559
In the project's `WORKSPACE`, declare the external repository and initialize the toolchains, like
5660
this:
5761

@@ -116,6 +120,17 @@ register_toolchains("//:kotlin_toolchain")
116120
To choose a different `kotlinc` distribution (1.3 and 1.4 variants supported), do the following
117121
in your `WORKSPACE` file (or import from a `.bzl` file:
118122

123+
### `MODULE.bazel`
124+
```python
125+
rules_kotlin_extensions = use_extension("@rules_kotlin//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions")
126+
rules_kotlin_extensions.kotlinc_version(
127+
version = "1.6.21", # just the numeric version
128+
sha256 = "632166fed89f3f430482f5aa07f2e20b923b72ef688c8f5a7df3aa1502c6d8ba"
129+
)
130+
use_repo(rules_kotlin_extensions, "com_github_google_ksp", "com_github_jetbrains_kotlin", "com_github_jetbrains_kotlin_git", "com_github_pinterest_ktlint", "kotlinx_serialization_core_jvm", "kotlinx_serialization_json", "kotlinx_serialization_json_jvm")
131+
```
132+
133+
### `WORKSPACE`
119134
```python
120135
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_version")
121136

@@ -288,7 +303,19 @@ kt_jvm_library(
288303
```
289304

290305
To choose a different `ksp_version` distribution,
291-
do the following in your `WORKSPACE` file (or import from a `.bzl` file):
306+
do the following in your repository.
307+
308+
### `MODULE.bazel`
309+
```python
310+
rules_kotlin_extensions = use_extension("@rules_kotlin//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions")
311+
rules_kotlin_extensions.ksp_version(
312+
version = "1.8.22-1.0.11",
313+
sha256 = "2ce5a08fddd20ef07ac051615905453fe08c3ba3ce5afa5dc43a9b77aa64507d",
314+
)
315+
use_repo(rules_kotlin_extensions, "com_github_google_ksp", "com_github_jetbrains_kotlin", "com_github_jetbrains_kotlin_git", "com_github_pinterest_ktlint", "kotlinx_serialization_core_jvm", "kotlinx_serialization_json", "kotlinx_serialization_json_jvm")
316+
```
317+
318+
### `WORKSPACE` (or import from a `.bzl` file):
292319

293320
```python
294321
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "ksp_version")

0 commit comments

Comments
 (0)