Replaced small genrules with uses of bazel_skylib (#1451)
diff --git a/test/cargo_build_script/BUILD.bazel b/test/cargo_build_script/BUILD.bazel
index ff5bc6b..31bff6c 100644
--- a/test/cargo_build_script/BUILD.bazel
+++ b/test/cargo_build_script/BUILD.bazel
@@ -1,5 +1,6 @@
"""Tests for the cargo_build_script rule"""
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//cargo:cargo_build_script.bzl", "cargo_build_script")
load("//rust:defs.bzl", "rust_test")
@@ -14,11 +15,10 @@
tools = [":tool"],
)
-genrule(
+write_file(
name = "tool",
- srcs = [],
- outs = ["tool-file"],
- cmd = "touch $@",
+ out = "tool-file",
+ content = [""],
)
rust_test(
diff --git a/test/rustc_env_files/BUILD.bazel b/test/rustc_env_files/BUILD.bazel
index f1ce1b2..4139825 100644
--- a/test/rustc_env_files/BUILD.bazel
+++ b/test/rustc_env_files/BUILD.bazel
@@ -1,3 +1,4 @@
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("//rust:defs.bzl", "rust_binary")
package(default_visibility = ["//visibility:public"])
@@ -9,15 +10,19 @@
rustc_env_files = [":generate_rustc_env_file"],
)
-genrule(
+write_file(
name = "generate_rustc_env_file",
- outs = ["rustc_env_file"],
- cmd = "echo CARGO_PKG_VERSION=1.2.3 >> $@ && echo GREETING=Howdy >> $@",
+ out = "rustc_env_file",
+ content = [
+ "CARGO_PKG_VERSION=1.2.3",
+ "GREETING=Howdy",
+ "",
+ ],
)
sh_test(
name = "output_test",
srcs = ["output_test.sh"],
- args = ["$(location :hello_env)"],
+ args = ["$(rootpath :hello_env)"],
data = [":hello_env"],
)