1load("@bazel_skylib//rules:build_test.bzl", "build_test") 2load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_doc") 3 4package(default_visibility = ["//visibility:public"]) 5 6rust_binary( 7 name = "hello_world_transient", 8 srcs = ["src/main.rs"], 9 deps = [ 10 "@crates//:anyhow", 11 ], 12) 13 14rust_binary( 15 name = "hello_world_vendored", 16 srcs = ["src/main.rs"], 17 deps = [ 18 "//third-party/crates:anyhow", 19 ], 20) 21 22[ 23 rust_doc( 24 name = "hello_world_{}_doc".format(target), 25 crate = ":hello_world_{}".format(target), 26 ) 27 for target in [ 28 "transient", 29 "vendored", 30 ] 31] 32 33[ 34 sh_test( 35 name = "hello_world_{}_test".format(target), 36 srcs = ["hello_world_test.sh"], 37 args = [ 38 "$(rlocationpath :hello_world_{})".format(target), 39 ], 40 data = [ 41 ":hello_world_{}".format(target), 42 ], 43 deps = [ 44 "@bazel_tools//tools/bash/runfiles", 45 ], 46 ) 47 for target in [ 48 "transient", 49 "vendored", 50 ] 51] 52 53build_test( 54 name = "gen_rust_project", 55 targets = [ 56 "@rules_rust//tools/rust_analyzer:gen_rust_project", 57 ], 58) 59 60build_test( 61 name = "rust_fmt", 62 targets = [ 63 "@rules_rust//:rustfmt", 64 ], 65) 66