| # Copyright 2019 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. |
| |
| import("//build/components.gni") |
| import("//build/config.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| cpu_manager_deps = [ |
| ":cpu-manager-config-lib", |
| "//sdk/fidl/fuchsia.hardware.cpu.ctrl:fuchsia.hardware.cpu.ctrl_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel_rust", |
| "//sdk/fidl/fuchsia.thermal:fuchsia.thermal_rust", |
| "//sdk/lib/device-watcher/rust", |
| "//src/lib/async-utils", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:libm", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:serde_json5", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| cpu_manager_sources = [ |
| "//src/power/common/lib/common_utils.rs", |
| "//src/power/common/lib/types.rs", |
| "src/cpu_control_handler.rs", |
| "src/cpu_device_handler.rs", |
| "src/cpu_manager.rs", |
| "src/cpu_manager_main.rs", |
| "src/cpu_stats_handler.rs", |
| "src/error.rs", |
| "src/main.rs", |
| "src/message.rs", |
| "src/node.rs", |
| "src/syscall_handler.rs", |
| "src/test/mock_node.rs", |
| "src/test/mod.rs", |
| "src/thermal_watcher.rs", |
| ] |
| |
| rustc_binary("bin") { |
| name = "cpu_manager" |
| edition = "2021" |
| with_unit_tests = true |
| configs += [ "//build/config/rust:bootfs" ] |
| deps = cpu_manager_deps |
| sources = cpu_manager_sources |
| test_deps = [ |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/test_util", |
| "//third_party/rust_crates:assert_matches", |
| ] |
| } |
| |
| rustc_binary("bin_with_fake_time") { |
| testonly = true |
| name = "cpu_manager_fake_time" |
| edition = "2021" |
| with_unit_tests = true |
| configs += [ "//build/config/rust:bootfs" ] |
| deps = cpu_manager_deps |
| sources = cpu_manager_sources |
| non_rust_deps = [ "//src/lib/fake-clock/lib" ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| manifest = "meta/cpu-manager.cml" |
| component_name = "cpu-manager" |
| } |
| |
| fuchsia_structured_config_values("default_component_config") { |
| cm_label = ":manifest" |
| values = { |
| # Below are default values that are only expected to be changed for integration tests. |
| node_config_path = "/config/node_config.json" |
| } |
| } |
| |
| fuchsia_structured_config_rust_lib("cpu-manager-config-lib") { |
| cm_label = ":manifest" |
| } |
| |
| group("cpu-manager") { |
| testonly = true |
| deps = [ |
| ":bin", |
| ":tests", |
| ] |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "cpu-manager" |
| deps = [ |
| ":component", |
| ":default_component_config", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":cpu-manager-tests" ] |
| } |
| |
| fuchsia_unittest_package("cpu-manager-tests") { |
| manifest = "meta/cpu_manager_bin_test.cml" |
| deps = [ |
| ":bin_test", |
| "node_config:test_config_data", |
| ] |
| } |
| |
| group("astro_config") { |
| deps = [ "node_config:astro" ] |
| } |
| |
| group("sherlock_config") { |
| deps = [ "node_config:sherlock" ] |
| } |