Clean up how KSP checks for klib cross-compilation support#2953
Merged
Conversation
5a318ea to
942af64
Compare
hfmehmed
reviewed
May 19, 2026
hfmehmed
reviewed
May 19, 2026
5cd6968 to
a79a78f
Compare
Instead of introducing a custom KSP DSL property, this consolidates native cross-compilation checking on KGP's standard `kotlin.native.enableKlibsCrossCompilation` property as the single source of truth. - Removed `enableKlibsCrossCompilation` from the KSP extension DSL. - Moved the `enableKlibsCrossCompilation` property inside `KspGradleConfig` task input to prevent task-level capture of `kspAATask` during closure serialization. - Re-implemented the `getKlibCrossCompilationSupport` helper to prioritize subproject-level overrides (from `ext` or subproject `gradle.properties`) eagerly via `findProperty`, cleanly falling back to a lazy Gradle property provider chain. - Bypassed KGP's `crossCompilationSupported` provider check to resolve dynamic filesystem modifications during task graph serialization that was invalidating the configuration cache. - Updated the `KMPImplementedIT.testSubprojectPropertyOverride` integration test to explicitly set the global fallback to false and dynamically override inside the subproject's `gradle.properties` file.
5b808d2 to
c53dc35
Compare
hfmehmed
approved these changes
May 20, 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.
Querying KGP's
kotlinCompilation.crossCompilationSupportedeagerly writes a metadata JSON file inside the build directory during task graph serialization. This dynamic file creation invalidates the Gradle Configuration Cache on subsequent runs.To fix:
onlyIfcheck so host native compiles (like linuxX64 on Linux) short-circuit immediately and skip querying the cross-compilation property entirely.CC: @eygraber @liutikas