blob: 9923a2f3356a1cc8b65e8fc3120e4cc55e533e7f [file] [log] [blame]
"""Tests for the cargo_build_script rule"""
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//cargo:defs.bzl", "cargo_build_script")
load("//rust:defs.bzl", "rust_test")
# Test that tools are built in the exec configuration.
cargo_build_script(
name = "tools_exec_build_rs",
srcs = ["build.rs"],
build_script_env = {"TOOL": "$(execpath :tool)"},
edition = "2018",
# Add a flag to test that they're exposed to the build script
rustc_flags = ["--verbose"],
tools = [":tool"],
)
write_file(
name = "tool",
out = "tool-file",
content = [""],
)
rust_test(
name = "tools_exec",
srcs = ["tools_exec.rs"],
edition = "2018",
deps = [":tools_exec_build_rs"],
)