Move coverage tooling to `//rust/coverage` (#4257)
This mirrors `rules_cc` in an effort to promote consistency among rules
https://github.com/bazelbuild/rules_cc/pull/867
diff --git a/extensions/prost/private/prost.bzl b/extensions/prost/private/prost.bzl
index bff3092..dec7e55 100644
--- a/extensions/prost/private/prost.bzl
+++ b/extensions/prost/private/prost.bzl
@@ -368,7 +368,7 @@
attr_aspects = ["deps"],
attrs = {
"_collect_cc_coverage": attr.label(
- default = Label("@rules_rust//util:collect_coverage"),
+ default = Label("@rules_rust//rust/coverage:collect_rust_coverage"),
executable = True,
cfg = "exec",
),
@@ -432,7 +432,7 @@
mandatory = True,
),
"_collect_cc_coverage": attr.label(
- default = Label("@rules_rust//util:collect_coverage"),
+ default = Label("@rules_rust//rust/coverage:collect_rust_coverage"),
executable = True,
cfg = "exec",
),
diff --git a/rust/coverage/BUILD.bazel b/rust/coverage/BUILD.bazel
new file mode 100644
index 0000000..a4f37cd
--- /dev/null
+++ b/rust/coverage/BUILD.bazel
@@ -0,0 +1,17 @@
+load("//rust:defs.bzl", "rust_binary")
+
+rust_binary(
+ name = "collect_rust_coverage",
+ srcs = ["collect_rust_coverage.rs"],
+ edition = "2018",
+ # To ensure this tool is produced deterministically, debug info
+ # is stripped out. On macOS, full symbol stripping is needed to
+ # also remove N_OSO stab entries whose timestamps and sandbox
+ # paths vary between builds.
+ rustc_flags = select({
+ "@platforms//os:linux": ["-Cstrip=debuginfo"],
+ "@platforms//os:macos": ["-Cstrip=symbols"],
+ "//conditions:default": [],
+ }),
+ visibility = ["//visibility:public"],
+)
diff --git a/util/collect_coverage/collect_coverage.rs b/rust/coverage/collect_rust_coverage.rs
similarity index 100%
rename from util/collect_coverage/collect_coverage.rs
rename to rust/coverage/collect_rust_coverage.rs
diff --git a/rust/private/rust.bzl b/rust/private/rust.bzl
index a69202a..54178d7 100644
--- a/rust/private/rust.bzl
+++ b/rust/private/rust.bzl
@@ -932,7 +932,7 @@
_COVERAGE_ATTRS = {
"_collect_cc_coverage": attr.label(
- default = Label("//util/collect_coverage"),
+ default = Label("//rust/coverage:collect_rust_coverage"),
executable = True,
cfg = "exec",
),
@@ -1308,7 +1308,7 @@
default = False,
doc = dedent("""\
Flag to dynamically link the standard library as a Rust dylib .so object when building this binary.
-
+
Default is false. This is often required when building a binary that depends on a Rust ABI dylib.
"""),
),
diff --git a/util/collect_coverage/BUILD.bazel b/util/collect_coverage/BUILD.bazel
index 24ed5be..00aab4a 100644
--- a/util/collect_coverage/BUILD.bazel
+++ b/util/collect_coverage/BUILD.bazel
@@ -1,17 +1,6 @@
-load("//rust:defs.bzl", "rust_binary")
-
-rust_binary(
+alias(
name = "collect_coverage",
- srcs = ["collect_coverage.rs"],
- edition = "2018",
- # To ensure this tool is produced deterministically, debug info
- # is stripped out. On macOS, full symbol stripping is needed to
- # also remove N_OSO stab entries whose timestamps and sandbox
- # paths vary between builds.
- rustc_flags = select({
- "@platforms//os:linux": ["-Cstrip=debuginfo"],
- "@platforms//os:macos": ["-Cstrip=symbols"],
- "//conditions:default": [],
- }),
+ actual = "//rust/coverage:collect_rust_coverage",
+ deprecation = "instead use `@rules_rust//rust/coverage:collect_rust_coverage`",
visibility = ["//visibility:public"],
)