mirror of https://github.com/bazelbuild/rules_rust
Minor cleanup (#2357)
This commit is contained in:
parent
48d32a0c0f
commit
500c8bd478
|
@ -963,7 +963,9 @@ rust_proc_macro = rule(
|
|||
# https://docs.bazel.build/versions/main/skylark/config.html#user-defined-transitions.
|
||||
attrs = dict(
|
||||
_common_attrs.items(),
|
||||
_allowlist_function_transition = attr.label(default = Label("//tools/allowlists/function_transition_allowlist")),
|
||||
_allowlist_function_transition = attr.label(
|
||||
default = Label("//tools/allowlists/function_transition_allowlist"),
|
||||
),
|
||||
deps = attr.label_list(
|
||||
doc = dedent("""\
|
||||
List of other libraries to be linked to this library target.
|
||||
|
|
|
@ -36,8 +36,13 @@ def _use_cc_common_link_on_target_impl(ctx):
|
|||
use_cc_common_link_on_target = rule(
|
||||
implementation = _use_cc_common_link_on_target_impl,
|
||||
attrs = {
|
||||
"target": attr.label(cfg = use_cc_common_link_transition, aspects = [collect_dep_actions_aspect]),
|
||||
"_allowlist_function_transition": attr.label(default = "@bazel_tools//tools/allowlists/function_transition_allowlist"),
|
||||
"target": attr.label(
|
||||
cfg = use_cc_common_link_transition,
|
||||
aspects = [collect_dep_actions_aspect],
|
||||
),
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = Label("@bazel_tools//tools/allowlists/function_transition_allowlist"),
|
||||
),
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -6,21 +6,21 @@ load("//rust/private:providers.bzl", "BuildInfo", "CrateInfo", "DepInfo", "DepVa
|
|||
# buildifier: disable=bzl-visibility
|
||||
load("//rust/private:rustc.bzl", "rustc_compile_action")
|
||||
|
||||
def _generator_impl(ctx):
|
||||
rs_file = ctx.actions.declare_file(ctx.label.name + "_generated.rs")
|
||||
ctx.actions.run_shell(
|
||||
outputs = [rs_file],
|
||||
command = """cat <<EOF > {}
|
||||
_TEMPLATE = """\
|
||||
use direct::direct_fn;
|
||||
use transitive::transitive_fn;
|
||||
|
||||
pub fn call_both() {}
|
||||
pub fn call_both() {
|
||||
direct_fn();
|
||||
transitive_fn();
|
||||
{}
|
||||
EOF
|
||||
""".format(rs_file.path, "{", "}"),
|
||||
mnemonic = "WriteRsFile",
|
||||
}
|
||||
"""
|
||||
|
||||
def _generator_impl(ctx):
|
||||
rs_file = ctx.actions.declare_file(ctx.label.name + "_generated.rs")
|
||||
ctx.actions.write(
|
||||
output = rs_file,
|
||||
content = _TEMPLATE,
|
||||
)
|
||||
|
||||
toolchain = ctx.toolchains[Label("//rust:toolchain_type")]
|
||||
|
@ -72,7 +72,10 @@ EOF
|
|||
generator = rule(
|
||||
implementation = _generator_impl,
|
||||
attrs = {
|
||||
"deps": attr.label_list(),
|
||||
"deps": attr.label_list(
|
||||
doc = "List of other libraries to be linked to this library target.",
|
||||
providers = [CrateInfo],
|
||||
),
|
||||
"_cc_toolchain": attr.label(
|
||||
default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue