blob: d0252ec39c211c37dd29b633dab262a18ccff78a [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/config.gni")
import("//build/package.gni")
import("//build/rust/rustc_binary.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.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",
"//garnet/lib/rust/sysconfig-client",
"//garnet/public/rust/fuchsia-hyper",
"//sdk/fidl/fuchsia.stash:fuchsia.stash-rustc",
"//sdk/fidl/fuchsia.sys:fuchsia.sys-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/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-url",
"//src/lib/inspect/rust/fuchsia-inspect",
"//src/lib/inspect/rust/fuchsia-inspect-contrib",
"//src/lib/syslog/rust:syslog",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/pkg/fidl/fuchsia.update.installer:fuchsia.update.installer-rustc",
"//src/sys/pkg/lib/event-queue",
"//src/sys/pkg/lib/omaha-client",
"//src/sys/pkg/lib/system-health-check",
"//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",
"//zircon/system/fidl/fuchsia-boot:fuchsia-boot-rustc",
"//zircon/system/fidl/fuchsia-cobalt:fuchsia-cobalt-rustc",
"//zircon/system/fidl/fuchsia-device-manager:fuchsia-device-manager-rustc",
]
test_deps = [
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:matches",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:pretty_assertions",
]
non_rust_deps =
[ "//zircon/system/ulib/sysconfig-client:sysconfig-sync-client-c" ]
}
package("omaha-client") {
deps = [ ":bin" ]
binaries = [
{
name = "omaha_client_service"
dest = "omaha-client-service"
},
]
meta = [
{
path = rebase_path("meta/omaha-client-service.cmx")
dest = "omaha-client-service.cmx"
},
]
}
test_package("omaha-client-service-bin-tests") {
deps = [ ":bin_test" ]
tests = [
{
name = "omaha_client_service_bin_test"
dest = "omaha-client-service-bin-test"
environments = basic_envs
},
]
}
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" ]
}
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",
]
}