| # 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/dist/component_manifest_resources.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//third_party/cobalt/metrics_registry.gni") |
| |
| metrics_registry("power_manager_metrics") { |
| # ID of the 'power' project from the //third_party/cobalt_config/projects.yaml file |
| project_id = 3 |
| |
| # The namespace to use in the generated code |
| namespace = "power_manager_metrics" |
| |
| # Generates a rust target called 'power_manager_metrics_rustlib' |
| generate_rust = true |
| } |
| |
| source_set("fake_syscalls") { |
| testonly = true |
| sources = [ "testing/fake_syscalls.cc" ] |
| } |
| |
| rustc_binary("bin") { |
| name = "power_manager" |
| edition = "2021" |
| with_unit_tests = true |
| |
| configs += [ "//build/config/rust:bootfs" ] |
| |
| deps = [ |
| ":power_manager_metrics_rustlib", |
| "system_power_mode_config/parser", |
| "thermal_config/parser", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc", |
| "//sdk/fidl/fuchsia.cobalt:fuchsia.cobalt-rustc", |
| "//sdk/fidl/fuchsia.device:fuchsia.device-rustc", |
| "//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager-rustc", |
| "//sdk/fidl/fuchsia.feedback:fuchsia.feedback-rustc", |
| "//sdk/fidl/fuchsia.hardware.cpu.ctrl:fuchsia.hardware.cpu.ctrl-rustc", |
| "//sdk/fidl/fuchsia.hardware.input:fuchsia.hardware.input-rustc", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol-rustc", |
| "//sdk/fidl/fuchsia.hardware.thermal:fuchsia.hardware.thermal-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.kernel:fuchsia.kernel-rustc", |
| "//sdk/fidl/fuchsia.power.clientlevel:fuchsia.power.clientlevel-rustc", |
| "//sdk/fidl/fuchsia.power.manager:fuchsia.power.manager-rustc", |
| "//sdk/fidl/fuchsia.power.profile:fuchsia.power.profile-rustc", |
| "//sdk/fidl/fuchsia.power.systemmode:fuchsia.power.systemmode-rustc", |
| "//sdk/fidl/fuchsia.settings:fuchsia.settings-rustc", |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc", |
| "//sdk/fidl/fuchsia.thermal:fuchsia.thermal-rustc", |
| "//sdk/fidl/fuchsia.ui.activity:fuchsia.ui.activity-rustc", |
| "//sdk/lib/device-watcher/rust", |
| "//src/lib/async-utils", |
| "//src/lib/cobalt/rust:fuchsia-cobalt", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/storage/fuchsia-vfs-watcher", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/trace/rust:trace", |
| "//src/lib/trace/rust:trace-provider", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/lib/stdout-to-debuglog/rust", |
| "//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:log", |
| "//third_party/rust_crates:num-traits", |
| "//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", |
| ] |
| |
| test_deps = [ |
| ":fake_syscalls", |
| "rkf45:lib", |
| "//src/lib/storage/vfs/rust:vfs", |
| "//src/lib/test_util", |
| "//third_party/rust_crates:assert_matches", |
| ] |
| |
| sources = [ |
| "src/activity_handler.rs", |
| "src/cpu_control_handler.rs", |
| "src/cpu_device_handler.rs", |
| "src/cpu_manager.rs", |
| "src/cpu_stats_handler.rs", |
| "src/crash_report_handler.rs", |
| "src/dev_control_handler.rs", |
| "src/driver_manager_handler.rs", |
| "src/error.rs", |
| "src/input_settings_handler.rs", |
| "src/lid_shutdown.rs", |
| "src/main.rs", |
| "src/message.rs", |
| "src/node.rs", |
| "src/platform_metrics.rs", |
| "src/power_manager.rs", |
| "src/shutdown_request.rs", |
| "src/shutdown_watcher.rs", |
| "src/syscall_handler.rs", |
| "src/system_power_mode_handler.rs", |
| "src/system_profile_handler.rs", |
| "src/system_shutdown_handler.rs", |
| "src/temperature_handler.rs", |
| "src/test/mock_node.rs", |
| "src/test/mod.rs", |
| "src/test/thermal_integration_tests.rs", |
| "src/thermal_load_driver.rs", |
| "src/thermal_policy.rs", |
| "src/thermal_shutdown.rs", |
| "src/thermal_state_handler.rs", |
| "src/types.rs", |
| "src/utils.rs", |
| ] |
| } |
| |
| component_manifest_resources("manifest") { |
| sources = [ "meta/power-manager.cml" ] |
| } |
| |
| group("power-manager") { |
| testonly = true |
| deps = [ |
| ":bin", |
| ":tests", |
| ] |
| } |
| |
| group("bootfs") { |
| deps = [ |
| ":bin", |
| ":manifest", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":power-manager-tests", |
| "rkf45:rkf45-tests", |
| "system_power_mode_config:tests", |
| "thermal_config:tests", |
| ] |
| } |
| |
| fuchsia_unittest_package("power-manager-tests") { |
| manifest = "meta/power_manager_bin_test.cmx" |
| deps = [ |
| ":bin_test", |
| "node_config:test_config_data", |
| ] |
| } |
| |
| group("astro_config") { |
| deps = [ "node_config:astro" ] |
| } |
| |
| group("base_config") { |
| deps = [ "node_config:base" ] |
| } |
| |
| group("chromebook_config") { |
| deps = [ "node_config:chromebook" ] |
| } |
| |
| group("luis_config") { |
| deps = [ "node_config:luis" ] |
| } |
| |
| group("nelson_config") { |
| deps = [ "node_config:nelson" ] |
| } |
| |
| group("sherlock_config") { |
| deps = [ "node_config:sherlock" ] |
| } |