| # 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/rust:defs.bzl", | |
| "rustc_library", | |
| "rustc_proc_macro", | |
| ) | |
| package(default_applicable_licenses = ["//:license"]) | |
| rustc_library( | |
| name = "cm_rust", | |
| srcs = [ | |
| "src/capability.rs", | |
| "src/config.rs", | |
| "src/lib.rs", | |
| "src/offer.rs", | |
| "src/use.rs", | |
| ] + select({ | |
| "//build/bazel/platforms:is_host_os": [ | |
| "src/serde_ext.rs", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| crate_features = select({ | |
| "//build/bazel/platforms:is_host_os": [ | |
| "serde", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| crate_name = "cm_rust", | |
| edition = "2024", | |
| proc_macro_deps = [ | |
| ":cm_rust_derive", | |
| "//third_party/rust_crates/vendor:strum_macros", | |
| ], | |
| test_deps = [ | |
| "//third_party/rust_crates/vendor:difference", | |
| ] + select({ | |
| "//build/bazel/platforms:is_host_os": [ | |
| "//third_party/rust_crates/vendor:serde_json", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| visibility = [ | |
| "//:__subpackages__", | |
| ], | |
| with_unit_tests = True, | |
| deps = [ | |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust", | |
| "//sdk/fidl/fuchsia.data:fuchsia.data_rust", | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", | |
| "//sdk/fidl/fuchsia.process:fuchsia.process_rust", | |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust", | |
| "//src/lib/directed_graph", | |
| "//src/lib/from-enum", | |
| "//src/sys/lib/cm_fidl_validator", | |
| "//src/sys/lib/cm_types", | |
| "//third_party/rust_crates/vendor:bitflags", | |
| "//third_party/rust_crates/vendor:flyweights", | |
| "//third_party/rust_crates/vendor:strum", | |
| "//third_party/rust_crates/vendor:thiserror", | |
| ] + select({ | |
| "//build/bazel/platforms:is_host_os": [ | |
| "//src/sys/lib/bitflags-serde-legacy", | |
| "//third_party/rust_crates/vendor:serde", | |
| ], | |
| "//conditions:default": [], | |
| }), | |
| ) | |
| rustc_proc_macro( | |
| name = "cm_rust_derive", | |
| srcs = ["src/macro.rs"], | |
| crate_root = "src/macro.rs", | |
| edition = "2024", | |
| deps = [ | |
| "//third_party/rust_crates/vendor:darling", | |
| "//third_party/rust_crates/vendor:proc-macro2", | |
| "//third_party/rust_crates/vendor:quote", | |
| "//third_party/rust_crates/vendor:syn", | |
| ], | |
| ) |