Conversation
f5a680e to
b8f4bfc
Compare
* Drop WORKSPACE support * Drop bzlmod-related flags
…contrib#1470) * Drop WORKSPACE support (bazel-contrib#1480) * Drop WORKSPACE support * Drop bzlmod-related flags * [maintenance] Use rules_jvm_external for getting dependencies Stop relying on the downloaded kotlinc distribution - switching to rules_jvm_external will make it easier to use BTAPI. Not having to resolve dependencies manually will also let us avoid problems like KSP requiring a specific version of kotlin coroutines.
* Introduce BTAPI * Post-merge fixes * Repin example maven lockfiles * Address comments * Address comments * Address comments * Add more tests and minor improvements * Run buildifier
b8f4bfc to
6d14206
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new examples/btapi_compat workspace demonstrating how to pin a custom Kotlin compiler/BTAPI runtime (2.3.10) while using rules_kotlin, plus a small compiler-plugin-based verification test. Also adjusts example workspace layout and root Bazel config to account for the new example.
Changes:
- Introduces
examples/btapi_compatwith a custom toolchain, Maven-pinned Kotlin artifacts, a compiler plugin, and JUnit verification tests. - Adds a lockfile (
maven_install.json) and documentation for the new BTAPI compatibility example. - Removes
examples/path_mapping/WORKSPACEand updates root.bazelrcdeleted package list.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/path_mapping/WORKSPACE | Removes the WORKSPACE-based setup for the path_mapping example. |
| examples/btapi_compat/src/main/kotlin/plugin/Plugin.kt | Adds a compiler plugin that injects the Kotlin compiler version into IR for runtime verification. |
| examples/btapi_compat/src/main/kotlin/example/Compat.kt | Adds JUnit tests to assert stdlib + compiler version behavior. |
| examples/btapi_compat/maven_install.json | Adds resolved Maven lockfile for the example’s dependencies. |
| examples/btapi_compat/README.md | Documents how the example pins/overrides BTAPI + stdlib and how it’s validated. |
| examples/btapi_compat/MODULE.bazel | Declares the example module, Maven artifacts, and registers the custom toolchain. |
| examples/btapi_compat/BUILD.bazel | Defines the custom toolchain, compiler plugin targets, and test target. |
| .bazelrc | Updates --deleted_packages list to include the new example and reflect current excluded example packages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name = "kotlin_2310_toolchain", | ||
| api_version = "2.3", | ||
| build_tools_impl = "@maven_rules_kotlin_btapi_compat//:org_jetbrains_kotlin_kotlin_build_tools_impl", | ||
| kotlin_stdlib = "@maven_rules_kotlin_btapi_compat//:org_jetbrains_kotlin_kotlin_stdlib", |
There was a problem hiding this comment.
define_kt_toolchain (exported from @rules_kotlin//kotlin:core.bzl) doesn't accept a kotlin_stdlib parameter (the macro supports jvm_stdlibs and jvm_runtime instead). As written, this toolchain definition will fail to load or will not actually override the stdlib as the README/tests expect. Update the toolchain to set jvm_stdlibs/jvm_runtime to the desired stdlib (and any required annotations jar), and remove/replace the unsupported kotlin_stdlib argument.
| kotlin_stdlib = "@maven_rules_kotlin_btapi_compat//:org_jetbrains_kotlin_kotlin_stdlib", | |
| jvm_stdlibs = [ | |
| "@maven_rules_kotlin_btapi_compat//:org_jetbrains_kotlin_kotlin_stdlib", | |
| ], | |
| jvm_runtime = "@maven_rules_kotlin_btapi_compat//:org_jetbrains_kotlin_kotlin_stdlib", |
| The custom toolchain also overrides: | ||
|
|
||
| - `org.jetbrains.kotlin:kotlin-stdlib:2.3.10` | ||
|
|
||
| The custom toolchain is declared in `BUILD.bazel` with `define_kt_toolchain` and registered in `MODULE.bazel` via: |
There was a problem hiding this comment.
This README says the toolchain overrides kotlin-stdlib via a kotlin_stdlib attribute, but define_kt_toolchain doesn't have that parameter (it uses jvm_stdlibs/jvm_runtime). Once the BUILD is corrected, please update this section to describe the actual toolchain attributes used to override the stdlib/runtime classpath so the example remains accurate.
| The custom toolchain also overrides: | |
| - `org.jetbrains.kotlin:kotlin-stdlib:2.3.10` | |
| The custom toolchain is declared in `BUILD.bazel` with `define_kt_toolchain` and registered in `MODULE.bazel` via: | |
| The custom toolchain is declared in `BUILD.bazel` with `define_kt_toolchain`. To override the Kotlin stdlib/runtime classpath, the toolchain uses: | |
| - `jvm_stdlibs` for the Kotlin stdlib artifacts, such as `org.jetbrains.kotlin:kotlin-stdlib:2.3.10` | |
| - `jvm_runtime` for the runtime jars made available to the toolchain | |
| The toolchain is then registered in `MODULE.bazel` via: |
No description provided.