From 752270cf2f52a7047faeed7a9849113d2f8998e7 Mon Sep 17 00:00:00 2001 From: Vladimir Moskva Date: Mon, 8 Feb 2021 13:50:02 +0100 Subject: [PATCH] Release binaries for linux-arm64 architecture (#957) --- buildifier/BUILD.bazel | 10 ++++++++++ buildifier/npm/BUILD.bazel | 3 ++- buildozer/BUILD.bazel | 10 ++++++++++ buildozer/npm/BUILD.bazel | 3 ++- release/github.sh | 2 ++ unused_deps/BUILD.bazel | 10 ++++++++++ 6 files changed, 36 insertions(+), 2 deletions(-) diff --git a/buildifier/BUILD.bazel b/buildifier/BUILD.bazel index 3b6e057aa..d6e037d94 100644 --- a/buildifier/BUILD.bazel +++ b/buildifier/BUILD.bazel @@ -36,6 +36,16 @@ go_binary( visibility = ["//visibility:public"], ) +go_binary( + name = "buildifier-linux-arm64", + out = "buildifier-linux_arm64", + embed = [":go_default_library"], + goarch = "arm64", + goos = "linux", + pure = "on", + visibility = ["//visibility:public"], +) + # Test that the buildifier binary works sh_test( name = "buildifier_integration_test", diff --git a/buildifier/npm/BUILD.bazel b/buildifier/npm/BUILD.bazel index 0268798bf..9b130da9e 100644 --- a/buildifier/npm/BUILD.bazel +++ b/buildifier/npm/BUILD.bazel @@ -22,6 +22,7 @@ _PARENT_PACKAGE_FILES = [ "README.md", "buildifier-darwin_amd64", "buildifier-linux_amd64", + "buildifier-linux_arm64", "buildifier-windows_amd64.exe", ] @@ -31,7 +32,7 @@ _PARENT_PACKAGE_FILES = [ # go_binary doesn't give a predeclared output for # the file in "out" so we have to construct a # label to reference the go_binary rule itself. - src = "//buildifier:%s" % s.split("_")[0], + src = "//buildifier:%s" % s.replace("_arm64", "-arm64").split("_amd64")[0], out = s, ) for s in _PARENT_PACKAGE_FILES diff --git a/buildozer/BUILD.bazel b/buildozer/BUILD.bazel index 0586a469b..7cb588a8a 100644 --- a/buildozer/BUILD.bazel +++ b/buildozer/BUILD.bazel @@ -66,6 +66,16 @@ go_binary( visibility = ["//visibility:public"], ) +go_binary( + name = "buildozer-linux-arm64", + out = "buildozer-linux_arm64", + embed = [":go_default_library"], + goarch = "arm64", + goos = "linux", + pure = "on", + visibility = ["//visibility:public"], +) + exports_files( [ "README.md", diff --git a/buildozer/npm/BUILD.bazel b/buildozer/npm/BUILD.bazel index 5d2205a3c..b18eb5d15 100644 --- a/buildozer/npm/BUILD.bazel +++ b/buildozer/npm/BUILD.bazel @@ -42,6 +42,7 @@ _PARENT_PACKAGE_FILES = [ "README.md", "buildozer-darwin_amd64", "buildozer-linux_amd64", + "buildozer-linux_arm64", "buildozer-windows_amd64.exe", ] @@ -51,7 +52,7 @@ _PARENT_PACKAGE_FILES = [ # go_binary doesn't give a predeclared output for # the file in "out" so we have to construct a # label to reference the go_binary rule itself. - src = "//buildozer:%s" % s.split("_")[0], + src = "//buildozer:%s" % s.replace("_arm64", "-arm64").split("_amd64")[0], out = s, ) for s in _PARENT_PACKAGE_FILES diff --git a/release/github.sh b/release/github.sh index 1c42eb7a1..917b79694 100755 --- a/release/github.sh +++ b/release/github.sh @@ -22,6 +22,7 @@ bazel build --config=release //buildifier:all //buildozer:all //unused_deps:all for tool in "buildifier" "buildozer" "unused_deps"; do cp bazel-out/*-opt-*/bin/"$tool/$tool-linux_amd64" $BIN_DIR + cp bazel-out/*-opt-*/bin/"$tool/$tool-linux_arm64" $BIN_DIR cp bazel-out/*-opt-*/bin/"$tool/$tool-darwin_amd64" $BIN_DIR cp bazel-out/*-opt-*/bin/"$tool/$tool-windows_amd64.exe" $BIN_DIR done; @@ -40,6 +41,7 @@ upload_file() { for tool in "buildifier" "buildozer" "unused_deps"; do upload_file "$BIN_DIR/$tool-linux_amd64" "$tool-linux-amd64" + upload_file "$BIN_DIR/$tool-linux_arm64" "$tool-linux-arm64" upload_file "$BIN_DIR/$tool-darwin_amd64" "$tool-darwin-amd64" upload_file "$BIN_DIR/$tool-windows_amd64.exe" "$tool-windows-amd64.exe" done diff --git a/unused_deps/BUILD.bazel b/unused_deps/BUILD.bazel index 14dccff0f..5544efb71 100644 --- a/unused_deps/BUILD.bazel +++ b/unused_deps/BUILD.bazel @@ -59,6 +59,16 @@ go_binary( visibility = ["//visibility:public"], ) +go_binary( + name = "unused_deps-linux-arm64", + out = "unused_deps-linux_arm64", + embed = [":go_default_library"], + goarch = "arm64", + goos = "linux", + pure = "on", + visibility = ["//visibility:public"], +) + go_test( name = "jar_manifest_test", size = "small",