blob: cdbc5ec3ba89655a7b53748b4a5b4db442103d92 [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/rust/rustc_binary.gni")
import("//build/rust/rustc_test.gni")
import("//src/power/cpu-manager/node_config/node_config.gni")
cpu_manager_deps = [
":cpu-manager-config-lib",
"energy_model_config/parser",
"//sdk/fidl/fuchsia.hardware.cpu.ctrl:fuchsia.hardware.cpu.ctrl_rust",
"//sdk/fidl/fuchsia.kernel:fuchsia.kernel_rust",
"//sdk/fidl/fuchsia.power.cpu.manager:fuchsia.power.cpu.manager_rust",
"//sdk/fidl/fuchsia.thermal:fuchsia.thermal_rust",
"//sdk/rust/zx",
"//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/trace/rust:trace",
"//src/lib/trace/rust:trace-provider",
"//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:serde",
"//third_party/rust_crates:serde_derive",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:serde_json5",
"//third_party/rust_crates:thiserror",
]
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/rppm_handler.rs",
"src/syscall_handler.rs",
"src/test/mock_node.rs",
"src/test/mod.rs",
"src/thermal_watcher.rs",
"src/utils.rs",
]
source_set("fake_syscalls") {
testonly = true
sources = [ "src/test/fake_syscalls.cc" ]
}
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 = [
":fake_syscalls",
"//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_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" ]
}
group("tests") {
testonly = true
deps = [
":cpu-manager-tests",
"energy_model_config:tests",
]
}
fuchsia_unittest_package("cpu-manager-tests") {
manifest = "meta/cpu_manager_bin_test.cml"
deps = [
":astro",
":bin_test",
":sherlock",
":vim3",
]
}
node_config("astro") {
source = "node_config/astro_node_config.json5"
output = "astro_node_config.json5"
}
node_config("sherlock") {
source = "node_config/sherlock_node_config.json5"
output = "sherlock_node_config.json5"
}
node_config("vim3") {
source = "node_config/vim3_node_config.json5"
output = "vim3_node_config.json5"
}