Skip to content

Commit 82cc9d4

Browse files
authored
Rework local development docs (#1321)
* Rework local development docs * Further refine our docs
1 parent b2bbb8b commit 82cc9d4

File tree

1 file changed

+18
-36
lines changed

1 file changed

+18
-36
lines changed

README.md

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ in your `WORKSPACE` file (or import from a `.bzl` file:
124124
```python
125125
rules_kotlin_extensions = use_extension("@rules_kotlin//src/main/starlark/core/repositories:bzlmod_setup.bzl", "rules_kotlin_extensions")
126126
rules_kotlin_extensions.kotlinc_version(
127-
version = "1.6.21", # just the numeric version
128-
sha256 = "632166fed89f3f430482f5aa07f2e20b923b72ef688c8f5a7df3aa1502c6d8ba"
127+
version = "2.1.20",
128+
sha256 = "a118197b0de55ffab2bc8d5cd03a5e39033cfb53383d6931bc761dec0784891a"
129129
)
130130
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")
131131
```
@@ -136,8 +136,8 @@ load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "kotlinc_v
136136

137137
kotlin_repositories(
138138
compiler_release = kotlinc_version(
139-
release = "1.6.21", # just the numeric version
140-
sha256 = "632166fed89f3f430482f5aa07f2e20b923b72ef688c8f5a7df3aa1502c6d8ba"
139+
release = "2.1.20",
140+
sha256 = "a118197b0de55ffab2bc8d5cd03a5e39033cfb53383d6931bc761dec0784891a"
141141
)
142142
)
143143
```
@@ -147,48 +147,30 @@ _(e.g. Maven artifacts)_
147147

148148
Third party (external) artifacts can be brought in with systems such as [`rules_jvm_external`](https://github.com/bazelbuild/rules_jvm_external) or [`bazel_maven_repository`](https://github.com/square/bazel_maven_repository) or [`bazel-deps`](https://github.com/johnynek/bazel-deps), but make sure the version you use doesn't naively use `java_import`, as this will cause bazel to make an interface-only (`ijar`), or ABI jar, and the native `ijar` tool does not know about kotlin metadata with respect to inlined functions, and will remove method bodies inappropriately. Recent versions of `rules_jvm_external` and `bazel_maven_repository` are known to work with Kotlin.
149149

150-
# Development Setup Guide
151-
As of 1.5.0, to use the rules directly from the rules_kotlin workspace (i.e. not the release artifact)
152-
require the use of `release_archive` repository. This repository will build and configure the current
153-
workspace to use `rules_kotlin` in the same manner as the released binary artifact.
150+
## Development Setup
154151

155-
In the project's `WORKSPACE`, change the setup:
152+
For local development of rules_kotlin:
156153

157-
```python
154+
#### With Bzlmod
158155

159-
# Use local check-out of repo rules (or a commit-archive from github via http_archive or git_repository)
160-
local_repository(
161-
name = "rules_kotlin",
156+
```python
157+
local_path_override(
158+
module_name = "rules_kotlin",
162159
path = "../path/to/rules_kotlin_clone/",
163160
)
164-
165-
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories", "versions")
166-
167-
kotlin_repositories()
168-
169-
load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
170-
171-
kt_register_toolchains()
172161
```
173162

174-
To use rules_kotlin from head without cloning the repository, (caveat emptor, of course), change the
175-
rules to this:
163+
#### From HEAD (Bzlmod)
176164

177165
```python
178-
# Download master or specific revisions
179-
http_archive(
180-
name = "rules_kotlin",
181-
strip_prefix = "rules_kotlin-master",
182-
urls = ["https://github.com/bazelbuild/rules_kotlin/archive/refs/heads/master.zip"],
183-
)
184-
185-
load("@rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
166+
_RULES_KOTLIN_COMMIT = "HEAD_COMMIT_SHA"
186167

187-
kotlin_repositories()
188-
189-
load("@rules_kotlin//kotlin:core.bzl", "kt_register_toolchains")
190-
191-
kt_register_toolchains()
168+
archive_override(
169+
module_name = "rules_kotlin",
170+
integrity = "sha256-...",
171+
strip_prefix = "rules_kotlin-%s" % _RULES_KOTLIN_COMMIT,
172+
urls = ["https://github.com/bazelbuild/rules_kotlin/archive/%s.tar.gz" % _RULES_KOTLIN_COMMIT],
173+
)
192174
```
193175

194176
# Debugging native actions

0 commit comments

Comments
 (0)