| # Copyright 2020 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") |
| import("//src/sys/core/build/core_shard.gni") |
| |
| executable("bin") { |
| output_name = "build_info" |
| sources = [ |
| "build_info.cc", |
| "build_info.h", |
| "main.cc", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.buildinfo:fuchsia.buildinfo_hlcpp", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fsl", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| rustc_binary("shell_bin") { |
| name = "build-info" |
| edition = "2021" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.buildinfo:fuchsia.buildinfo_rust", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| ] |
| |
| sources = [ "shell.rs" ] |
| source_root = "shell.rs" |
| } |
| |
| fuchsia_component("build-info") { |
| manifest = "meta/build_info.cml" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("build-info-service") { |
| deps = [ ":build-info" ] |
| } |
| |
| fuchsia_shell_package("build-info-shell") { |
| manifest = "meta/build_info_shell.cml" |
| deps = [ ":shell_bin" ] |
| } |
| |
| core_shard("build_info_core_shard") { |
| shard_file = "meta/build_info.core_shard.cml" |
| } |
| |
| executable("test-bin") { |
| testonly = true |
| output_name = "build_info_unittest" |
| sources = [ |
| "build_info.cc", |
| "build_info.h", |
| "build_info_unittest.cc", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.buildinfo:fuchsia.buildinfo_hlcpp", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/sys/cpp/testing:unit", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/loop_fixture", |
| ] |
| } |
| |
| fuchsia_unittest_package("build-info-unittest") { |
| deps = [ ":test-bin" ] |
| test_specs = { |
| # Tests may produce ERROR logs when validating behavior in scenarios where |
| # build-info is not present (e.g. not allowlisted). |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":build-info-unittest" ] |
| } |