-
Notifications
You must be signed in to change notification settings - Fork 21
Add KSP Plugin Support #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
minkuan88
wants to merge
6
commits into
grab:master
Choose a base branch
from
minkuan88:ksp-support-modules
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
60ab07a to
df25ba1
Compare
df25ba1 to
2797a31
Compare
- Add KspExtension DSL with nested compiler and processor configuration - Support version catalog references for processor configuration - Auto-detect processor_class from JAR's META-INF/services file - Configure generates_java and target_embedded_compiler per processor - Generate kt_ksp_plugin rules in root BUILD.bazel with all attributes - Add KspProcessorClassExtractor for reading processor classes from JARs - Fix Groovy closure delegation for nested DSL blocks - Add kspConfiguration support to Variant interface for extracting KSP deps - Emit plugins attribute on android_library/android_binary targets
- Add KSP scope to ResolveDependenciesResult for separate dependency tracking - Resolve KSP configurations (*KotlinProcessorClasspath) in ResolveVariantDependenciesTask - Aggregate KSP deps across all variants into single kspResult in ComputeWorkspaceDependencies - Generate ksp_maven maven_install from aggregated KSP dependencies - Add calculateRepositoriesIncludingTransitives to extract repos from transitive deps - Update KspRules to reference @ksp_maven instead of @maven for processor deps - Only include direct KSP processors in artifacts, let Bazel resolve transitives
2797a31 to
94cadce
Compare
Move KSP-related code out of GradleProjectInfo to ensure the implementation is configuration cache compatible. KSP processors are now built directly from WorkspaceDependencies in RootBazelFileBuilder. Changes: - Move KspProcessor data class to KspRules.kt - Remove hasKsp and kspDependencies from GradleProjectInfo interface - Add buildKspProcessors() method in RootBazelFileBuilder - Add collectKspPluginDeps() to DependenciesDataSource for module-level KSP deps - Update GenerateRootBazelScriptsTask to pass workspaceDependencies
94cadce to
da72ecb
Compare
- Moshi is simpler than Room (just @JsonClass annotation) - Added MoshiModel.kt with User data class for KSP generation - Added verifyKspCodeGeneration() in MainActivity to verify KSP-generated UserJsonAdapter works at compile time - Updated ksp_maven to use moshi-kotlin-codegen processor - Verified both Gradle and Bazel builds pass
Similar to PR grab#159, this optimizes configuration time by skipping expensive KSP resolution for projects/variants without KSP deps. - Add hasKspDependencies() to check project's base ksp configuration - Conditionally process KSP configs only when dependencies exist - Skip processor class extraction and resolution when not needed
Extend KSP support to pure Kotlin (JVM) library modules by wiring up the plugin extraction in KotlinProjectDataExtractor and passing plugins through to the generated kotlin_library targets. Changes: - Add plugins field to KotlinProjectData - Extract KSP plugins via collectKspPluginDeps() in extractor - Pass plugins to KotlinLibraryTarget in builder Also add KSP/Moshi testing to sample modules: - sample-kotlin-library: Add KotlinConfig data class with @JsonClass - sample-android-library: Add @JsonClass to User (alongside @parcelize)
30beffa to
4d1d730
Compare
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
Add KSP (Kotlin Symbol Processing) support to Grazel.
What's New
kt_ksp_pluginrules in root BUILD.bazelpluginsattribute onandroid_library,android_binary, andkotlin_librarytargetsksp_mavenrepository for processor dependenciesTest Plan