[agent] Found by the scheduled Gradle bug-hunt routine (ledger #319).
Summary
redirect_gradle_manual_snippet fires for build.gradle.kts / settings.gradle.kts as well as the Groovy files, but its snippet is always Groovy: maven { url "…" }. That is not valid Kotlin DSL, so a user who pastes it into a Kotlin DSL build (the gradle init default since Gradle 8) gets a script compilation error. The code comment on gradle_snippet says "the Kotlin DSL differs only in quoting", but it doesn't: Kotlin needs url = uri("…"). The warning also doesn't say the snippet is Groovy-only.
Impact
The documented Gradle hosted path can't be used verbatim by Kotlin DSL projects. The failure is loud, not silent, but users have to know how to translate the snippet.
Repro
Paste the exact snippet from scan --mode hosted --json (redirect.warnings[].detail) into a build.gradle.kts with plugins { java }, repositories { mavenCentral() } and implementation("org.apache.commons:commons-text:1.10.0-socket.4d5e6f70"), then run gradle dependencies:
e: file:///…/build.gradle.kts:6:25: Unexpected tokens (use ';' to separate expressions on the same line)
* Where: Build file '…/build.gradle.kts' line: 6
maven { url "file:///tmp/gw/socketrepo" }
Replacing only that line with maven { url = uri("file:///tmp/gw/socketrepo") } makes the build resolve commons-text-1.10.0-socket.4d5e6f70.jar, so includeVersion(...) and the rest of the block are fine in Kotlin.
Expected vs actual
- Expected (docs/ecosystems.md, "Gradle (hosted Maven)"): a present
build.gradle* / settings.gradle* gets a paste-able exclusiveContent { … } snippet. For a .kts build it should be Kotlin syntax, or both variants should be printed.
- Actual: Groovy syntax, and a compile error in every Kotlin DSL build.
Matrix (Linux; each run twice)
| Gradle |
JDK |
Groovy build.gradle |
Kotlin build.gradle.kts |
| 6.9.4 |
11 |
compiles ✅ |
compile error ❌ |
| 7.6.6 |
17 |
compiles ✅ |
compile error ❌ |
| 8.14.3 |
21 |
compiles ✅ |
compile error ❌ |
| 9.8.0 |
21 |
compiles ✅ |
compile error ❌ |
First bad release
v4.0.0, when the snippet was introduced.
Suspect code
crates/socket-patch-core/src/patch/redirect/mod.rs:7133-7157 (gradle_snippet, one fixed format string). GRADLE_FILES at mod.rs:6529 includes the .kts names, but the DSL is never selected.
[agent] Found by the scheduled Gradle bug-hunt routine (ledger #319).
Summary
redirect_gradle_manual_snippetfires forbuild.gradle.kts/settings.gradle.ktsas well as the Groovy files, but its snippet is always Groovy:maven { url "…" }. That is not valid Kotlin DSL, so a user who pastes it into a Kotlin DSL build (thegradle initdefault since Gradle 8) gets a script compilation error. The code comment ongradle_snippetsays "the Kotlin DSL differs only in quoting", but it doesn't: Kotlin needsurl = uri("…"). The warning also doesn't say the snippet is Groovy-only.Impact
The documented Gradle hosted path can't be used verbatim by Kotlin DSL projects. The failure is loud, not silent, but users have to know how to translate the snippet.
Repro
Paste the exact snippet from
scan --mode hosted --json(redirect.warnings[].detail) into abuild.gradle.ktswithplugins { java },repositories { mavenCentral() }andimplementation("org.apache.commons:commons-text:1.10.0-socket.4d5e6f70"), then rungradle dependencies:Replacing only that line with
maven { url = uri("file:///tmp/gw/socketrepo") }makes the build resolvecommons-text-1.10.0-socket.4d5e6f70.jar, soincludeVersion(...)and the rest of the block are fine in Kotlin.Expected vs actual
build.gradle*/settings.gradle*gets a paste-ableexclusiveContent { … }snippet. For a.ktsbuild it should be Kotlin syntax, or both variants should be printed.Matrix (Linux; each run twice)
build.gradlebuild.gradle.ktsFirst bad release
v4.0.0, when the snippet was introduced.
Suspect code
crates/socket-patch-core/src/patch/redirect/mod.rs:7133-7157(gradle_snippet, one fixed format string).GRADLE_FILESatmod.rs:6529includes the.ktsnames, but the DSL is never selected.