Btapi introduction only#1534
Merged
restingbull merged 8 commits intobazel-contrib:developfrom Apr 1, 2026
Merged
Conversation
a7342d6 to
d85eef4
Compare
Closed
There was a problem hiding this comment.
Pull request overview
Introduces an initial Kotlin Build Tools API (BTAPI) compilation path alongside the existing kotlinc-invoker path, wiring Bazel toolchain-provided BTAPI runtime artifacts into the worker and adding focused tests for BTAPI argument conversion, compiler caching, and end-to-end compilation.
Changes:
- Add BTAPI-based JVM task execution (
KotlinBtapiJvmTaskExecutor) with a per-toolchain compiler cache and typed plugin argument handling. - Extend the KotlinBuilder protocol/flags to pass plugin IDs (not just classpaths/options) and to pass BTAPI runtime + internal plugin artifacts from the toolchain.
- Update Kotlin/Maven lockfiles and module versioning to Kotlin
2.3.20, and add new BTAPI-related tests.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/kotlin/io/bazel/worker/BUILD.bazel | Removes WorkerEnvironment test targets; keeps worker unit test suite minimal. |
| src/test/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/KotlinBtapiJvmTaskExecutorTest.kt | Adds basic BTAPI compilation success/failure tests. |
| src/test/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiPluginArgumentsTest.kt | Adds unit tests for typed BTAPI plugin argument string conversion. |
| src/test/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompilerCacheTest.kt | Adds tests for toolchain-spec-keyed BTAPI compiler caching and validation. |
| src/test/kotlin/io/bazel/kotlin/builder/tasks/jvm/ToolchainSpecTest.kt | Adds equality/ordering semantics tests for ToolchainSpec. |
| src/test/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilderProtoArgsTest.kt | Adds test ensuring worker-style args map into proto fields for plugin IDs/classpath. |
| src/test/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel | Registers new BTAPI-related tests in the tasks test suite. |
| src/test/kotlin/io/bazel/kotlin/builder/KotlinJvmTestBuilder.java | Adds runBtapiCompileTask helper to execute BTAPI compilation in tests. |
| src/test/kotlin/io/bazel/kotlin/builder/KotlinAbstractTestBuilder.java | Makes test builder APIs public and adds toolchainSpecForTest() for BTAPI. |
| src/main/kotlin/io/bazel/kotlin/ksp2/Ksp2Invoker.kt | Minor doc cleanup in KSP2 invoker comment. |
| src/main/kotlin/io/bazel/kotlin/compiler/BuildToolsAPICompiler.kt | Removes the previous reflection-based BTAPI compiler wrapper. |
| src/main/kotlin/io/bazel/kotlin/builder/toolchain/ToolchainSpec.kt | Adds ToolchainSpec model for BTAPI runtime + internal plugin artifacts. |
| src/main/kotlin/io/bazel/kotlin/builder/toolchain/KotlinToolchain.kt | Simplifies KotlincInvokerBuilder to always build legacy kotlinc invoker. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/KotlinBtapiJvmTaskExecutor.kt | Implements BTAPI execution path, compilation + packaging steps, and error mapping. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiPluginArguments.kt | Converts typed CompilerPlugin objects into raw CLI argument strings. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompilerCache.kt | Adds toolchain-spec keyed BTAPI compiler cache with classpath validation. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompiler.kt | Implements direct BTAPI compilation and typed plugin construction from task proto. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompilationTask.kt | Adds BTAPI KAPT execution, output capture, and jdeps creation helper. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/KotlinJvmTaskExecutor.kt | Updates legacy executor to use simplified invoker builder signature. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt | Routes to BTAPI executor when build_tools_api is enabled; adds new flags for BTAPI + plugin IDs. |
| src/main/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel | Adjusts deps/neverlink to make BTAPI API available to the builder code. |
| src/main/kotlin/io/bazel/kotlin/builder/cmd/Build.kt | Wires both legacy and BTAPI executors into the worker entrypoint. |
| rules_kotlin_maven_install.json | Updates Kotlin toolchain Maven lockfile artifacts/hashes for Kotlin 2.3.20 and BTAPI dependencies. |
| rules_kotlin_maven_dev_install.json | Updates dev Maven lockfile artifacts/hashes (including jarjar tool changes). |
| kotlin/internal/toolchains.bzl | Exposes BTAPI runtime classpath and internal plugin artifacts on the Kotlin toolchain. |
| kotlin/internal/jvm/compile.bzl | Passes BTAPI runtime + internal plugin jars and plugin IDs into the builder action when enabled. |
| examples/plugin/maven_install.json | Updates example plugin Maven lockfile versions/hashes. |
| examples/jetpack_compose/maven_install.json | Updates Compose example Maven lockfile to Kotlin 2.3.20 artifacts. |
| docs/kotlin.md | Documents new define_kt_toolchain attributes for BTAPI runtime/internal plugins. |
| MODULE.release.bazel | Bumps Kotlin version from 2.3.20-RC2 to 2.3.20. |
| MODULE.bazel | Bumps Kotlin version and adds build-tools-api/build-tools-compat artifacts to Maven install. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
restingbull
reviewed
Mar 31, 2026
Collaborator
Author
restingbull
approved these changes
Apr 1, 2026
agluszak
added a commit
that referenced
this pull request
Apr 8, 2026
* Introduce BTAPI * Post-merge fixes * Repin example maven lockfiles * Address comments * Address comments * Address comments * Add more tests and minor improvements * Run buildifier
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.