Skip to content

Commit bbac783

Browse files
author
jchadwick-buf
authored
Improve Windows support (#115)
I'm still running into issues getting lint rules to work, but this at least fixes #113 and #114.
1 parent 12bdbac commit bbac783

File tree

2 files changed

+91
-6
lines changed

2 files changed

+91
-6
lines changed

MODULE.bazel.lock

Lines changed: 82 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

buf/internal/toolchain.bzl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ declare_buf_toolchains(
3131
"""
3232

3333
_TOOLCHAIN_FILE = """
34+
load("@bazel_skylib//rules:native_binary.bzl", "native_binary")
35+
3436
def _buf_toolchain_impl(ctx):
3537
toolchain_info = platform_common.ToolchainInfo(
3638
cli = ctx.executable.cli,
@@ -52,13 +54,15 @@ _buf_toolchain = rule(
5254
5355
def declare_buf_toolchains(os, cpu, rules_buf_repo_name):
5456
for cmd in ["buf", "protoc-gen-buf-lint", "protoc-gen-buf-breaking"]:
55-
cmd_suffix = ""
5657
if os == "windows":
57-
cmd_suffix = ".exe"
58+
native_binary(
59+
name = cmd,
60+
src = ":" + cmd + ".exe",
61+
)
5862
toolchain_impl = cmd + "_toolchain_impl"
5963
_buf_toolchain(
6064
name = toolchain_impl,
61-
cli = str(Label("//:"+ cmd + cmd_suffix)),
65+
cli = str(Label("//:"+ cmd)),
6266
)
6367
native.toolchain(
6468
name = cmd + "_toolchain",
@@ -138,6 +142,8 @@ def _buf_download_releases_impl(ctx):
138142
for sha_line in sha_list:
139143
if sha_line.strip(" ").endswith(".tar.gz"):
140144
continue
145+
if sha_line.strip(" ").endswith(".zip"):
146+
continue
141147
(sum, _, bin) = sha_line.partition(" ")
142148
bin = bin.strip(" ")
143149
lower_case_bin = bin.lower()

0 commit comments

Comments
 (0)