Skip to content

Not compatible with Gradle Isolated Projects #285

@cpaleop

Description

@cpaleop

Property fetching logic in ProjectExtensionsKt.findProperty(name): String? is not compatible with Gradle Project Isolation. Relevant exception when configuration-cache and isolated projects are enabled:

Exception at `co.touchlab.kmmbridge.ProjectExtensionsKt.findStringProperty(ProjectExtensions.kt:25)`
org.gradle.api.InvalidUserCodeException: Project ':feature:some_kmp_feature' cannot access 'Project.extensions' functionality on another project ':'
	at org.gradle.api.internal.project.MutableStateAccessAwareProject.getExtensions(MutableStateAccessAwareProject.java:107)
	at co.touchlab.kmmbridge.ProjectExtensionsKt.findStringProperty(ProjectExtensions.kt:25)
	at co.touchlab.kmmbridge.BaseKMMBridgePlugin.apply(KMMBridge.kt:56)
	at co.touchlab.kmmbridge.github.KMMBridgeGitHubPlugin.apply(KMMBridgeGitHubPlugin.kt:16)
	at co.touchlab.kmmbridge.github.KMMBridgeGitHubPlugin.apply(KMMBridgeGitHubPlugin.kt:13)

Ideally, providers.gradleProperty(name).getOrNull() should be used if the configuration solely relies on properties declared in gradle.properties or passed via -P through CLI. The currently used ExtraPropertiesExtension has other usecases too.

Let me know if you want a reproducer project for this. But it should be easy to get this failure in any sample project that has configuration-cache + project isolation enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions