fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
4e593b6c
main
1load ( "@bazel_skylib//rules:write_file.bzl" , "write_file" ) 2load ( "//cargo:defs.bzl" , "cargo_build_script" ) 3load ( "//rust:defs.bzl" , "rust_test" ) 4 5# Test that tools are built in the exec configuration. 6cargo_build_script ( 7name = "tools_exec_build_rs" , 8srcs = [ "build.rs" ], 9build_script_env = { 10# Note that cargo_build_script working directories are not 11# guaranteed to be the execroot. Thus, the expanded value 12# is resolved to an absolute path with the help of it's 13# process wrapper resolving `${pwd}`. 14"EXPANDED_TOOLCHAIN_VAR" : "$${pwd}/$(RUSTC)" , 15"TOOL" : "$(execpath :tool)" , 16}, 17edition = "2018" , 18links = "beep" , 19# Add a flag to test that they're exposed to the build script 20rustc_flags = [ "--cfg=foo=\"bar\"" ], 21toolchains = [ "//rust/toolchain:current_rust_toolchain" ], 22tools = [ ":tool" ], 23) 24 25write_file ( 26name = "tool" , 27out = "tool-file" , 28content = [ "" ], 29) 30 31rust_test ( 32name = "tools_exec" , 33srcs = [ "tools_exec.rs" ], 34edition = "2018" , 35deps = [ ":tools_exec_build_rs" ], 36)