| # 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_library.gni") |
| import("//src/sys/pkg/bin/grand-swd-binary/gsb.gni") |
| import( |
| "//src/sys/pkg/scripts/gen_eager_package_config/eager_package_config.gni") |
| import("//third_party/cobalt/metrics_registry.gni") |
| |
| rustc_library("lib") { |
| name = "omaha_client_service" |
| with_unit_tests = true |
| edition = "2021" |
| |
| deps = [ |
| ":mos_metrics_registry_rustlib", |
| ":omaha-client-structured-config-lib", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_rust", |
| "//sdk/fidl/fuchsia.feedback:fuchsia.feedback_rust", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg_rust", |
| "//sdk/fidl/fuchsia.stash:fuchsia.stash_rust", |
| "//sdk/fidl/fuchsia.update:fuchsia.update_rust", |
| "//sdk/fidl/fuchsia.update.channel:fuchsia.update.channel_rust", |
| "//sdk/fidl/fuchsia.update.channelcontrol:fuchsia.update.channelcontrol_rust", |
| "//sdk/fidl/fuchsia.update.config:fuchsia.update.config_rust", |
| "//src/lib/cobalt/rust/builders", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fidl/rust/fidl-contrib", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/pkg/lib/bounded-node", |
| "//src/sys/pkg/lib/channel-config", |
| "//src/sys/pkg/lib/eager-package-config", |
| "//src/sys/pkg/lib/event-queue", |
| "//src/sys/pkg/lib/fidl-fuchsia-update-ext", |
| "//src/sys/pkg/lib/metrics:cobalt_sw_delivery_registry_rustlib", |
| "//src/sys/pkg/lib/omaha-client-fuchsia", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:omaha_client", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/fuchsia-url", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/pkg/testing/mock-crash-reporter:lib", |
| "//third_party/cobalt/src/lib/client/rust:cobalt-client", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:proptest", |
| ] |
| |
| source_root = "src/main.rs" |
| sources = [ |
| "src/api_metrics.rs", |
| "src/channel.rs", |
| "src/configuration.rs", |
| "src/feedback_annotation.rs", |
| "src/fidl.rs", |
| "src/inspect.rs", |
| "src/main.rs", |
| "src/metrics.rs", |
| "src/observer.rs", |
| "src/observer/crash_report.rs", |
| "src/observer/platform.rs", |
| "src/policy.rs", |
| "src/policy/rate_limiter.rs", |
| "src/storage.rs", |
| "src/storage/stash.rs", |
| ] |
| |
| visibility = [ |
| ":*", |
| "//src/sys/pkg/bin/grand-swd-binary:*", |
| ] |
| configs += [ "//build/config/rust/lints:clippy_warn_all" ] |
| } |
| |
| grand_swd_binary("bin") { |
| output_name = "omaha_client_service" |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "omaha-client-service" |
| manifest = "meta/omaha-client-service.cml" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("omaha-client-unconfigured") { |
| deps = [ ":component" ] |
| validate_structured_config = false |
| package_name = "omaha-client" |
| } |
| |
| fuchsia_package("omaha-client") { |
| deps = [ |
| ":component", |
| ":omaha-client-structured-config", |
| ] |
| } |
| |
| fuchsia_component("omaha-client-service-bin-tests-test-driver") { |
| testonly = true |
| component_name = "test-driver" |
| manifest = "meta/test-driver.cml" |
| deps = [ ":lib_test" ] |
| } |
| |
| fuchsia_unittest_package("omaha-client-service-bin-tests") { |
| manifest = "meta/omaha-client-service-bin-test.cml" |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| test_type = "system" |
| } |
| } |
| deps = [ |
| ":omaha-client-channels-test-config", |
| ":omaha-client-service-bin-tests-test-driver", |
| ":omaha-client-structured-config", |
| "//src/connectivity/network:netstack-for-tests", |
| "//src/connectivity/network/dns:component", |
| "//src/power/shutdown-shim/tests:shutdown_shim_component", |
| "//src/sys/pkg/bin/fake-channel-control:fake-channel-control", |
| "//src/sys/stash:stash2_v2", |
| ] |
| } |
| |
| metrics_registry("mos_metrics_registry") { |
| # This must match the ID of our Cobalt project as specified in: |
| # third_party/cobalt_config/projects.yaml |
| project_id = 285903809 |
| generate_rust = true |
| generate_binarypb = false |
| } |
| |
| resource("omaha-client-channels-test-config") { |
| testonly = true |
| outputs = |
| [ "test-config-data/omaha-client-service-bin-tests/channel_config.json" ] |
| sources = [ "test_data/test_channel_config.json" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":omaha-client-channels-test-config", |
| ":omaha-client-service-bin-tests", |
| ] |
| } |
| |
| fuchsia_structured_config_values("omaha-client-structured-config") { |
| cm_label = ":manifest" |
| values_source = "configs/default.json5" |
| } |
| |
| fuchsia_structured_config_values("omaha-client-structured-config-no-restart") { |
| cm_label = ":manifest" |
| values_source = "configs/no-restart.json5" |
| } |
| |
| fuchsia_structured_config_values( |
| "omaha-client-structured-config-delayed-start") { |
| cm_label = ":manifest" |
| values_source = "configs/delayed-start.json5" |
| } |
| |
| fuchsia_structured_config_rust_lib("omaha-client-structured-config-lib") { |
| name = "omaha_client_structured_config" |
| cm_label = ":manifest" |
| } |
| |
| eager_package_config("empty_eager_package_config") { |
| key_config = "test_data/key_config.json" |
| sources = [] |
| } |