Skip to content

Btapi introduction only#1534

Merged
restingbull merged 8 commits intobazel-contrib:developfrom
agluszak:btapi-introduction-only
Apr 1, 2026
Merged

Btapi introduction only#1534
restingbull merged 8 commits intobazel-contrib:developfrom
agluszak:btapi-introduction-only

Conversation

@agluszak
Copy link
Copy Markdown
Collaborator

No description provided.

@agluszak agluszak force-pushed the btapi-introduction-only branch from a7342d6 to d85eef4 Compare March 24, 2026 15:25
@agluszak agluszak mentioned this pull request Mar 26, 2026
@agluszak agluszak marked this pull request as ready for review March 26, 2026 23:52
@agluszak agluszak requested a review from Copilot March 26, 2026 23:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompiler.kt Outdated
Copy link
Copy Markdown
Collaborator

@restingbull restingbull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore

Comment thread src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompiler.kt Outdated
Comment thread src/main/kotlin/io/bazel/kotlin/builder/tasks/jvm/btapi/BtapiCompiler.kt Outdated
@agluszak
Copy link
Copy Markdown
Collaborator Author

The copyright year [...] is 2026, which appears to be a future date

image

😀

@agluszak agluszak requested a review from restingbull March 31, 2026 22:02
@restingbull restingbull merged commit 8f11bc3 into bazel-contrib:develop Apr 1, 2026
1 check passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants