blob: 67cc4fc5d2b584cd1625b2bbf805596309288876 [file] [log] [blame]
# Copyright 2022 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_library.gni")
import("//src/sys/core/build/core_shard.gni")
import("//third_party/cobalt/metrics_registry.gni")
group("service") {
testonly = true
deps = [
":bin",
":lib",
":setui_service",
":tests",
]
}
rustc_library("lib") {
name = "settings"
with_unit_tests = true
edition = "2021"
deps = [
":setui_metrics_registry",
"storage_fidl:fuchsia.settings.storage_rust",
"//sdk/fidl/fuchsia.camera3:fuchsia.camera3_rust",
"//sdk/fidl/fuchsia.hardware.light:fuchsia.hardware.light_rust",
"//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust",
"//sdk/fidl/fuchsia.input:fuchsia.input_rust",
"//sdk/fidl/fuchsia.input.report:fuchsia.input.report_rust",
"//sdk/fidl/fuchsia.intl:fuchsia.intl_rust",
"//sdk/fidl/fuchsia.io:fuchsia.io_rust",
"//sdk/fidl/fuchsia.media:fuchsia.media_rust",
"//sdk/fidl/fuchsia.media.audio:fuchsia.media.audio_rust",
"//sdk/fidl/fuchsia.media.sessions2:fuchsia.media.sessions2_rust",
"//sdk/fidl/fuchsia.media.sounds:fuchsia.media.sounds_rust",
"//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust",
"//sdk/fidl/fuchsia.recovery.policy:fuchsia.recovery.policy_rust",
"//sdk/fidl/fuchsia.settings:fuchsia.settings_rust",
"//sdk/fidl/fuchsia.settings.policy:fuchsia.settings.policy_rust",
"//sdk/fidl/fuchsia.stash:fuchsia.stash_rust",
"//sdk/fidl/fuchsia.ui.brightness:fuchsia.ui.brightness_rust",
"//sdk/fidl/fuchsia.ui.input:fuchsia.ui.input_rust",
"//sdk/fidl/fuchsia.ui.policy:fuchsia.ui.policy_rust",
"//sdk/fidl/fuchsia.ui.types:fuchsia.ui.types_rust",
"//src/lib/diagnostics/inspect/derive",
"//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/icu_data/rust/icu_data",
"//src/lib/syslog/rust:syslog",
"//src/lib/trace/rust:trace",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/settings/inspect_utils:settings_inspect_utils",
"//src/settings/storage:settings_storage",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:bitflags",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:glob",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:paste",
"//third_party/rust_crates:rust_icu_uenum",
"//third_party/rust_crates:rust_icu_uloc",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:thiserror",
]
test_configs = [
"//build/config/rust:codegen_units_16",
"//build/config/rust:lto_disabled",
]
test_deps = [
"//sdk/fidl/fuchsia.stash:fuchsia.stash_rust",
"//src/lib/storage/vfs/rust:vfs",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:pin-utils",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:test-case",
]
# TODO(fxbug.dev/61386): Fix the leaks and remove this
test_deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
sources = [
"src/accessibility.rs",
"src/accessibility/accessibility_controller.rs",
"src/accessibility/accessibility_fidl_handler.rs",
"src/accessibility/types.rs",
"src/agent.rs",
"src/agent/authority.rs",
"src/agent/camera_watcher.rs",
"src/agent/earcons.rs",
"src/agent/earcons/agent.rs",
"src/agent/earcons/bluetooth_handler.rs",
"src/agent/earcons/sound_ids.rs",
"src/agent/earcons/utils.rs",
"src/agent/earcons/volume_change_handler.rs",
"src/agent/inspect.rs",
"src/agent/inspect/external_apis.rs",
"src/agent/inspect/policy_values.rs",
"src/agent/inspect/setting_proxy.rs",
"src/agent/inspect/setting_values.rs",
"src/agent/inspect/usage_counts.rs",
"src/agent/media_buttons.rs",
"src/agent/restore_agent.rs",
"src/agent/storage_agent.rs",
"src/audio.rs",
"src/audio/audio_controller.rs",
"src/audio/audio_default_settings.rs",
"src/audio/audio_fidl_handler.rs",
"src/audio/policy.rs",
"src/audio/policy/audio_policy_handler.rs",
"src/audio/policy/volume_policy_fidl_handler.rs",
"src/audio/stream_volume_control.rs",
"src/audio/types.rs",
"src/audio/utils.rs",
"src/base.rs",
"src/clock.rs",
"src/config.rs",
"src/config/base.rs",
"src/config/default_settings.rs",
"src/display.rs",
"src/display/display_configuration.rs",
"src/display/display_controller.rs",
"src/display/display_fidl_handler.rs",
"src/display/light_sensor.rs",
"src/display/light_sensor_config.rs",
"src/display/light_sensor_controller.rs",
"src/display/types.rs",
"src/do_not_disturb.rs",
"src/do_not_disturb/do_not_disturb_controller.rs",
"src/do_not_disturb/do_not_disturb_fidl_handler.rs",
"src/do_not_disturb/types.rs",
"src/event.rs",
"src/factory_reset.rs",
"src/factory_reset/factory_reset_controller.rs",
"src/factory_reset/factory_reset_fidl_handler.rs",
"src/factory_reset/types.rs",
"src/handler.rs",
"src/handler/base.rs",
"src/handler/setting_handler.rs",
"src/handler/setting_handler_factory_impl.rs",
"src/handler/setting_proxy.rs",
"src/handler/setting_proxy_inspect_info.rs",
"src/ingress.rs",
"src/ingress/fidl.rs",
"src/ingress/policy_request.rs",
"src/ingress/request.rs",
"src/ingress/watch.rs",
"src/input.rs",
"src/input/common.rs",
"src/input/input_controller.rs",
"src/input/input_device_configuration.rs",
"src/input/input_fidl_handler.rs",
"src/input/types.rs",
"src/inspect.rs",
"src/inspect/config_logger.rs",
"src/inspect/listener_logger.rs",
"src/inspect/utils.rs",
"src/inspect/utils/enums.rs",
"src/intl.rs",
"src/intl/intl_controller.rs",
"src/intl/intl_fidl_handler.rs",
"src/intl/types.rs",
"src/job.rs",
"src/job/manager.rs",
"src/job/source.rs",
"src/keyboard.rs",
"src/keyboard/keyboard_controller.rs",
"src/keyboard/keyboard_fidl_handler.rs",
"src/keyboard/types.rs",
"src/lib.rs",
"src/light.rs",
"src/light/light_controller.rs",
"src/light/light_fidl_handler.rs",
"src/light/light_hardware_configuration.rs",
"src/light/types.rs",
"src/message.rs",
"src/message/action_fuse.rs",
"src/message/base.rs",
"src/message/beacon.rs",
"src/message/delegate.rs",
"src/message/message_builder.rs",
"src/message/message_client.rs",
"src/message/message_hub.rs",
"src/message/messenger.rs",
"src/message/receptor.rs",
"src/migration.rs",
"src/monitor.rs",
"src/monitor/base.rs",
"src/monitor/environment.rs",
"src/night_mode.rs",
"src/night_mode/night_mode_controller.rs",
"src/night_mode/night_mode_fidl_handler.rs",
"src/night_mode/types.rs",
"src/policy.rs",
"src/policy/policy_handler.rs",
"src/policy/policy_handler_factory_impl.rs",
"src/policy/policy_proxy.rs",
"src/privacy.rs",
"src/privacy/privacy_controller.rs",
"src/privacy/privacy_fidl_handler.rs",
"src/privacy/types.rs",
"src/service.rs",
"src/service_context.rs",
"src/setup.rs",
"src/setup/setup_controller.rs",
"src/setup/setup_fidl_handler.rs",
"src/setup/types.rs",
"src/storage.rs",
"src/storage_migrations.rs",
"src/task.rs",
"src/tests.rs",
"src/tests/accessibility_tests.rs",
"src/tests/agent_tests.rs",
"src/tests/audio_policy_handler_tests.rs",
"src/tests/audio_policy_tests.rs",
"src/tests/audio_tests.rs",
"src/tests/bluetooth_earcons_tests.rs",
"src/tests/camera_watcher_agent_tests.rs",
"src/tests/display_tests.rs",
"src/tests/environment_tests.rs",
"src/tests/event_tests.rs",
"src/tests/factory_reset_tests.rs",
"src/tests/fakes.rs",
"src/tests/fakes/audio_core_service.rs",
"src/tests/fakes/base.rs",
"src/tests/fakes/brightness_service.rs",
"src/tests/fakes/camera3_service.rs",
"src/tests/fakes/discovery_service.rs",
"src/tests/fakes/input_device_registry_service.rs",
"src/tests/fakes/recovery_policy_service.rs",
"src/tests/fakes/service_registry.rs",
"src/tests/fakes/sound_player_service.rs",
"src/tests/helpers.rs",
"src/tests/input_test_environment.rs",
"src/tests/input_tests.rs",
"src/tests/intl_tests.rs",
"src/tests/keyboard_tests.rs",
"src/tests/light_sensor_tests.rs",
"src/tests/media_buttons_agent_tests.rs",
"src/tests/message_tests.rs",
"src/tests/message_utils.rs",
"src/tests/policy_handler_tests.rs",
"src/tests/policy_proxy_tests.rs",
"src/tests/privacy_tests.rs",
"src/tests/resource_monitor_tests.rs",
"src/tests/restore_agent_tests.rs",
"src/tests/scaffold.rs",
"src/tests/scaffold/agent.rs",
"src/tests/scaffold/event.rs",
"src/tests/scaffold/workload.rs",
"src/tests/service_configuration_tests.rs",
"src/tests/setting_handler_tests.rs",
"src/tests/setting_proxy_tests.rs",
"src/tests/storage_agent_tests.rs",
"src/tests/stream_volume_tests.rs",
"src/tests/test_failure_utils.rs",
"src/trace.rs",
]
# -Copt-level=1 makes building the _test OOM on RBE with core.arm64-asan
# TODO(fxbug.dev/86896, fxbug.dev/85921): split this crate up to prevent OOM on RBE
disable_rbe = true
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
metrics_registry("setui_metrics_registry") {
project_id = 16
generate_rust = true
}
fuchsia_unittest_package("setui_service_tests") {
component_name = "settings_lib_test"
manifest = "meta/settings_lib_test.cml"
deps = [
":lib_test",
":setui_service_tests_resources",
":tests_config",
"//src/intl:icudtl",
]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
resource("setui_service_tests_resources") {
sources = [ "src/tests/testdata/test_store_data.store" ]
outputs = [ "data/{{source_file_part}}" ]
}
config_data("tests_config") {
for_pkg = "setui_service_tests"
sources = [
"src/tests/testdata/agent_configuration.json",
"src/tests/testdata/audio_config_data.json",
"src/tests/testdata/bluetooth-connected.wav",
"src/tests/testdata/bluetooth-disconnected.wav",
"src/tests/testdata/display_configuration.json",
"src/tests/testdata/fake_config_data.json",
"src/tests/testdata/fake_invalid_config_data.json",
"src/tests/testdata/interface_configuration.json",
"src/tests/testdata/service_flags.json",
"src/tests/testdata/volume-changed.wav",
"src/tests/testdata/volume-max.wav",
]
}
rustc_binary("bin") {
name = "setui_service"
with_unit_tests = true
edition = "2021"
deps = [
":lib",
"//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust",
"//sdk/fidl/fuchsia.stash:fuchsia.stash_rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/syslog/rust:syslog",
"//src/settings/storage:settings_storage",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:lazy_static",
]
test_deps = [
"//sdk/fidl/fuchsia.settings:fuchsia.settings_rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:parking_lot",
]
# TODO(fxbug.dev/61386): Fix the leaks and remove this
deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ]
sources = [ "src/main.rs" ]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_component("setui_service_v2") {
component_name = "setui_service"
manifest = "meta/setui_service.cml"
deps = [ ":bin" ]
}
fuchsia_component("setui_service_with_camera") {
component_name = "setui_service_with_camera"
manifest = "meta/setui_service_with_camera.cml"
deps = [ ":bin" ]
}
fuchsia_package("setui_service") {
visibility = []
visibility = [
":*",
"//:additional_base_packages",
"//:developer_base_packages",
"//:legacy_base_packages",
"//src/developer/forensics/feedback/tests/*",
"//src/intl/intl_services/tests/*",
]
deps = [
":setui_service_v2",
":setui_service_with_camera",
"//src/intl:icudtl",
]
}
# Core shard for products that don't have a camera.
core_shard("setui_service_core_shard") {
visibility = []
visibility = [
":*",
"//build/images/fuchsia:*",
"//bundles/assembly_input_groups:*",
"//vendor/google/*",
]
shard_file = "meta/setui_service.core_shard.cml"
}
# Core shard for products that have a camera.
core_shard("setui_service_with_camera_core_shard") {
visibility = []
visibility = [
":*",
"//build/images/fuchsia:*",
"//vendor/google/*",
]
shard_file = "meta/setui_service_with_camera.core_shard.cml"
}
rustc_binary("setui-config-test") {
testonly = true
edition = "2021"
output_name = "setui_config_test"
deps = [
":lib",
"//src/lib/syslog/rust:syslog",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
]
source_root = "src/setui_config_test.rs"
sources = [ "src/setui_config_test.rs" ]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
resource("sample-setui-config-test-resources") {
sources = [
"src/tests/testdata/agent_configuration.json",
"src/tests/testdata/audio_policy_configuration.json",
"src/tests/testdata/display_configuration.json",
"src/tests/testdata/input_device_configuration.json",
"src/tests/testdata/interface_configuration.json",
"src/tests/testdata/light_hardware_configuration.json",
"src/tests/testdata/light_sensor_configuration.json",
"src/tests/testdata/service_flags.json",
]
outputs = [ "data/{{source_file_part}}" ]
}
fuchsia_unittest_component("sample-setui-config-test-all-args") {
manifest = "meta/sample_setui_config_test_all_args.cml"
deps = [ ":setui-config-test" ]
}
fuchsia_unittest_component("sample-setui-config-test-multiple-args") {
manifest = "meta/sample_setui_config_test_multiple_args.cml"
deps = [ ":setui-config-test" ]
}
fuchsia_unittest_component("sample-setui-config-test-no-args") {
manifest = "meta/sample_setui_config_test_no_args.cml"
deps = [ ":setui-config-test" ]
}
fuchsia_unittest_component("sample-setui-config-test-short-args") {
manifest = "meta/sample_setui_config_test_short_args.cml"
deps = [ ":setui-config-test" ]
}
fuchsia_test_package("sample-setui-config-test") {
test_components = [
":sample-setui-config-test-all-args",
":sample-setui-config-test-multiple-args",
":sample-setui-config-test-no-args",
":sample-setui-config-test-short-args",
]
deps = [ ":sample-setui-config-test-resources" ]
}
group("tests") {
testonly = true
deps = [
":sample-setui-config-test",
":setui-config-test",
":setui_service_tests",
"integration_tests",
]
}