From 5476b46af3da5e3727f1aeaf49bb1daaa17c9585 Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Tue, 7 Mar 2023 19:03:16 +0000 Subject: [PATCH] Condition executable name on build system --- build_defs/BUILD.bazel | 8 ++++++++ pkg/BUILD.bazel | 14 +++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/build_defs/BUILD.bazel b/build_defs/BUILD.bazel index 023d4cb089..0a45eae504 100644 --- a/build_defs/BUILD.bazel +++ b/build_defs/BUILD.bazel @@ -84,6 +84,14 @@ config_setting( }, ) +selects.config_setting_group( + name = "config_win", + match_any = [ + ":config_win32", + ":config_win64", + ] +) + config_setting( name = "config_osx_aarch64", values = {"cpu": "osx-aarch_64"}, diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel index da5ccf6a5e..4edda57b43 100644 --- a/pkg/BUILD.bazel +++ b/pkg/BUILD.bazel @@ -62,11 +62,23 @@ genrule( srcs = ["//:protoc_static"], outs = ["bin/protoc"], cmd = "cp $< $@", + tags = ["manual"], +) + +genrule( + name = "rename_protoc_exe", + srcs = ["//:protoc_static"], + outs = ["bin/protoc.exe"], + cmd = "cp $< $@", + tags = ["manual"], ) pkg_files( name = "protoc_files", - srcs = ["bin/protoc"], + srcs = select({ + "//build_defs:config_win": ["bin/protoc.exe"], + "//conditions:default": ["bin/protoc"], + }), attributes = pkg_attributes(mode = "0555"), prefix = "bin/", visibility = ["//visibility:private"],