Support generating and maintaining buf.lock (buf dep update / buf dep prune)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- kotlin
- Ambito
- build-system, tooling
Direzione di ricerca
Start by reading the README’s dependency setup and the plugin’s BufExtension and copyBufConfig implementation, which the issue identifies as the current gaps. Trace how bufBuild, bufLint, and bufGenerate use the copied workspace and the pinned CLI. Done means dependency update and prune tasks manage buf.lock, dependent tasks resolve it, and the lock file is copied into the build workspace.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Motivation
A buf.yaml v2 workspace can declare BSR dependencies in deps:. The resolution of those dependencies is pinned in a buf.lock file, generated by the Buf CLI (buf dep update for v2 configs, buf mod update for v1 configs) and committed next to buf.yaml.
Today the plugin cannot produce or manage that lock file:
- The README states: "If your
buf.yamldeclares any dependencies using thedepskey, you must runbuf mod updateto create abuf.lockfile manually. Thebuf-gradle-plugindoes not (yet) support creating the dependency lock file." BufExtensionexposes nodeps/lockFileproperties, and the plugin registers no task that runsbuf dep update/buf dep prune.copyBufConfigcopies onlybuf.yamlintobuild/bufbuild;buf.lockis never copied, so a build workspace whose config declaresdeps:cannot resolve imports from BSR modules at all.
For projects using this plugin together with BSR dependencies (for example buf.build/googleapis/googleapis or buf.build/bufbuild/protovalidate), lock file creation, refresh, and pruning are entirely manual out-of-band steps, and it is easy for buf.lock to drift from buf.yaml (or to be missing entirely, in which case imports fail with imported file does not exist).
Proposed API
Something along these lines (happy to adjust to whatever shape the maintainers prefer):
buf {
deps {
module("buf.build/googleapis/googleapis")
module("buf.build/bufbuild/protovalidate")
}
// Optional: where the lock file lives/written. Defaults to <config dir>/buf.lock
lockFileLocation = rootProject.file("buf.lock")
}
deps would let the plugin know that dependency resolution is required (and could also be used to generate a deps section when the plugin writes the workspace config), while lockFileLocation would allow the lock file to live outside the module directory, which is what multi-module setups typically want.
Proposed tasks
bufDepUpdate— runsbuf dep updateagainst the Buf config, creating or refreshingbuf.lock(including transitive dependencies).bufDepPrune— runsbuf dep pruneto drop lock entries that are no longer imported by any module.
Suggested behaviour:
- When
depsare declared,bufDepUpdateshould be wired as a dependency of the tasks that need resolved dependencies:bufBuild,bufLint, andbufGenerate(the latter especially whengenerate { includeImports = true }is set, since generation readsbuf.lock). buf.lockshould be declared as a task input/output so incremental builds behave correctly.buf dep updatewrites the file into the working directory, so without proper input/output declarations the dependent tasks would re-run on every build.- When the plugin copies the config into
build/bufbuild, it should also copybuf.locknext to it, so the generated build workspace can resolve imports from BSR modules.
Workaround today
- Run
buf dep updateby hand (or from CI) and commitbuf.lock. - Add a custom
Exectask that shells out to the CLI.
Additional notes
buf dep updaterequires network access to the BSR, and authentication for private registries; the plugin already downloads a pinned CLI (toolVersion), so the tasks should use that same binary rather than requiring one onPATH.- The README currently references the v1-era
buf mod update; the v2 commands arebuf dep updateandbuf dep prune. - Related prior art: kotlinx-rpc PR #739 (KRPC-585) added
buf.depsplus aBufLockTaskthat either runsbuf dep updateor copies a provided lock file, and madebuf.yaml/buf.gen.yaml/buf.locktask inputs for the same incremental-build reason.
- Lingua principale
- Kotlin
- Stelle
- 56
- Fork
- 17
- Merge medio
- 2g 14h
- PR unite (30g)
- 11
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un 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 bufbuild/buf-gradle-plugin
-
Support Buf Registry LoginAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
bufbuild/buf-gradle-plugin#339 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
bufbuild/buf-gradle-plugin#338 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
bufbuild/buf-gradle-plugin#208 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
bufbuild/buf-gradle-plugin#197 · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
bufbuild/buf-gradle-plugin#190 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bufbuild/buf-gradle-plugin
Issue simili
-
android bug P2-moderate ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AroundTeam2026/AroundApp#843 ·
I maintainer di solito rispondono entro 1 giorno
-
Wobbly SeekbarApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mpvRex/REX-Player#524 ·
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ls1intum/artemis-android#838 ·
-
android internals
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno