fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
16175c88
0.7.0
1# Executable targets will output a pattern similar to the following 2# cargo 1.53.0 (4369396ce 2021-04-27) 3# Also Note, rustc_srcs is too big for this test 4_FILES = { 5"cargo" : ( "--executable" , r"^cargo [0-9\.]\+ ([0-9a-z]\+ [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\})" ), 6"clippy" : ( "--executable" , r"^clippy [0-9\.]\+ ([0-9a-z]\+ [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\})" ), 7"rust_stdlib" : ( "--files" , r"\.rlib" ), 8"rustc" : ( "--executable" , r"^rustc [0-9\.]\+ ([0-9a-z]\+ [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\})" ), 9"rustc_lib" : ( "--files" , r"rustc_driver" ), 10"rustdoc" : ( "--executable" , r"^rustdoc [0-9\.]\+ ([0-9a-z]\+ [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\})" ), 11"rustfmt" : ( "--executable" , r"^rustfmt [0-9\.]\+\-stable ([0-9a-z]\+ [0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\})" ), 12} 13 14# Generate a list manifest for all files in the filegroup 15[ 16genrule ( 17name = "{}_manifest_genrule" . format ( files ), 18srcs = [ "//rust/toolchain:current_{}_files" . format ( files )], 19outs = [ "{}_manifest" . format ( files )], 20cmd = "for file in $(rootpaths //rust/toolchain:current_{}_files); do echo $$file >> $@; done" . format ( files ), 21) 22for files in _FILES 23if "--files" in _FILES [ files ] 24] 25 26# Test that all toolchain tools are executable targets 27[ 28sh_test ( 29name = tool + "_test" , 30srcs = [ "current_exec_files_test.sh" ], 31args = [ 32"$(rootpath //rust/toolchain:current_{}_files)" . format ( tool ) if "--executable" == arg else "$(rootpath {}_manifest)" . format ( tool ), 33arg , 34"'{}'" . format ( pattern ), 35], 36data = [ 37"//rust/toolchain:current_{}_files" . format ( tool ), 38] + ( 39[ "{}_manifest" . format ( tool )] if "--files" == arg else [] 40), 41) 42for tool , ( arg , pattern ) in _FILES . items () 43]