| # Copyright 2018 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_library.gni") |
| import("//src/sys/core/build/core_shard.gni") |
| |
| rustc_library("lib") { |
| with_unit_tests = true |
| edition = "2021" |
| sources = [ |
| "src/backlight.rs", |
| "src/lib.rs", |
| "src/sensor.rs", |
| ] |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.backlight:fuchsia.hardware.backlight_rust", |
| "//sdk/fidl/fuchsia.input.report:fuchsia.input.report_rust", |
| "//sdk/fidl/fuchsia.ui.display.internal:fuchsia.ui.display.internal_rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:tracing", |
| ] |
| test_deps = [ |
| ":test-helpers", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:futures-util", |
| ] |
| } |
| |
| fuchsia_unittest_package("library_tests") { |
| deps = [ ":lib_test" ] |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| rustc_binary("bin") { |
| name = "brightness_manager" |
| version = "0.1.0" |
| with_unit_tests = true |
| edition = "2021" |
| |
| deps = [ |
| ":brightness_manager_config", |
| ":lib", |
| "//sdk/fidl/fuchsia.ui.brightness:fuchsia.ui.brightness_rust", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/watch_handler:watch_handler", |
| "//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:lazy_static", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:splines", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| sources = [ |
| "src/control.rs", |
| "src/main.rs", |
| "src/sender_channel.rs", |
| ] |
| } |
| |
| rustc_binary("auto-brightness_bin") { |
| name = "auto_brightness" |
| source_root = "src/auto-brightness.rs" |
| edition = "2021" |
| with_unit_tests = true |
| sources = [ |
| "src/auto-brightness.rs", |
| "src/led.rs", |
| ] |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.hardware.light:fuchsia.hardware.light_rust", |
| "//sdk/lib/device-watcher/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//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:num-traits", |
| "//third_party/rust_crates:tracing", |
| ] |
| test_deps = [ "//third_party/rust_crates:futures" ] |
| } |
| |
| core_shard("auto-brightness_core_shard") { |
| shard_file = "meta/auto-brightness.core_shard.cml" |
| } |
| |
| fuchsia_package_with_single_component("auto-brightness") { |
| deps = [ ":auto-brightness_bin" ] |
| manifest = "meta/auto-brightness.cml" |
| } |
| |
| fuchsia_unittest_package("auto-brightness_tests") { |
| deps = [ ":auto-brightness_bin_test" ] |
| } |
| |
| rustc_library("test-helpers") { |
| testonly = true |
| name = "test_helpers" |
| with_unit_tests = true |
| edition = "2021" |
| |
| visibility = [ ":*" ] |
| |
| source_root = "src/test_helpers.rs" |
| sources = [ "src/test_helpers.rs" ] |
| |
| deps = [ |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| ] |
| |
| test_deps = [ |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:assert_matches", |
| ] |
| } |
| |
| fuchsia_unittest_package("test-helpers-tests") { |
| deps = [ ":test-helpers_test" ] |
| } |
| |
| fuchsia_component_manifest("brightness_manager_manifest") { |
| component_name = "brightness_manager" |
| manifest = "meta/brightness_manager.cml" |
| } |
| |
| fuchsia_component("brightness_manager_component") { |
| cm_label = ":brightness_manager_manifest" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_structured_config_values("config_with_display_power") { |
| cm_label = ":brightness_manager_manifest" |
| values_source = "config/with-display-power.json5" |
| } |
| |
| fuchsia_structured_config_values("config_without_display_power") { |
| cm_label = ":brightness_manager_manifest" |
| values_source = "config/without-display-power.json5" |
| } |
| |
| fuchsia_structured_config_rust_lib("brightness_manager_config") { |
| cm_label = ":brightness_manager_manifest" |
| } |
| |
| fuchsia_package("brightness_manager_with_display_power") { |
| package_name = "brightness_manager" |
| deps = [ |
| ":brightness_manager_component", |
| ":config_with_display_power", |
| ] |
| } |
| |
| fuchsia_package("brightness_manager_without_display_power") { |
| package_name = "brightness_manager" |
| deps = [ |
| ":brightness_manager_component", |
| ":config_without_display_power", |
| ] |
| } |
| |
| # Temporarily an alias for ":brightness_manager_without_display_power". |
| group("brightness_manager") { |
| deps = [ ":brightness_manager_without_display_power" ] |
| } |
| |
| fuchsia_component("brightness_manager_test_driver") { |
| testonly = true |
| manifest = "meta/brightness_manager_test_driver.cml" |
| deps = [ ":bin_test" ] |
| } |
| |
| fuchsia_component("brightness_manager_test") { |
| testonly = true |
| component_name = "brightness_manager_test" |
| manifest = "meta/brightness_manager_test.cml" |
| } |
| |
| fuchsia_test_package("brightness_manager_tests") { |
| test_components = [ ":brightness_manager_test" ] |
| deps = [ ":brightness_manager_test_driver" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":auto-brightness_tests", |
| ":brightness_manager_tests", |
| ":library_tests", |
| ":test-helpers-tests", |
| ] |
| } |