blob: fb041b95fa6f7f9e11b361a2f541406a87f73243 [file]
# Copyright 2026 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load(
"//build/bazel/rules/components:fx_component.bzl",
"fx_component",
"fx_component_manifest",
)
load("//build/bazel/rules/packages:fx_package.bzl", "fx_package")
load(
"//build/bazel/rules/packages:fx_packaged_binary.bzl",
"fx_packaged_binary",
)
load("//build/bazel/rules/rust:rustc_binary.bzl", "rustc_binary")
load("//build/bazel/rules/rust:rustc_test.bzl", "rustc_test")
load("//build/bazel/rules/testing:fx_test.bzl", "fx_test")
load(
"//build/bazel/rules/testing:fx_unittest_component.bzl",
"fx_unittest_component",
)
package(default_applicable_licenses = ["//:license"])
rustc_binary(
name = "crasher_exe",
srcs = ["src/main.rs"],
binary_name = "rust_crasher",
edition = "2024",
deps = [
"//src/lib/fuchsia-async",
"//third_party/rust_crates/vendor:argh",
],
)
fx_packaged_binary(
name = "crasher_exe_packaged",
binary = ":crasher_exe",
binary_name = "rust_crasher",
)
fx_component_manifest(
name = "rust_crasher_manifest",
component_name = "rust_crasher",
includes = ["//sdk/lib/syslog:client.shard"],
manifest = "meta/crasher.cml",
)
fx_component(
name = "rust_crasher",
compiled_manifest = ":rust_crasher_manifest",
visibility = ["//src/developer/forensics/crasher:__pkg__"],
deps = [":crasher_exe_packaged"],
)
rustc_test(
name = "crasher_exe_test",
crate = ":crasher_exe",
# Preserve the `rust_crasher_bin_test` crate/binary name generated by
# GN `rustc_binary(name = "rust_crasher", with_unit_tests = true)`, which
# zxdb e2e tests match on.
crate_name = "rust_crasher_bin_test",
# For the #[fuchsia::test] attribute.
deps = ["//src/lib/fuchsia"],
)
fx_unittest_component(
name = "rust_crasher_test",
binary = ":crasher_exe_test",
)
# Needs reviewer attention (bazel2gn skip): In GN, `:rust_crasher_test` is packaged by `//src/developer/forensics/crasher:crasher_test` and referenced via `get_target_outputs()` by `fuchsia_test("tests")` above the sentinel.
# @bazel2gn:skip
fx_package(
name = "rust_crasher_tests_package",
package_name = "rust-crasher-tests",
test_components = [":rust_crasher_test"],
)
# Because the test package is declared in another file.
fx_test(
name = "rust_crasher_tests",
# don't run it on any bots
build_only = True,
package = ":rust_crasher_tests_package",
visibility = ["//src/developer:__pkg__"],
)