blob: b0c2245862609f511400be389818182d189a3d94 [file] [log] [blame]
# 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")
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" ]
}
power_manager_deps = [
":power-manager-config-lib",
":power_manager_metrics_rustlib",
"system_power_mode_config/parser",
"thermal_config/parser",
"//sdk/fidl/fuchsia.component:fuchsia.component_rust",
"//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager_rust",
"//sdk/fidl/fuchsia.feedback:fuchsia.feedback_rust",
"//sdk/fidl/fuchsia.hardware.input:fuchsia.hardware.input_rust",
"//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust",
"//sdk/fidl/fuchsia.hardware.temperature:fuchsia.hardware.temperature_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust",
"//sdk/fidl/fuchsia.power.clientlevel:fuchsia.power.clientlevel_rust",
"//sdk/fidl/fuchsia.power.manager.debug:fuchsia.power.manager.debug_rust",
"//sdk/fidl/fuchsia.power.profile:fuchsia.power.profile_rust",
"//sdk/fidl/fuchsia.power.systemmode:fuchsia.power.systemmode_rust",
"//sdk/fidl/fuchsia.settings:fuchsia.settings_rust",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust",
"//sdk/fidl/fuchsia.thermal:fuchsia.thermal_rust",
"//sdk/fidl/fuchsia.ui.activity:fuchsia.ui.activity_rust",
"//src/lib/async-utils",
"//src/lib/cobalt/rust/builders",
"//src/lib/diagnostics/inspect/contrib/rust",
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fake-clock/named-timer",
"//src/lib/fidl/rust/fidl",
"//src/lib/fidl/rust/fidl-contrib",
"//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: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",
"//third_party/rust_crates:tracing",
]
power_manager_sources = [
"//src/power/common/lib/common_utils.rs",
"//src/power/common/lib/types.rs",
"src/activity_handler.rs",
"src/crash_report_handler.rs",
"src/debug_service.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/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/thermal_load_driver.rs",
"src/thermal_policy.rs",
"src/thermal_shutdown.rs",
"src/thermal_state_handler.rs",
"src/timer.rs",
"src/utils.rs",
]
rustc_binary("bin") {
name = "power_manager"
edition = "2021"
with_unit_tests = true
configs += [ "//build/config/rust:bootfs" ]
deps = power_manager_deps
sources = power_manager_sources
test_deps = [
":fake_syscalls",
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//third_party/rust_crates:assert_matches",
]
}
rustc_binary("bin_with_fake_time") {
testonly = true
name = "power_manager_fake_time"
edition = "2021"
with_unit_tests = true
configs += [ "//build/config/rust:bootfs" ]
deps = power_manager_deps
sources = power_manager_sources
non_rust_deps = [ "//src/lib/fake-clock/lib" ]
}
fuchsia_component_manifest("manifest") {
manifest = "meta/power-manager.cml"
component_name = "power-manager"
}
declare_args() {
enable_power_manager_debug = false
}
fuchsia_structured_config_values("default_component_config") {
cm_label = ":manifest"
values = {
enable_debug_service = enable_power_manager_debug
# Below are default values that are only expected to be changed for integration tests.
node_config_path = "/config/node_config.json"
disable_temperature_filter = false
}
}
fuchsia_structured_config_rust_lib("power-manager-config-lib") {
cm_label = ":manifest"
}
group("power-manager") {
testonly = true
deps = [
":bin",
":tests",
]
}
fuchsia_component("component") {
cm_label = ":manifest"
deps = [ ":bin" ]
}
fuchsia_package("package") {
package_name = "power-manager"
deps = [
":component",
":default_component_config",
]
}
group("tests") {
testonly = true
deps = [
":power-manager-tests",
"integration:tests",
"rkf45:rkf45-tests",
"system_power_mode_config:tests",
"testing/fake_root:tests",
"thermal_config:tests",
]
}
fuchsia_unittest_package("power-manager-tests") {
manifest = "meta/power_manager_bin_test.cml"
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" ]
}