Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace uses of cfg = "host" with cfg = "exec" #15785

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions site/en/docs/creating-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,13 @@ level of the build, this might be the attribute definition:
"worker": attr.label(
default = Label("//work:worker"),
executable = True,
cfg = "host",
cfg = "exec",
)
```

`cfg = "host"` indicates that the worker should be built to run on your host
platform.
`cfg = "exec"` indicates that the worker should be built to run on your
execution platform rather than on the target platform (i.e., the worker is used
as tool during the build).

### Work action requirements {:#work-action-requirements}

Expand Down
2 changes: 1 addition & 1 deletion site/en/rules/aspects.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ demonstrates how you could pass in a tool to an aspect:
'_protoc' : attr.label(
default = Label('//tools:protoc'),
executable = True,
cfg = "host"
cfg = "exec"
)
}
...
Expand Down
2 changes: 1 addition & 1 deletion src/embedded_tools.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ embedded_tools = rule(
"out": attr.output(mandatory = True),
"tool": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
allow_files = True,
default = Label("//src:create_embedded_tools_sh"),
),
Expand Down
2 changes: 1 addition & 1 deletion src/main/res/winsdk_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ windows_resource_compiler_toolchain = rule(
"rc_exe": attr.label(
allow_files = True,
executable = True,
cfg = "host",
cfg = "exec",
doc = "Label of the resource compiler (or a wrapper script)",
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies here.
"Xwatchconversion": attr.bool(default = False, doc = "Don't delete temporary lexers generated from combined grammars."),
"_tool": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
),
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ A list of dependencies.
doc = "The location of the tool to use.",
allow_files = True,
default = Label("//foo/bar/baz:target"),
cfg = "host",
cfg = "exec",
executable = True,
),
"out": attr.output(
Expand Down
2 changes: 1 addition & 1 deletion src/test/py/bazel/bazel_windows_cpp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def testCcCompileWithTreeArtifactAsSource(self):
' attrs = {',
' "_tool": attr.label(',
' executable = True,',
' cfg = "host",',
' cfg = "exec",',
' allow_files = True,',
' default = Label("//:genccs"),',
' )',
Expand Down
2 changes: 1 addition & 1 deletion src/test/py/bazel/bazel_windows_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def testRunPowershellInAction(self):
' "out": attr.output(mandatory = True),',
' "tool": attr.label(',
' executable = True,',
' cfg = "host",',
' cfg = "exec",',
' allow_files = True,',
' default = Label("//:write.bat"),',
' ),',
Expand Down
2 changes: 1 addition & 1 deletion src/test/py/bazel/native_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ exe_test = rule(
attrs = {
"src": attr.label(
allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
),
},
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/bazel/apple/apple_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ starlark_apple_binary = rule(
),
),
"_xcrunwrapper": attr.label(
cfg = "host",
cfg = "exec",
default = Label("@bazel_tools//tools/objc:xcrunwrapper"),
executable = True,
),
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/bazel/bazel_rules_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ out_rule = rule(_out_rule, attrs = {
"_hello_bin": attr.label(
default = ":hello_bin",
executable = True,
cfg = "host",
cfg = "exec",
),
})
EOF
Expand Down
4 changes: 2 additions & 2 deletions src/test/shell/bazel/cc_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,11 @@ def _tree_art_impl(ctx):
tree_art_rule = rule(implementation = _tree_art_impl,
attrs = {
"_makes_tree" : attr.label(allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//${package}:makes_tree_artifacts.sh"),
"_write" : attr.label(allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//${package}:write.sh")})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ test_rule = rule(
attrs = {
"inputs": attr.label_list(allow_files = True),
"out": attr.output(),
"_executable": attr.label(executable = True, cfg = "host", default = "//:exe"),
"_executable": attr.label(executable = True, cfg = "exec", default = "//:exe"),
},
)
EOF
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/bazel/starlark_rule_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def _impl(ctx):
foo = rule(
implementation = _impl,
attrs = {
"tool": attr.label(allow_single_file = True, executable = True, cfg = "host"),
"tool": attr.label(allow_single_file = True, executable = True, cfg = "exec"),
"out": attr.output(mandatory = True),
},
)
Expand Down
10 changes: 5 additions & 5 deletions src/test/shell/integration/action_aspect_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def _actions_test_impl(target, ctx):
tree_art_rule = rule(implementation = _tree_art_impl,
attrs = {
"_makes_tree" : attr.label(allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//package:makes_tree_artifacts.sh"),
"_write" : attr.label(allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//package:write.sh")})

Expand Down Expand Up @@ -200,11 +200,11 @@ def _actions_test_impl(target, ctx):
tree_art_rule = rule(implementation = _tree_art_impl,
attrs = {
"_makes_tree" : attr.label(allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//package:makes_tree_artifacts.sh"),
"_write" : attr.label(allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//package:write.sh")})

Expand Down Expand Up @@ -382,7 +382,7 @@ aspect_b = aspect(
attrs = {
"_write": attr.label(
allow_single_file = True,
cfg = "host",
cfg = "exec",
executable = True,
default = "//${package}:write.sh")
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/integration/py_args_escaping_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _impl(ctx):
run_host_configured = rule(
implementation = _impl,
attrs = {
"tool": attr.label(executable = True, cfg = "host"),
"tool": attr.label(executable = True, cfg = "exec"),
"out": attr.output(),
},
)
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/integration/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def _tool_impl(ctx):
arguments = [f.path]
)
return DefaultInfo(files = depset([f]))
my_tool_rule = rule(_tool_impl, attrs = { 'tool' : attr.label(executable = True, cfg = "host") })
my_tool_rule = rule(_tool_impl, attrs = { 'tool' : attr.label(executable = True, cfg = "exec") })
EOF

cat > a/BUILD <<EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _impl(ctx):
build_rule = rule(
attrs = {
"inputs": attr.label(),
"executable": attr.label(executable = True, cfg = "host"),
"executable": attr.label(executable = True, cfg = "exec"),
"out": attr.output(),
},
implementation = _impl,
Expand Down
4 changes: 2 additions & 2 deletions src/test/shell/integration/validation_actions_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ rule_with_implicit_outs_and_validation = rule(
allow_single_file = True,
default = Label("//validation_actions:validation_tool"),
executable = True,
cfg = "host"),
cfg = "exec"),
}
)

Expand All @@ -103,7 +103,7 @@ rule_with_implicit_and_host_deps = rule(
"host_dep": attr.label(
allow_single_file = True,
default = Label("//validation_actions:some_host_dep"),
cfg = "host"),
cfg = "exec"),
}
)
EOF
Expand Down
2 changes: 1 addition & 1 deletion tools/build_defs/hash/hash.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def sha256(ctx, artifact, execution_requirements = None):
tools = {
"sha256": attr.label(
default = Label("//tools/build_defs/hash:sha256"),
cfg = "host",
cfg = "exec",
executable = True,
allow_files = True,
),
Expand Down
2 changes: 1 addition & 1 deletion tools/build_defs/pkg/pkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ _real_pkg_tar = rule(
# Implicit dependencies.
"build_tar": attr.label(
default = Label("//tools/build_defs/pkg:build_tar"),
cfg = "host",
cfg = "exec",
executable = True,
allow_files = True,
),
Expand Down
4 changes: 2 additions & 2 deletions tools/ctexplain/lib_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def testAnalyzeBuild(self):
' pass',
'rule_with_host_dep = rule(',
' implementation = _impl,',
' attrs = { "host_deps": attr.label_list(cfg = "host") })',
' attrs = { "host_deps": attr.label_list(cfg = "exec") })',
])
self.ScratchFile('testapp/BUILD', [
'load("//testapp:defs.bzl", "rule_with_host_dep")',
Expand All @@ -66,7 +66,7 @@ def testAnalyzeBuildNoRepeats(self):
' pass',
'rule_with_host_dep = rule(',
' implementation = _impl,',
' attrs = { "host_deps": attr.label_list(cfg = "host") })',
' attrs = { "host_deps": attr.label_list(cfg = "exec") })',
])
self.ScratchFile('testapp/BUILD', [
'load("//testapp:defs.bzl", "rule_with_host_dep")',
Expand Down
2 changes: 1 addition & 1 deletion tools/jdk/java_toolchain_alias.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ java_host_runtime_alias = rule(
java_common.JavaRuntimeInfo,
platform_common.TemplateVariableInfo,
],
cfg = "host",
cfg = "exec",
),
},
provides = [
Expand Down