load("@bazel_skylib//rules:write_file.bzl", "write_file") load("//rust:defs.bzl", "rust_binary") package(default_visibility = ["//visibility:public"]) rust_binary( name = "hello_env", srcs = ["src/main.rs"], edition = "2018", rustc_env_files = [":generate_rustc_env_file"], ) write_file( name = "generate_rustc_env_file", out = "rustc_env_file", content = [ "CARGO_PKG_VERSION=1.2.3", "GREETING=Howdy", "", ], ) sh_test( name = "output_test", srcs = ["output_test.sh"], args = ["$(rootpath :hello_env)"], data = [":hello_env"], )