fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
c1ab10aa
cleanup
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[ 13rust_binary ( 14name = tool_name , 15srcs = [ 16"src/main.rs" , 17], 18# Cargo calls out to the other tools. 19# Make sure that they are included in the runfiles. 20data = all_tools if tool_name == "cargo" else [ target ], 21edition = "2018" , 22rustc_env = { 23"WRAPPED_TOOL_NAME" : tool_name , 24"WRAPPED_TOOL_TARGET" : "$(rlocationpath {})" . format ( target ), 25}, 26toolchains = [ "@rules_rust//rust/toolchain:current_rust_toolchain" ], 27visibility = [ "//visibility:public" ], 28deps = [ 29"//tools/runfiles" , 30], 31) 32for ( tool_name , target ) in tools . items () 33]