Add KSP plugin support for android_binary and android_library#195
Merged
minkuanlim-grabtaxi merged 2 commits intograb:masterfrom Jan 9, 2026
Merged
Add KSP plugin support for android_binary and android_library#195minkuanlim-grabtaxi merged 2 commits intograb:masterfrom
minkuanlim-grabtaxi merged 2 commits intograb:masterfrom
Conversation
Move plugins attribute from android_binary to kt_jvm_library so that KSP processors are invoked during Kotlin compilation phase rather than at the binary packaging stage. Changes: - Pass plugins attribute to kt_jvm_library in android_binary macro - Update Kotlin compiler to 1.9.25 with KSP 1.9.25-1.0.20 - Add room-compiler as a test KSP plugin to validate the integration - Update related dependencies (kotlinpoet, symbol-processing-api)
Replace androidx.room with Dagger as the KSP processor in test targets to better validate KSP integration with dependency injection workflows. Changes: - Replace room-compiler with dagger-compiler as KSP test processor - Create separate bazel_common_test_maven repository for Dagger 2.52 - Add Dagger components with @Inject dependencies in test modules: * LibraryActivityComponent with SomeDependency in android_library * TestActivityComponent with SimpleDependency in android_binary - Split dependency classes from component interfaces into separate files for better code organization - Update test activities to invoke Dagger-generated factory code - Remove room-compiler from main maven dependencies This validates that KSP plugins properly invoke annotation processors during Kotlin compilation phase in both android_binary and android_library targets.
arunsampathkumar-grabtaxi
approved these changes
Jan 9, 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.
Summary
This PR adds support for KSP (Kotlin Symbol Processing) plugins in
android_binaryandandroid_librarymacros.Problem
Previously, the plugins attribute was passed directly to the native
android_binaryrule. However, KSP plugins need to be invoked during the Kotlin compilation phase, not at the binary packaging stage. This meant KSP processors were not being executed.Solution
Move the plugins attribute from
android_binarytokt_jvm_library, ensuring KSP processors are invoked during Kotlin compilation where they can properly generate code.Changes
android_binarytokt_jvm_libraryfor proper KSP execution1.9.25with KSP1.9.25-1.0.202.52in separate test maven repository to validate KSP integrationTesting
Added
dagger-compileras a KSP plugin to bothandroid_binaryandandroid_librarytest targets to validate the integration. Test implementation includes Dagger
@Componentinterfaces with@Injectdependencies, where test activities invokethe generated factory code to verify KSP processors execute correctly during
Kotlin compilation.