Fix isolated-projects incompatibility from dynamic property lookup#188
Open
Sharang-1 wants to merge 1 commit into
Open
Fix isolated-projects incompatibility from dynamic property lookup#188Sharang-1 wants to merge 1 commit into
Sharang-1 wants to merge 1 commit into
Conversation
Project.findProperty walks up to the parent project's properties, which Gradle's Isolated Projects feature forbids. Switch to providers.gradleProperty for the skie.kgpVersion override so the plugin works when -Dorg.gradle.unsafe.isolated-projects=true is set. Fixes touchlab#178 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Problem
With Gradle's Isolated Projects enabled
(
-Dorg.gradle.unsafe.isolated-projects=true), applying the SKIE pluginfails configuration with:
The configuration-cache report points at
SkieKotlinVariantResolver.findKotlinGradlePluginVersionFromOverrideProperty(line 103), which uses
Project.findProperty("skie.kgpVersion"). That APIwalks up to the parent project's properties, which Isolated Projects
forbids because it couples configuration of the subproject to the root.
Fix
Replace
findProperty(...) as? Stringwithproviders.gradleProperty(...).orNull. The new API:gradle.propertiesat root and subproject, plus-PCLI properties — so users who setskie.kgpVersionanywhere stillhave it picked up.
Provider<String>resolved through Gradle's lazyvalue-supplier model, which is the documented Isolated Projects-safe
replacement for dynamic
findPropertycalls.The fixed private helper is the only path to
skie.kgpVersion, so thisone-line change covers both call sites that need the override (warning
emission and the actual version lookup).
Reproduction
In any KMP project with SKIE applied:
./gradlew help -Dorg.gradle.unsafe.isolated-projects=true
BUILD FAILEDwith the error quoted above.BUILD SUCCESSFUL, configuration cache entry stored.Also verified end-to-end with the iOS link task; no further isolation
violations surfaced in the configuration-cache report:
./gradlew :shared:linkDebugFrameworkIosArm64 -Dorg.gradle.unsafe.isolated-projects=true