Refactor property fetching to Gradle properties - #287
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors KMMBridge’s property lookup to use Gradle’s ProviderFactory.gradleProperty(...), addressing incompatibilities with Gradle’s Project Isolation (and improving configuration-cache friendliness) by avoiding cross-project access to the root project’s extensions.
Changes:
- Replaced root-project
ExtraPropertiesExtensionlookup withproviders.gradleProperty(name).getOrNull(). - Removed the
ExtraPropertiesExtensionimport as it’s no longer used.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
faogustavo
left a comment
There was a problem hiding this comment.
That's great. Thanks for the contribution. Just including a minor note here so we can include it in the release notes later on.
Possible breaking change: support for Gradle Project Isolation
KMMBridge no longer reads its configuration from the root project's extra properties, since cross-project access is incompatible with Gradle Project Isolation. If you set KMMBridge properties (GITHUB_REPO, ENABLE_PUBLISHING, spmBuildTargets, …) via
rootProject.ext/extra, your modules will no longer see them. Provide them through agradle.propertiesfile (project or home dir), the-Pname=valuecommand-line argument, or anORG_GRADLE_PROJECT_environment variable.
Issue: #285
Summary
The linked issue describes a failure occurring when Gradle Project Isolation feature is enabled.
Project Isolation is promoted to incubating status in Gradle 9.7.0 which allows for early adoption, and some of our repositories only fail with the issue described here.
The issue with my change is that it will probably require changes to your docs. My changes introduce behavioral changes, because properties defined in the root project will no longer be accessible. Only properties set via:
gradle.properties-Pprefix in CLIFix
Followed Gradle's suggestion when it comes to fetching properties, specifically this guide. In addition, this had a nice improvement in Gradle 9.6.0 in regards of configuration cache.