Files
visor/tools/rules_go_sdk.patch
Konstantin Bogomolov 415fb10050 Fix build for Bazel 8.
Specifically, build using bazel WORKSPACE. Bazel modules is still not
used and requires further migration.

This updates some dependencies to make them compatible with Bazel 8,
which in turn requires explicitly adding some new dependencies to
support new versions. In some cases existing patches no longer applied
and had to be updated. A new patch was added to remove windows
toolchains from coral-crosstools, because that functionality requires
lots of bazel intrinsics that are no longer defined.

At least on my machine, when //vdso:vdso was a dependency (not targetted
explicitly), the Gold linker specified in `vdso_linker_option` failed to
be found (bazel build //vdso worked); however this led me to discover
that the Gold linker is deprecated, hence using it is removed entirely.

To make the repo compatible with bazelisk out of the box, a bazelversion
file has been added.
2025-08-13 02:14:21 +00:00

31 lines
1.1 KiB
Diff

diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl
index 156bb255..619c5395 100644
--- a/go/private/sdk.bzl
+++ b/go/private/sdk.bzl
@@ -129,6 +129,8 @@ def _go_download_sdk_impl(ctx):
"sdks": ctx.attr.sdks,
"urls": ctx.attr.urls,
"version": version,
+ "patch": ctx.attr.patch,
+ "patch_strip": ctx.attr.patch_strip,
"strip_prefix": ctx.attr.strip_prefix,
}
return None
@@ -144,6 +146,7 @@ go_download_sdk_rule = repository_rule(
),
"urls": attr.string_list(default = ["https://dl.google.com/go/{}"]),
"version": attr.string(),
+ "patch": attr.label(default = None),
"strip_prefix": attr.string(default = "go"),
"patches": attr.label_list(
doc = "A list of patches to apply to the SDK after downloading it",
@@ -432,6 +435,8 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256):
sha256 = sha256,
auth = auth,
)
+ if ctx.attr.patch:
+ ctx.patch(ctx.attr.patch, strip = ctx.attr.patch_strip)
def _local_sdk(ctx, path):
for entry in ctx.path(path).readdir():