blob: cb48b2ef4aa88a6ef298487606a86099629c5c83 [file] [log] [blame]
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
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"],
)
rust_library(
name = "hello_env_crate",
srcs = ["src/lib.rs"],
edition = "2018",
rustc_env_files = [":generate_rustc_env_file"],
)
rust_test(
name = "hello_env_crate_test",
crate = ":hello_env_crate",
)