blob: 2d99b97befd97bcfaeb80a2883a4c082afcba0b4 [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/config.gni")
import("//build/rust/rustc_library.gni")
import("//src/sys/core/build/core_shard.gni")
import("//src/sys/pkg/bin/grand-swd-binary/gsb.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)
core_shard("omaha-client-service-core-shard") {
shard_file = "meta/omaha_client_service.core_shard.cml"
}
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-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",
"//sdk/fidl/fuchsia.update.config:fuchsia.update.config-rustc",
"//src/lib/cobalt/rust:fuchsia-cobalt",
"//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-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/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/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",
# TODO(https://fxbug.dev/103361): Migrate this crate away from log.
"//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:assert_matches",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:pretty_assertions",
"//third_party/rust_crates:proptest",
]
source_root = "src/main.rs"
sources = [
"src/api_metrics.rs",
"src/app_set.rs",
"src/channel.rs",
"src/cobalt.rs",
"src/configuration.rs",
"src/feedback_annotation.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",
]
visibility = [
":*",
"//src/sys/pkg/bin/grand-swd-binary:*",
]
}
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") {
deps = [
":component",
":omaha-client-structured-config",
]
}
# TODO(fxbug.dev/92844): Remove these extra packages when migrating to
# structured configuration.
fuchsia_package("omaha-client-no-restart") {
deps = [
":component",
":omaha-client-structured-config-no-restart",
]
package_name = "omaha-client"
}
fuchsia_package("omaha-client-delayed-start") {
deps = [
":component",
":omaha-client-structured-config-delayed-start",
]
package_name = "omaha-client"
}
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"
}
}
deps = [
":omaha-client-channels-test-config",
":omaha-client-service-bin-tests-test-driver",
":omaha-client-structured-config",
":omaha-client-test-config",
"//src/connectivity/network/dns:component",
"//src/connectivity/network/netstack: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
}
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") ]
}
group("tests") {
testonly = true
public_deps = [
":omaha-client-channels-test-config",
":omaha-client-service-bin-tests",
":omaha-client-test-config",
]
}
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"
}