From dde7ad40949cdd09c127320544a0fd84d849feae Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 30 Jul 2024 16:56:33 -0700 Subject: [PATCH] Replace execution_requirements with the standardized field "tags". PiperOrigin-RevId: 657777523 Change-Id: If803f20aebba7126b70bcc9c483b9d03989104bc --- cc/toolchains/tool.bzl | 6 ++---- tests/rule_based_toolchain/tool/BUILD | 11 ++++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/cc/toolchains/tool.bzl b/cc/toolchains/tool.bzl index 9a9792f..f07af32 100644 --- a/cc/toolchains/tool.bzl +++ b/cc/toolchains/tool.bzl @@ -33,7 +33,7 @@ def _cc_tool_impl(ctx): label = ctx.label, exe = exe, runfiles = runfiles, - execution_requirements = tuple(ctx.attr.execution_requirements), + execution_requirements = tuple(ctx.attr.tags), ) link = ctx.actions.declare_file(ctx.label.name) @@ -70,9 +70,6 @@ executable label. allow_files = True, doc = "Additional files that are required for this tool to run.", ), - "execution_requirements": attr.string_list( - doc = "A list of strings that provide hints for execution environment compatibility (e.g. `requires-network`).", - ), }, provides = [ToolInfo], doc = """Declares a tool that can be bound to action configs. @@ -87,6 +84,7 @@ cc_tool( executable = "@llvm_toolchain//:bin/clang", # Suppose clang needs libc to run. data = ["@llvm_toolchain//:lib/x86_64-linux-gnu/libc.so.6"] + tags = ["requires-network"], ) ``` """, diff --git a/tests/rule_based_toolchain/tool/BUILD b/tests/rule_based_toolchain/tool/BUILD index d9574e8..2d58852 100644 --- a/tests/rule_based_toolchain/tool/BUILD +++ b/tests/rule_based_toolchain/tool/BUILD @@ -1,19 +1,16 @@ -load("@rules_testing//lib:util.bzl", "util") load("//cc/toolchains:directory_tool.bzl", "cc_directory_tool") load("//cc/toolchains:tool.bzl", "cc_tool") load("//tests/rule_based_toolchain:analysis_test_suite.bzl", "analysis_test_suite") load(":tool_test.bzl", "TARGETS", "TESTS") -util.helper_target( - cc_tool, +cc_tool( name = "tool", src = "//tests/rule_based_toolchain/testdata:bin_wrapper.sh", data = ["//tests/rule_based_toolchain/testdata:bin"], - execution_requirements = ["requires-network"], + tags = ["requires-network"], ) -util.helper_target( - cc_tool, +cc_tool( name = "wrapped_tool", src = "//tests/rule_based_toolchain/testdata:bin_wrapper", visibility = ["//tests/rule_based_toolchain:__subpackages__"], @@ -24,7 +21,7 @@ cc_directory_tool( data = ["bin"], directory = "//tests/rule_based_toolchain/testdata:directory", executable = "bin_wrapper.sh", - execution_requirements = ["requires-network"], + tags = ["requires-network"], ) analysis_test_suite(