Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Latin-1 workaround on Bazel 6.4.0+ #3872

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions go/private/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,14 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256):
# in Bazel 6.0.0+ (bazelbuild/bazel#16052). The only situation where
# .zip files are needed seems to be a macOS host using a Windows toolchain
# for remote execution.
if urls[0].endswith(".tar.gz"):
if versions.is_at_least("6.4.0", versions.get() or "6.4.0"):
ctx.download_and_extract(
url = urls,
stripPrefix = strip_prefix,
sha256 = sha256,
auth = auth,
)
elif urls[0].endswith(".tar.gz"):
if strip_prefix != "go":
fail("strip_prefix not supported")
ctx.download(
Expand All @@ -455,7 +462,7 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256):
fail("error extracting Go SDK:\n" + res.stdout + res.stderr)
ctx.delete("go_sdk.tar.gz")
elif (urls[0].endswith(".zip") and
host_goos != "windows" and
host_goos == "darwin" and
# Development versions of Bazel have an empty version string. We assume that they are
# more recent than the version that introduced rename_files.
versions.is_at_least("6.0.0", versions.get() or "6.0.0")):
Expand All @@ -469,13 +476,16 @@ def _remote_sdk(ctx, urls, strip_prefix, sha256):
},
auth = auth,
)
else:
elif (urls[0].endswith(".zip") and
host_goos != "darwin"):
ctx.download_and_extract(
url = urls,
stripPrefix = strip_prefix,
sha256 = sha256,
auth = auth,
)
else:
fail("No supported workaround for extracting Go SDK non-ASCII filenames. Bazel 6.4.0+ has correct support for unpacking the Go SDK. {}".format(urls[0]))

def _local_sdk(ctx, path):
for entry in ctx.path(path).readdir():
Expand Down