| # 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") | 
 |  | 
 | timekeeper_deps = [ | 
 |   "//sdk/fidl/fuchsia.deprecatedtimezone:fuchsia.deprecatedtimezone-rustc", | 
 |   "//sdk/fidl/fuchsia.hardware.rtc:fuchsia.hardware.rtc-rustc", | 
 |   "//sdk/fidl/fuchsia.time:fuchsia.time-rustc", | 
 |   "//sdk/fidl/fuchsia.time.external:fuchsia.time.external-rustc", | 
 |   "//src/lib/async-utils", | 
 |   "//src/lib/cobalt/rust:fuchsia-cobalt", | 
 |   "//src/lib/diagnostics/inspect/derive", | 
 |   "//src/lib/diagnostics/inspect/rust", | 
 |   "//src/lib/diagnostics/inspect/rust", | 
 |   "//src/lib/fdio/rust:fdio", | 
 |   "//src/lib/fidl/rust/fidl", | 
 |   "//src/lib/fuchsia-async", | 
 |   "//src/lib/fuchsia-component", | 
 |   "//src/lib/syslog/rust:syslog", | 
 |   "//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/rust_crates:anyhow", | 
 |   "//third_party/rust_crates:argh", | 
 |   "//third_party/rust_crates:async-trait", | 
 |   "//third_party/rust_crates:chrono", | 
 |   "//third_party/rust_crates:futures", | 
 |   "//third_party/rust_crates:itertools", | 
 |   "//third_party/rust_crates:lazy_static", | 
 |   "//third_party/rust_crates:log", | 
 |   "//third_party/rust_crates:parking_lot", | 
 |   "//third_party/rust_crates:thiserror", | 
 | ] | 
 |  | 
 | 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.rs", | 
 |   "src/main.rs", | 
 |   "src/rtc.rs", | 
 |   "src/time_source.rs", | 
 |   "src/time_source_manager.rs", | 
 | ] | 
 |  | 
 | rustc_binary("bin") { | 
 |   name = "timekeeper" | 
 |   edition = "2018" | 
 |   with_unit_tests = true | 
 |  | 
 |   deps = timekeeper_deps | 
 |  | 
 |   sources = timekeeper_sources | 
 |  | 
 |   test_deps = [ | 
 |     "//sdk/fidl/fuchsia.cobalt:fuchsia.cobalt-rustc", | 
 |     "//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network-rustc", | 
 |     "//sdk/fidl/fuchsia.net:fuchsia.net-rustc", | 
 |     "//src/connectivity/lib/net-declare", | 
 |     "//src/lib/test_util", | 
 |   ] | 
 | } | 
 |  | 
 | rustc_binary("bin_with_fake_time") { | 
 |   name = "timekeeper_fake_time" | 
 |   edition = "2018" | 
 |   with_unit_tests = false | 
 |   testonly = true | 
 |  | 
 |   deps = timekeeper_deps | 
 |  | 
 |   sources = timekeeper_sources | 
 |  | 
 |   non_rust_deps = [ "//src/lib/fake-clock/lib" ] | 
 | } | 
 |  | 
 | fuchsia_component("service") { | 
 |   component_name = "timekeeper" | 
 |   manifest = "meta/service.cmx" | 
 |   deps = [ | 
 |     ":bin", | 
 |     ":timekeeper_config", | 
 |   ] | 
 | } | 
 |  | 
 | fuchsia_package("timekeeper") { | 
 |   deps = [ ":service" ] | 
 | } | 
 |  | 
 | config_data("timekeeper_config") { | 
 |   for_pkg = "sysmgr" | 
 |   outputs = [ "timekeeper.config" ] | 
 |   sources = [ "service.config" ] | 
 | } | 
 |  | 
 | resource("testdata") { | 
 |   sources = [ | 
 |     "test/end-of-unix-time", | 
 |     "test/y2k", | 
 |   ] | 
 |   outputs = [ "data/{{source_file_part}}" ] | 
 | } | 
 |  | 
 | fuchsia_unittest_package("timekeeper-tests") { | 
 |   manifest = "meta/unittests.cmx" | 
 |   deps = [ | 
 |     ":bin_test", | 
 |     ":testdata", | 
 |   ] | 
 |   test_specs = { | 
 |     environments = [ nuc_env ] | 
 |   } | 
 | } | 
 |  | 
 | group("tests") { | 
 |   testonly = true | 
 |   deps = [ ":timekeeper-tests" ] | 
 | } |