fix(kmp): derive the snapshot version without blocking the configuration cache - #1028
fix(kmp): derive the snapshot version without blocking the configuration cache#1028jamesarich wants to merge 1 commit into
Conversation
…ion cache
packages/kmp cannot be built with --configuration-cache:
- Build file 'build.gradle.kts': external process started
'git describe --tags --abbrev=0'
> Starting an external process during configuration time is unsupported.
The version fallback started git via ProcessBuilder directly, which Gradle
rejects outright under the configuration cache. Switch to providers.exec, which
records the invocation as a configuration-cache input instead.
Behaviour is unchanged. The runCatching wrapper still covers a missing git
binary, and isIgnoreExitValue keeps a tagless or shallow clone on the existing
0.0.1-SNAPSHOT path rather than failing the build. Verified that the derived
version is identical before and after (2.7.27-SNAPSHOT).
./gradlew help --configuration-cache entry stored, then reused
./gradlew build --configuration-cache BUILD SUCCESSFUL, 79 tasks
This only unblocks the configuration cache; it does not enable it. Turning it on
in gradle.properties is a separate call.
|
The latest Buf updates on your PR. Results from workflow pull-request / build (pull_request).
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe build script now uses Gradle’s ChangesGit version lookup
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)packages/kmp/build.gradle.ktsCheckov skipped this file: it was unavailable in the sandbox worktree 🔧 detekt (1.23.8)packages/kmp/build.gradle.ktsException in thread "main" com.beust.jcommander.ParameterException: Provided path 'packages/kmp/build.gradle.kts' does not exist! Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
packages/kmpcurrently cannot be built with--configuration-cacheat all:The
VERSION_NAMEfallback — which patch-bumps the latest git tag for localsnapshot builds — started git through
ProcessBuilderdirectly. Gradle rejectsthat outright under the configuration cache.
The change
Use
providers.execinstead. It is the configuration-cache-aware equivalent:the invocation is recorded as a configuration-cache input rather than being an
unsupported side effect.
Behaviour is unchanged, including both degradation paths:
runCatchingwrapper still covers a missinggitbinary;isIgnoreExitValue = truekeeps a tagless or shallow clone on the existing0.0.1-SNAPSHOTpath instead of failing configuration.Verification
./gradlew help --configuration-cache./gradlew build --configuration-cache2.7.27-SNAPSHOT2.7.27-SNAPSHOT(identical)Scope
This only unblocks the configuration cache — it does not enable it.
gradle.propertiesstill leaves it off, so nothing changes for CI or foranyone not passing the flag. Turning it on is a separate call, worth making
once there is Build Scan data to measure the win (see #1027).
Found while onboarding this repo to Develocity (#1027); the CC-reuse check in
that PR's verification could not be run because of this.
Summary by CodeRabbit