Replace execution_requirements with the standardized field "tags".

PiperOrigin-RevId: 657777523
Change-Id: If803f20aebba7126b70bcc9c483b9d03989104bc
This commit is contained in:
Googler 2024-07-30 16:56:33 -07:00 committed by Copybara-Service
parent f97190f039
commit dde7ad4094
2 changed files with 6 additions and 11 deletions

View File

@ -33,7 +33,7 @@ def _cc_tool_impl(ctx):
label = ctx.label, label = ctx.label,
exe = exe, exe = exe,
runfiles = runfiles, runfiles = runfiles,
execution_requirements = tuple(ctx.attr.execution_requirements), execution_requirements = tuple(ctx.attr.tags),
) )
link = ctx.actions.declare_file(ctx.label.name) link = ctx.actions.declare_file(ctx.label.name)
@ -70,9 +70,6 @@ executable label.
allow_files = True, allow_files = True,
doc = "Additional files that are required for this tool to run.", 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], provides = [ToolInfo],
doc = """Declares a tool that can be bound to action configs. doc = """Declares a tool that can be bound to action configs.
@ -87,6 +84,7 @@ cc_tool(
executable = "@llvm_toolchain//:bin/clang", executable = "@llvm_toolchain//:bin/clang",
# Suppose clang needs libc to run. # Suppose clang needs libc to run.
data = ["@llvm_toolchain//:lib/x86_64-linux-gnu/libc.so.6"] data = ["@llvm_toolchain//:lib/x86_64-linux-gnu/libc.so.6"]
tags = ["requires-network"],
) )
``` ```
""", """,

View File

@ -1,19 +1,16 @@
load("@rules_testing//lib:util.bzl", "util")
load("//cc/toolchains:directory_tool.bzl", "cc_directory_tool") load("//cc/toolchains:directory_tool.bzl", "cc_directory_tool")
load("//cc/toolchains:tool.bzl", "cc_tool") load("//cc/toolchains:tool.bzl", "cc_tool")
load("//tests/rule_based_toolchain:analysis_test_suite.bzl", "analysis_test_suite") load("//tests/rule_based_toolchain:analysis_test_suite.bzl", "analysis_test_suite")
load(":tool_test.bzl", "TARGETS", "TESTS") load(":tool_test.bzl", "TARGETS", "TESTS")
util.helper_target( cc_tool(
cc_tool,
name = "tool", name = "tool",
src = "//tests/rule_based_toolchain/testdata:bin_wrapper.sh", src = "//tests/rule_based_toolchain/testdata:bin_wrapper.sh",
data = ["//tests/rule_based_toolchain/testdata:bin"], data = ["//tests/rule_based_toolchain/testdata:bin"],
execution_requirements = ["requires-network"], tags = ["requires-network"],
) )
util.helper_target( cc_tool(
cc_tool,
name = "wrapped_tool", name = "wrapped_tool",
src = "//tests/rule_based_toolchain/testdata:bin_wrapper", src = "//tests/rule_based_toolchain/testdata:bin_wrapper",
visibility = ["//tests/rule_based_toolchain:__subpackages__"], visibility = ["//tests/rule_based_toolchain:__subpackages__"],
@ -24,7 +21,7 @@ cc_directory_tool(
data = ["bin"], data = ["bin"],
directory = "//tests/rule_based_toolchain/testdata:directory", directory = "//tests/rule_based_toolchain/testdata:directory",
executable = "bin_wrapper.sh", executable = "bin_wrapper.sh",
execution_requirements = ["requires-network"], tags = ["requires-network"],
) )
analysis_test_suite( analysis_test_suite(