| # 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/rust/rustc_binary.gni") |
| |
| group("timekeeper") { |
| testonly = true |
| deps = [ |
| ":service", |
| ":tests", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":timekeeper-tests" ] |
| } |
| |
| timekeeper_deps = [ |
| # The generated structured config data schema. |
| ":timekeeper-config", |
| "//sdk/fidl/fuchsia.component:fuchsia.component_rust", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust", |
| "//sdk/fidl/fuchsia.hardware.rtc:fuchsia.hardware.rtc_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust", |
| "//sdk/fidl/fuchsia.power.broker:fuchsia.power.broker_rust", |
| "//sdk/fidl/fuchsia.power.system:fuchsia.power.system_rust", |
| "//sdk/fidl/fuchsia.time:fuchsia.time_rust", |
| "//sdk/fidl/fuchsia.time.external:fuchsia.time.external_rust", |
| "//src/lib/cobalt/rust/builders", |
| "//src/lib/diagnostics/inspect/runtime/rust", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fidl/rust/fidl-contrib", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-sync", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/time/lib/inspect-writable", |
| "//src/sys/time/lib/time-util", |
| "//src/sys/time/lib/time_metrics_registry", |
| "//third_party/cobalt/src/lib/client/rust:cobalt-client", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:chrono", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| timekeeper_sources = [ |
| "src/clock_manager.rs", |
| "src/diagnostics/cobalt.rs", |
| "src/diagnostics/composite.rs", |
| "src/diagnostics/fake.rs", |
| "src/diagnostics/inspect.rs", |
| "src/diagnostics/mod.rs", |
| "src/enums.rs", |
| "src/estimator/frequency.rs", |
| "src/estimator/kalman_filter.rs", |
| "src/estimator/mod.rs", |
| "src/main.rs", |
| "src/power_topology_integration.rs", |
| "src/rtc.rs", |
| "src/time_source.rs", |
| "src/time_source_manager.rs", |
| ] |
| |
| rustc_binary("bin") { |
| name = "timekeeper" |
| edition = "2021" |
| with_unit_tests = true |
| |
| deps = timekeeper_deps |
| |
| sources = timekeeper_sources |
| |
| test_deps = [ |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/fuchsia", |
| "//src/lib/test_util", |
| "//third_party/rust_crates:test-case", |
| ] |
| } |
| |
| rustc_binary("bin_with_fake_time") { |
| name = "timekeeper_fake_time" |
| edition = "2021" |
| with_unit_tests = false |
| testonly = true |
| |
| deps = timekeeper_deps |
| |
| sources = timekeeper_sources |
| |
| non_rust_deps = [ "//src/lib/fake-clock/lib" ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "timekeeper" |
| manifest = "meta/service.cml" |
| } |
| |
| fuchsia_structured_config_rust_lib("timekeeper-config") { |
| cm_label = ":manifest" |
| } |
| |
| fuchsia_component("service") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| # This package requires structured config from elsewhere. |
| fuchsia_package("timekeeper-without-config") { |
| package_name = "timekeeper" |
| validate_structured_config = false |
| deps = [ ":service" ] |
| } |
| |
| resource("testdata") { |
| sources = [ |
| "test/end-of-unix-time", |
| "test/y2k", |
| ] |
| outputs = [ "data/{{source_file_part}}" ] |
| } |
| |
| fuchsia_unittest_package("timekeeper-tests") { |
| manifest = "meta/unittests.cml" |
| deps = [ |
| ":bin_test", |
| ":testdata", |
| "//src/connectivity/network/dns:component", |
| "//src/connectivity/network/netstack3:component-dropin", |
| ] |
| test_specs = { |
| environments = [ nuc_env ] |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |