fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreAddressed some new buildifier defects (#1132)c134a458

0.6.0
1.2 KiB44 linesraw
1"""Test transitions to test extra_exec_rustc_flags."""
2
3def _extra_exec_rustc_flags_transition_impl(_settings, attr):
4    return {
5        "//:extra_exec_rustc_flags": attr.extra_exec_rustc_flags,
6    }
7
8_extra_exec_rustc_flags_transition = transition(
9    implementation = _extra_exec_rustc_flags_transition_impl,
10    inputs = [],
11    outputs = ["//:extra_exec_rustc_flags"],
12)
13
14def _with_extra_exec_rustc_flags_cfg_impl(ctx):
15    return [DefaultInfo(files = depset(ctx.files.srcs))]
16
17with_extra_exec_rustc_flags_cfg = rule(
18    implementation = _with_extra_exec_rustc_flags_cfg_impl,
19    attrs = {
20        "extra_exec_rustc_flags": attr.string_list(
21            mandatory = True,
22        ),
23        "srcs": attr.label_list(
24            allow_files = True,
25            cfg = _extra_exec_rustc_flags_transition,
26        ),
27        "_allowlist_function_transition": attr.label(
28            default = Label("//tools/allowlists/function_transition_allowlist"),
29        ),
30    },
31)
32
33def _with_exec_cfg_impl(ctx):
34    return [DefaultInfo(files = depset(ctx.files.srcs))]
35
36with_exec_cfg = rule(
37    implementation = _with_exec_cfg_impl,
38    attrs = {
39        "srcs": attr.label_list(
40            allow_files = True,
41            cfg = "exec",
42        ),
43    },
44)