| # 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/platforms:constraints.bzl", "HOST_OS_CONSTRAINTS") | |
| load("//build/bazel/rules/host_tests:host_rustc_test.bzl", "host_rustc_test") | |
| load("//build/bazel/rules/idk:idk_ffx_tool.bzl", "idk_ffx_tool") | |
| load("//build/bazel/rules/rust:rustc_library.bzl", "rustc_library") | |
| load("//build/tools/json_merge:json_merge.bzl", "json_merge") | |
| package(default_applicable_licenses = ["//:license"]) | |
| test_suite( | |
| name = "host_tests", | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| tests = [ | |
| ":ffx_trace_args_test", | |
| ":ffx_trace_test", | |
| ], | |
| visibility = ["//src/developer/ffx:__pkg__"], | |
| ) | |
| json_merge( | |
| name = "ffx_trace_config", | |
| srcs = ["data/config.json"], | |
| minify = True, | |
| visibility = ["//src/developer/ffx:__pkg__"], | |
| ) | |
| rustc_library( | |
| name = "ffx_trace_args", | |
| srcs = ["src/args.rs"], | |
| crate_root = "src/args.rs", | |
| edition = "2024", | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| deps = [ | |
| "//sdk/fidl/fuchsia.tracing.controller:fuchsia.tracing.controller_rust_fdomain", | |
| "//sdk/fidl/fuchsia.tracing:fuchsia.tracing_rust_fdomain", | |
| "//third_party/rust_crates/vendor:argh", | |
| ], | |
| ) | |
| rustc_library( | |
| name = "ffx_trace", | |
| srcs = [ | |
| "src/direct.rs", | |
| "src/lib.rs", | |
| "src/process.rs", | |
| "src/progress_reader.rs", | |
| "src/upload.rs", | |
| ], | |
| edition = "2024", | |
| link_deps = ["//third_party/zstd"], | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| deps = [ | |
| ":ffx_trace_args", | |
| "//sdk/fidl/fuchsia.tracing.controller:fuchsia.tracing.controller_rust_fdomain", | |
| "//sdk/fidl/fuchsia.tracing:fuchsia.tracing_rust_fdomain", | |
| "//src/developer/ffx/config:lib", | |
| "//src/developer/ffx/lib/errors:lib", | |
| "//src/developer/ffx/lib/fho:lib", | |
| "//src/developer/ffx/lib/futures:lib", | |
| "//src/developer/ffx/lib/pbms:lib", | |
| "//src/developer/ffx/lib/target:lib", | |
| "//src/developer/ffx/lib/target/holders:lib", | |
| "//src/developer/ffx/lib/trace:lib", | |
| "//src/developer/ffx/lib/writer:lib", | |
| "//src/lib/fdomain/client", | |
| "//src/lib/fidl/rust/fidl", | |
| "//src/lib/fuchsia-async", | |
| "//src/lib/gcs", | |
| "//src/lib/structured_ui", | |
| "//src/performance/lib/fxt/rust", | |
| "//src/performance/trace_task:trace_task_fdomain", | |
| "//third_party/rust_crates/forks/prettytable-rs:prettytable", | |
| "//third_party/rust_crates/vendor:anyhow", | |
| "//third_party/rust_crates/vendor:async-fs", | |
| "//third_party/rust_crates/vendor:blocking", | |
| "//third_party/rust_crates/vendor:futures", | |
| "//third_party/rust_crates/vendor:hex", | |
| "//third_party/rust_crates/vendor:log", | |
| "//third_party/rust_crates/vendor:serde", | |
| "//third_party/rust_crates/vendor:sha2", | |
| "//third_party/rust_crates/vendor:term_grid", | |
| "//third_party/rust_crates/vendor:termion", | |
| "//third_party/rust_crates/vendor:zerocopy", | |
| "//third_party/rust_crates/vendor:zstd", | |
| ], | |
| ) | |
| # Needed for Honeydew's SDK inclusion | |
| # | |
| # TODO(https://fxbug.dev/330934833): Remove when IDK allows for `testonly` targets in dep | |
| # tree or when we can separate the concept of data_dep from host_test_data. | |
| idk_ffx_tool( | |
| name = "ffx_trace_tool", | |
| testonly = False, | |
| srcs = ["src/main.rs"], | |
| category = "partner", | |
| edition = "2024", | |
| idk_name = "ffx-trace", | |
| link_deps = ["//third_party/zstd"], | |
| visibility = ["//:__subpackages__"], | |
| deps = [ | |
| ":ffx_trace", | |
| "//src/developer/ffx/lib/fho:lib", | |
| "//src/lib/fuchsia-async", | |
| ], | |
| ) | |
| host_rustc_test( | |
| name = "ffx_trace_args_test", | |
| crate = ":ffx_trace_args", | |
| ) | |
| host_rustc_test( | |
| name = "ffx_trace_test", | |
| crate = ":ffx_trace", | |
| deps = [ | |
| "//src/lib/fdomain/local", | |
| "//src/lib/fuchsia", | |
| "//third_party/rust_crates/vendor:pretty_assertions", | |
| "//third_party/rust_crates/vendor:regex", | |
| "//third_party/rust_crates/vendor:serde_json", | |
| "//third_party/rust_crates/vendor:tempfile", | |
| ], | |
| ) |