fork/rules_rust

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

Peter Kollochupstream wrappers for cargo, rustc, cargo-clippy (#2703)c1ab10aa

cleanup
1.0 KiB33 linesraw
1load("//rust:defs.bzl", "rust_binary")
2
3tools = {
4    "cargo": "//rust/toolchain:current_cargo_files",
5    "cargo_clippy": "//rust/toolchain:current_cargo_clippy_files",
6    "rustc": "//rust/toolchain:current_rustc_files",
7    "rustfmt": "//rust/toolchain:current_rustfmt_toolchain_for_target",
8}
9
10all_tools = [target for target in tools.values()]
11
12[
13    rust_binary(
14        name = tool_name,
15        srcs = [
16            "src/main.rs",
17        ],
18        # Cargo calls out to the other tools.
19        # Make sure that they are included in the runfiles.
20        data = all_tools if tool_name == "cargo" else [target],
21        edition = "2018",
22        rustc_env = {
23            "WRAPPED_TOOL_NAME": tool_name,
24            "WRAPPED_TOOL_TARGET": "$(rlocationpath {})".format(target),
25        },
26        toolchains = ["@rules_rust//rust/toolchain:current_rust_toolchain"],
27        visibility = ["//visibility:public"],
28        deps = [
29            "//tools/runfiles",
30        ],
31    )
32    for (tool_name, target) in tools.items()
33]