Support for Kaptish feature - a build time optimization for Kapt#1529
Open
oliviernotteghem wants to merge 1 commit intobazel-contrib:masterfrom
Open
Support for Kaptish feature - a build time optimization for Kapt#1529oliviernotteghem wants to merge 1 commit intobazel-contrib:masterfrom
oliviernotteghem wants to merge 1 commit intobazel-contrib:masterfrom
Conversation
d42ba03 to
3888196
Compare
Collaborator
|
Add an example of using kaptish? (Those are our integration tests, for the most part.) |
3888196 to
95bda17
Compare
ryanulep
pushed a commit
to uber-common/rules_kotlin
that referenced
this pull request
Apr 9, 2026
ryanulep
pushed a commit
to uber-common/rules_kotlin
that referenced
this pull request
Apr 16, 2026
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.
Add Kaptish: Fast Annotation Processing for Kotlin
Summary
This PR introduces kaptish, an experimental optimization for annotation processing that bypasses KAPT's expensive stub generation phase, resulting in 1.75-2x faster builds for projects using annotation processors
with Kotlin.
How it works
Traditional KAPT uses a 3-pass approach:
Kaptish simplifies this to:
This works because annotation processors primarily need type information (class names, method signatures, annotations), which is available in compiled bytecode.
Usage
Enable globally in toolchain:
define_kt_toolchain(
name = "kotlin_toolchain",
experimental_kaptish_enabled = True,
)
Opt-out per target:
kt_jvm_library(
name = "my_library",
srcs = ["MyClass.kt"],
plugins = ["//path/to:annotation_processor"],
tags = ["kaptish_disabled"], # Falls back to KAPT
)
Files changed
New files:
Modified files:
Test plan
bazel test //src/test/kotlin/io/bazel/kotlin:KotlinJvmKaptishAssertionTest
bazel test //src/test/kotlin/io/bazel/kotlin:assertion_tests
Limitations