Expose the buf CLI as a supported target (@rules_buf_toolchains//:buf is not visible under Bazel 10)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 66/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 領域
- build-system
研究方向
Start by reading the generated toolchains repository BUILD setup and the code that selects native_binary by operating system; the issue does not name those files. Check how the buf toolchain exposes its CLI and how existing executable targets are documented. Done means users have a supported, documented executable target for the downloaded buf CLI that works across platforms.
由索引模型根據 Issue 內容生成。
描述
There is currently no documented way to use the buf CLI downloaded by rules_buf as a tool, for example as the formatter in rules_multirun, a bazel run target or a genrule.
Users reach for @rules_buf_toolchains//:buf, but on Linux and macOS that label is a plain source file (the downloaded binary), and Bazel 10 stops that from working.
Request
Expose the buf CLI as a supported, documented executable target.
For example, always wrap it in native_binary (not just on Windows) and document it, or expose it from the rules_buf repo.
What breaks under Bazel 10
Bazel 10 no longer exports source files implicitly (--incompatible_no_implicit_file_export, see the file visibility proposal).
The generated rules_buf_toolchains repo sets default_visibility to public, but buf is only a source file on non-Windows platforms (native_binary is used only when os == "windows"), so it is not exported.
That is consistent with the proposal, so this is not a bug in itself.
It does show that depending on this label was never safe.
With rules_buf 0.6.1 and Bazel 10.0.0rc4:
alias(
name = "buf",
actual = "@rules_buf_toolchains//:buf",
)
bazel build //:buf fails with:
ERROR: in alias rule //:buf: Visibility error:
target '@@rules_buf++buf+rules_buf_toolchains//:buf' is not visible from target '//:buf'
The same build succeeds with --noincompatible_no_implicit_file_export, so the cause is the new default.
Options
- Add a supported buf target (preferred).
- As a minimal stopgap, add
exports_files(["buf", "protoc-gen-buf-lint", "protoc-gen-buf-breaking"])to the generated toolchains BUILD file, which makes the export explicit.
Workaround
Resolve the registered toolchain (@rules_buf//tools/buf:toolchain_type) in a small rule and expose its cli as an executable.
I could not find an existing issue about this.
- 主要語言
- Starlark
- 星號
- 64
- 分支
- 41
- 平均合併
- 3 小時 49 分鐘
- 30 天內合併 PR
- 10
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
bufbuild/rules_buf 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 55/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 38/100
bufbuild/rules_buf#131 · 2 個 reaction ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 52/100
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 38/100
維護者通常 1 天內回覆
查看 bufbuild/rules_buf 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
oracle/graalvm-reachability-metadata#12264 ·
維護者通常 1 天內回覆
-
A-Packaging C-Bug D-Straightforward S-Needs-Triage
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
cli/gh-extension-precompile#110 ·
-
難度 2/5 1-3 小時 新手友好度 69/100
qoretechnologies/qore#8403 · 1 則留言 ·
維護者通常 1 天內回覆
-
good first issue help wanted
難度 2/5 1-3 小時 新手友好度 88/100
omarelshamy25x/shamy-arabic-nlp#92 ·
維護者通常 1 天內回覆