From 7b673547a3b51febb4e67642bf0cc30c3ba09453 Mon Sep 17 00:00:00 2001 From: Mike Lundy Date: Fri, 25 Aug 2023 15:23:56 -0700 Subject: [PATCH] Fix multiple-definition error on windows_config_setting (#1084) --- foreign_cc/utils.bzl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/foreign_cc/utils.bzl b/foreign_cc/utils.bzl index 2e87e9418..2af555198 100644 --- a/foreign_cc/utils.bzl +++ b/foreign_cc/utils.bzl @@ -22,9 +22,11 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False, tags = kwargs.pop("tags", []) + config_setting_name = name + "_windows_config_setting" + # filegroups cannot select on constraint_values in before Bazel 5.1. Add this config_setting as a workaround. See https://github.com/bazelbuild/bazel/issues/13047 native.config_setting( - name = "windows_config_setting", + name = config_setting_name, constraint_values = [ "@platforms//os:windows", ], @@ -35,7 +37,7 @@ def runnable_binary(name, binary, foreign_cc_target, match_binary_name = False, srcs = [foreign_cc_target], tags = tags + ["manual"], output_group = select({ - ":windows_config_setting": binary + ".exe", + ":" + config_setting_name: binary + ".exe", "//conditions:default": binary, }), )