Hosted Gradle snippet is always Groovy DSL, so pasting it into a build.gradle.kts fails to compile
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- build-system, cli
Direzione di ricerca
Inizia in crates/socket-patch-core/src/patch/redirect/mod.rs intorno a gradle_snippet alle righe 7133-7157, poi esamina GRADLE_FILES vicino alla riga 6529 ed esegui la riproduzione della scansione ospitata. L'avviso dovrebbe produrre Kotlin DSL incollabile per i file .kts, preservando al contempo un output Groovy valido per i file Groovy; verifica la risoluzione con il comando Gradle dependencies descritto nell'issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[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-ableexclusiveContent { … }snippet. For a.ktsbuild 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.
- Lingua principale
- Rust
- Stelle
- 8
- Fork
- 1
- Merge medio
- 19h 1m
- PR unite (30g)
- 473
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SocketDev/socket-patch
-
agent:triaged bug pm:go priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
SocketDev/socket-patch#1409 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged bug bughunt pm:npm priority:p3 ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
SocketDev/socket-patch#1072 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged bug bughunt pm:yarn-berry priority:p1
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
SocketDev/socket-patch#783 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Vendored cargo warns cargo_multi_version_old_cargo ("declares no rust-version") when the root package inherits rust-version from [workspace.package]Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaagent:triaged bug bughunt pm:cargo priority:p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
SocketDev/socket-patch#651 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
agent:triaged bench perf-regression pm:nuget priority:p3
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
SocketDev/socket-patch#1425 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SocketDev/socket-patch
Issue simili
-
ai-priority/P2 bug db/oracle user-priority/P1
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
swc-project/swc#12516 ·
I maintainer di solito rispondono entro 1 giorno
-
app bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
mls-rs-crypto-awslc: exact aws-lc-rs =1.16.3 pin blocks rustls security updateForse già presa @muscariello l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100