Fix configuration cache invalidation in klib cross-compilation check#3014
Open
omarismail94 wants to merge 1 commit into
Open
Fix configuration cache invalidation in klib cross-compilation check#3014omarismail94 wants to merge 1 commit into
omarismail94 wants to merge 1 commit into
Conversation
KotlinNativeCompilation.crossCompilationSupported resolves the crossCompilationMetadata JSONs exported by project dependencies and probes their existence. Capturing it in onlyIf makes the configuration cache evaluate it at store time, before the exporting tasks have run. When the build subsequently creates these files, the next build discards the cache entry with: "configuration cache cannot be reused because the file system entry ... has been created". To fix this, we mirror KGP's own compileKotlin<Target> task behavior: * Keep the target-level condition (cross-compilation property enabled and no cinterops) in a stored provider * Declare the metadata JSONs as task inputs so that the exporting tasks run first. * Read and parse these metadata files in onlyIf at execution time. TESTED: Update the regression test (testNativeConfigurationCacheReuse) which could not catch this bug previously. The old test used a host-supported target that never took the cross-compilation target. The updated test targets iosArm64 to force the cross-compilation path, and builds the iosArm64 klib and asserts configuration cache reuse.
Collaborator
|
I think this PR requires a review from @hfmehmed :) |
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.
KotlinNativeCompilation.crossCompilationSupported resolves the crossCompilationMetadata JSONs exported by project dependencies and probes their existence. Capturing it in onlyIf makes the configuration cache evaluate it at store time, before the exporting tasks have run. When the build subsequently creates these files, the next build discards the cache entry with: "configuration cache cannot be reused because the file system entry ... has been created".
To fix this, we mirror KGP's own compileKotlin task behavior:
TESTED: Update the regression test (testNativeConfigurationCacheReuse) which could not catch this bug previously. The old test used a host-supported target that never took the cross-compilation target. The updated test targets iosArm64 to force the cross-compilation path, and builds the iosArm64 klib and asserts configuration cache reuse.