Improve support for isolated projects#196
Open
OndraBasler wants to merge 1 commit into
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
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
The SKIE Gradle plugin reads task dependencies across the configuration graph while
configuring a project that applies
co.touchlab.skie. This is forbidden under Gradle'sConfiguration Cache / Isolated Projects, so enabling
org.gradle.unsafe.isolated-projects=truefails anyproject that builds an XCFramework.
getFrameworksUsedInXCFrameworks()inActualKgpShimcallsXCFrameworkTask.taskDependencies.getDependencies(...). This PR replaces that with aconfiguration-cache-safe lookup based on the task's input files.
The bug
:sharedhere is any KMP module that applies SKIE and assembles an XCFramework(
XCFramework("Shared")withiosX64/iosArm64/iosSimulatorArm64). Thefailure occurs while storing the configuration cache.
Root cause
co/touchlab/skie/plugin/shim/impl/ActualKgpShim.kt:taskDependencies.getDependencies()walks the task graph, which Gradle disallows duringconfiguration under the configuration cache / isolated projects. The result is only used
to set the
isForXCFrameworkflag on eachActualSkieBinaryTarget, which gatesSkieConfigurationFlag.Build_SwiftLibraryEvolution. So the function only needs to knowwhich
Frameworkbinaries end up inside anXCFrameworkTask.The fix
KGP's
XCFrameworkTask.from(framework)registers the framework's link-task output as aninput file of the XCFramework task:
So the same framework↔XCFramework relationship is reachable via
task.inputs.files(config-cache safe) instead of walking task dependencies. The replacement matches each
KotlinNativeLinkoutput file against the XCFramework tasks' input files:How to reproduce
co.touchlab.skieand builds an XCFramework.gradle.properties:Project ':shared' cannot access task dependencies directlyand the cache entry is discarded.