blob: c2039b076c429c27c3b31d60730240b86bedd8f2 [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("@rules_python//python:py_library.bzl", "py_library")
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/rust:rustc_staticlib.bzl", "rustc_staticlib")
package(default_applicable_licenses = ["//:license"])
# Keep mypy in GN: GN-only consumers that run mypy (FIDL Python bindings,
# fuchsia-controller tests, and Lacewing tests) need type information from it.
#
# Ensure all FIDL dependencies meet the compatibility and stability
# requirements. There are currently exceptions - see https://fxbug.dev/42081073.
# Host tools in the IDK can depend on SDK categories up to "host_tool".
# TODO(https://fxbug.dev/454397833): Enforce this in Bazel as well.
# @bazel2gn:raw_attribute:enable_mypy = true
# @bazel2gn:raw_attribute:assert_no_deps = markers_partner_idk_host_tools_must_not_depend_on
py_library(
name = "fuchsia_controller_py",
srcs = ["python/fuchsia_controller_py/__init__.py"],
imports = ["python"],
target_compatible_with = HOST_OS_CONSTRAINTS,
visibility = ["//:__subpackages__"],
deps = [
"//src/developer/fuchsia-controller/cpp:fuchsia_controller_internal",
"//src/testing/end_to_end/mobly_base_tests/fuchsia_async_extension",
],
)
# The `fidl` runtime package used by generated FIDL Python bindings.
#
# Keep mypy in GN: GN-only consumers that run mypy (FIDL Python bindings,
# fuchsia-controller tests, and Lacewing tests) need type information from it.
# @bazel2gn:raw_attribute:enable_mypy = true
py_library(
name = "fidl_bindings",
srcs = [
"python/fidl/__init__.py",
"python/fidl/_async_channel.py",
"python/fidl/_async_socket.py",
"python/fidl/_client.py",
"python/fidl/_decoder.py",
"python/fidl/_encoder.py",
"python/fidl/_fidl_common.py",
"python/fidl/_ipc.py",
"python/fidl/_registry.py",
"python/fidl/_server.py",
],
imports = ["python"],
# TODO(https://fxbug.dev/575968075): Fix the Pyrefly errors about
# inconsistent method overrides in python/fidl/_ipc.py, and remove
# "no-pyrefly". GN still type checks this library with mypy.
tags = ["no-pyrefly"],
target_compatible_with = HOST_OS_CONSTRAINTS,
visibility = ["//:__subpackages__"],
deps = [":fuchsia_controller_py"],
)
rustc_staticlib(
name = "lib",
srcs = [
"src/commands.rs",
"src/compat.rs",
"src/env_context.rs",
"src/ext_buffer.rs",
"src/fdomain.rs",
"src/lib.rs",
"src/lib_context.rs",
"src/logging.rs",
"src/waker.rs",
],
edition = "2024",
output_name = "fuchsia_controller",
target_compatible_with = HOST_OS_CONSTRAINTS,
visibility = ["//src/developer/fuchsia-controller:__subpackages__"],
deps = [
"//sdk/fidl/fuchsia.developer.remotecontrol:fuchsia.developer.remotecontrol_rust_fdomain",
"//sdk/fidl/fuchsia.device:fuchsia.device_rust_fdomain",
"//sdk/rust/zx-types",
"//src/developer/ffx/config:lib",
"//src/developer/ffx/lib/discovery:lib",
"//src/developer/ffx/lib/errors:lib",
"//src/developer/ffx/lib/logging:lib",
"//src/developer/ffx/lib/rcs:lib",
"//src/developer/ffx/lib/target:lib",
"//src/developer/ffx/lib/timeout:lib",
"//src/developer/ffx/plugins/target/wait:ffx_wait",
"//src/developer/ffx/plugins/target/wait:ffx_wait_args",
"//src/lib/fdomain/client",
"//src/lib/fdomain/local",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//third_party/rust_crates/vendor:anyhow",
"//third_party/rust_crates/vendor:async-channel",
"//third_party/rust_crates/vendor:async-lock",
"//third_party/rust_crates/vendor:camino",
"//third_party/rust_crates/vendor:futures-lite",
"//third_party/rust_crates/vendor:log",
"//third_party/rust_crates/vendor:serde_json",
"//third_party/rust_crates/vendor:signal-hook",
"//third_party/rust_crates/vendor:thiserror",
"//third_party/rust_crates/vendor:tokio",
],
)
host_rustc_test(
name = "lib_test",
crate = ":lib",
crate_name = "fuchsia_controller_staticlib_test",
visibility = ["//src/developer:__pkg__"],
deps = [
"//sdk/fidl/fuchsia.fdomain:fuchsia.fdomain_rust",
"//sdk/rust/zx-status",
"//third_party/rust_crates/vendor:byteorder",
"//third_party/rust_crates/vendor:futures-test",
"//third_party/rust_crates/vendor:tempfile",
],
)