Skip to content

Commit

Permalink
Replace execution_requirements with the standardized field "tags".
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 657777523
Change-Id: If803f20aebba7126b70bcc9c483b9d03989104bc
  • Loading branch information
matts1 authored and copybara-github committed Jul 30, 2024
1 parent f97190f commit dde7ad4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
6 changes: 2 additions & 4 deletions cc/toolchains/tool.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand All @@ -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"],
)
```
""",
Expand Down
11 changes: 4 additions & 7 deletions tests/rule_based_toolchain/tool/BUILD
Original file line number Diff line number Diff line change
@@ -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__"],
Expand All @@ -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(
Expand Down

0 comments on commit dde7ad4

Please sign in to comment.