| # 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/config.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//src/sys/build/components.gni") |
| import("//src/sys/pkg/bin/omaha-client/omcl_policy_config.gni") |
| import("//third_party/cobalt/metrics_registry.gni") |
| |
| declare_args() { |
| # Default app id will always return no update. |
| omaha_app_id = "fuchsia-test:no-update" |
| } |
| omaha_app_id_file = "$root_gen_dir/omaha-app-id.txt" |
| write_file(omaha_app_id_file, omaha_app_id) |
| |
| rustc_binary("bin") { |
| name = "omaha-client-service" |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [ |
| ":mos_metrics_registry_rustlib", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc", |
| "//sdk/fidl/fuchsia.cobalt:fuchsia.cobalt-rustc", |
| "//sdk/fidl/fuchsia.feedback:fuchsia.feedback-rustc", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol-rustc", |
| "//sdk/fidl/fuchsia.pkg:fuchsia.pkg-rustc", |
| "//sdk/fidl/fuchsia.stash:fuchsia.stash-rustc", |
| "//sdk/fidl/fuchsia.ui.activity:fuchsia.ui.activity-rustc", |
| "//sdk/fidl/fuchsia.update:fuchsia.update-rustc", |
| "//sdk/fidl/fuchsia.update.channel:fuchsia.update.channel-rustc", |
| "//sdk/fidl/fuchsia.update.channelcontrol:fuchsia.update.channelcontrol-rustc", |
| "//src/lib/cobalt/rust:fuchsia-cobalt", |
| "//src/lib/diagnostics/inspect/contrib/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-hyper", |
| "//src/lib/fuchsia-url", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/lib/fidl-connector", |
| "//src/sys/pkg/fidl/fuchsia.update.installer:fuchsia.update.installer-rustc", |
| "//src/sys/pkg/lib/bounded-node", |
| "//src/sys/pkg/lib/event-queue", |
| "//src/sys/pkg/lib/fidl-fuchsia-update-ext", |
| "//src/sys/pkg/lib/fidl-fuchsia-update-installer-ext", |
| "//src/sys/pkg/lib/metrics:cobalt_sw_delivery_registry_rustlib", |
| "//src/sys/pkg/lib/omaha-client", |
| "//src/sys/pkg/lib/version", |
| "//third_party/cobalt/src/lib/client/rust:cobalt-client", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:hyper", |
| "//third_party/rust_crates:hyper-rustls", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| test_deps = [ |
| "//src/lib/testing/fuchsia-hyper-test-support", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/pkg/testing/mock-crash-reporter:lib", |
| "//third_party/rust_crates:matches", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:proptest", |
| ] |
| |
| sources = [ |
| "src/api_metrics.rs", |
| "src/channel.rs", |
| "src/cobalt.rs", |
| "src/configuration.rs", |
| "src/fidl.rs", |
| "src/http_request.rs", |
| "src/inspect.rs", |
| "src/install_plan.rs", |
| "src/installer.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", |
| "src/timer.rs", |
| ] |
| } |
| |
| fuchsia_component("omaha-client-service") { |
| manifest = "meta/omaha-client-service.cmx" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("omaha-client") { |
| deps = [ ":omaha-client-service" ] |
| } |
| |
| fuchsia_component("omaha-client-service-for-integration-test") { |
| testonly = true |
| manifest = "meta/omaha-client-service-for-integration-test.cmx" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_unittest_package("omaha-client-service-bin-tests") { |
| deps = [ |
| ":bin_test", |
| ":omaha-client-policy-config-for-test", |
| ] |
| manifest = "meta/omaha-client-service-bin-test.cmx" |
| } |
| |
| 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 |
| } |
| |
| config_data("omaha-client-config") { |
| for_pkg = "omaha-client" |
| outputs = [ "omaha_app_id" ] |
| sources = [ omaha_app_id_file ] |
| } |
| |
| config_data("omaha-client-test-config") { |
| testonly = true |
| for_pkg = "omaha-client-service-bin-tests" |
| outputs = [ "omaha_app_id" ] |
| sources = [ rebase_path("test_data/omaha_test_app_id") ] |
| } |
| |
| config_data("omaha-client-channels-test-config") { |
| testonly = true |
| for_pkg = "omaha-client-service-bin-tests" |
| outputs = [ "channel_config.json" ] |
| sources = [ rebase_path("test_data/test_channel_config.json") ] |
| } |
| |
| config_data("omaha-client-sysmgr-config") { |
| for_pkg = "sysmgr" |
| outputs = [ "omaha_client_sysmgr.config" ] |
| sources = [ "sysmgr.config" ] |
| } |
| |
| omcl_policy_config("omaha-client-policy-config-for-test") { |
| testonly = true |
| periodic_interval_minutes = 42 |
| startup_delay_seconds = 43 |
| retry_delay_seconds = 301 |
| for_pkg = "omaha-client-service-bin-tests" |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":omaha-client-channels-test-config", |
| ":omaha-client-service-bin-tests", |
| ":omaha-client-test-config", |
| "//src/sys/pkg/bin/fake-channel-control", |
| ] |
| } |