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

[WIP] add bazelisk support for windows-arm64 #302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ go_binary(
visibility = ["//visibility:public"],
)

go_binary(
name = "bazelisk-windows-arm64",
out = "bazelisk-windows_arm64.exe",
embed = [":go_default_library"],
goarch = "arm64",
goos = "windows",
pure = "on",
visibility = ["//visibility:public"],
)

genrule(
name = "bazelisk-darwin-amd64-for-npm",
srcs = [":bazelisk-darwin-amd64"],
Expand Down Expand Up @@ -191,6 +201,14 @@ genrule(
output_to_bindir = 1,
)

genrule(
name = "bazelisk-windows-arm64-for-npm",
srcs = [":bazelisk-windows-arm64"],
outs = ["bazelisk-windows_arm64.exe"],
cmd = "cp $(location :bazelisk-windows-arm64) \"$@\"",
output_to_bindir = 1,
)

pkg_npm(
name = "npm_package",
srcs = [
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ go_repository(

go_rules_dependencies()

go_register_toolchains(version = "1.16.4")
go_register_toolchains(version = "1.17.1")

gazelle_dependencies()

Expand Down
6 changes: 4 additions & 2 deletions bazelisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def determine_executable_filename_suffix():

def determine_bazel_filename(version):
machine = normalized_machine_arch_name()
if machine != "x86_64":
if machine not in ["x86_64", "arm64"]:
raise Exception(
'Unsupported machine architecture "{}". Bazel currently only supports x86_64.'.format(
'Unsupported machine architecture "{}". Bazel currently only supports x86_64 and arm64.'.format(
machine
)
)
Expand All @@ -227,6 +227,8 @@ def normalized_machine_arch_name():
machine = platform.machine().lower()
if machine == "amd64":
machine = "x86_64"
elif machine == "ARM64":
machine = "arm64"
return machine


Expand Down
7 changes: 6 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ go build
//:bazelisk-darwin-universal \
//:bazelisk-linux-amd64 \
//:bazelisk-linux-arm64 \
//:bazelisk-windows-amd64
//:bazelisk-windows-amd64 \
//:bazelisk-windows-arm64

echo

cp bazel-out/*-opt-*/bin/bazelisk-darwin_amd64 bin/bazelisk-darwin-amd64
Expand All @@ -36,6 +38,8 @@ cp bazel-out/*-opt/bin/bazelisk-darwin_universal bin/bazelisk-darwin
cp bazel-out/*-opt-*/bin/bazelisk-linux_amd64 bin/bazelisk-linux-amd64
cp bazel-out/*-opt-*/bin/bazelisk-linux_arm64 bin/bazelisk-linux-arm64
cp bazel-out/*-opt-*/bin/bazelisk-windows_amd64.exe bin/bazelisk-windows-amd64.exe
cp bazel-out/*-opt-*/bin/bazelisk-windows_arm64.exe bin/bazelisk-windows-arm64.exe

rm -f bazelisk

### Build release artifacts using `go build`.
Expand All @@ -45,6 +49,7 @@ rm -f bazelisk
# GOOS=darwin GOARCH=arm64 go build -o bin/bazelisk-darwin-arm64
# lipo -create -output bin/bazelisk-darwin bin/bazelisk-darwin-amd64 bin/bazelisk-darwin-arm64
# GOOS=windows GOARCH=amd64 go build -o bin/bazelisk-windows-amd64.exe
# GOOS=windows GOARCH=arm64 go build -o bin/bazelisk-windows-arm64.exe

### Print some information about the generated binaries.
echo "== Bazelisk binaries are ready =="
Expand Down