| # 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/cpp/sdk_shared_library.gni") |
| import("//build/cpp/sdk_source_set.gni") |
| import("//build/cpp/sdk_static_library.gni") |
| import("//build/test.gni") |
| |
| sdk_source_set("cpp") { |
| # TODO(https://fxbug.dev/42138060): Remove when Mac links OK against this. |
| if ((current_toolchain == "//build/toolchain:host_x64" && host_os == "mac") || |
| (current_toolchain == "//build/toolchain:host_arm64" && |
| host_os == "mac")) { |
| build_as_static = true |
| } |
| |
| # Keep internal for now until the API stabilizes. |
| category = "internal" |
| |
| sdk_name = "syslog_cpp" |
| |
| include_base = "//sdk" |
| |
| public_deps = [ |
| "//sdk/lib/fit-promise", |
| "//sdk/lib/stdcompat", |
| ] |
| |
| sources = [ |
| "log_level.h", |
| "log_settings.cc", |
| "log_settings.h", |
| "logging_backend.h", |
| "macros.cc", |
| "macros.h", |
| ] |
| |
| if (is_fuchsia) { |
| sources += [ |
| "logging_backend_fuchsia.cc", |
| "logging_backend_fuchsia_globals.h", |
| ] |
| |
| deps = [ |
| ":backend_fuchsia_globals", |
| "//sdk/fidl/fuchsia.diagnostics.stream:fuchsia.diagnostics.stream_hlcpp", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger_hlcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/stdcompat", |
| "//sdk/lib/syslog/structured_backend", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/sync", |
| ] |
| |
| public_deps += [ "//zircon/system/ulib/zx" ] |
| } else { |
| sources += [ |
| "host/encoder.cc", |
| "host/encoder.h", |
| "host/logging_backend.cc", |
| ] |
| } |
| public_configs = [ "//sdk/config" ] |
| } |
| |
| # TODO(b/300157652): Transitional no-op target |
| # Remove once all drivers have been migrated off |
| # syslog. |
| group("backend") { |
| visibility = [ |
| "//src/camera/drivers/hw_accel/ge2d:*", |
| "//src/media/drivers/amlogic_decoder:*", |
| "//src/storage/fvm/driver:*", |
| "//vendor/*", |
| ] |
| } |
| |
| # TODO(b/300157652): Transitional no-op target |
| group("backend_host") { |
| deps = [ ":cpp" ] |
| } |
| |
| sdk_shared_library("backend_fuchsia_globals") { |
| category = "partner" |
| |
| libcxx_linkage = "static" |
| |
| include_base = "//sdk" |
| |
| symbols_api = "backend_fuchsia_globals.ifs" |
| |
| sources = [ |
| "logging_backend_fuchsia_globals.cc", |
| "logging_backend_fuchsia_globals.h", |
| ] |
| |
| deps = [ "//src/zircon/lib/zircon" ] |
| } |
| |
| # TODO(b/300157652): Transitional no-op target. This will be removed when |
| # all targets have migrated to the newer build rules. |
| # This is needed for now to bring the implicit offer |
| # CML rules in client_includes, and to serve as a backend |
| # target for other repositories until the transition is finished |
| # (so they can be soft-transitioned). |
| sdk_source_set("backend_fuchsia_lib") { |
| category = "internal" |
| |
| sdk_name = "syslog_cpp_backend_fuchsia_lib" |
| |
| include_base = "//sdk" |
| |
| data_deps = [ "//sdk/lib/syslog:client_includes" ] |
| deps = [ ":cpp" ] |
| } |
| |
| test("logging_cpp_unittests") { |
| sources = [ |
| "host/encoder.h", |
| "log_settings_unittest.cc", |
| "logging_unittest.cc", |
| ] |
| deps = [ |
| ":cpp", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/uuid", |
| "//third_party/googletest:gmock", |
| "//third_party/googletest:gtest", |
| ] |
| if (is_fuchsia) { |
| deps += [ |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_hlcpp", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger_hlcpp", |
| "//src/diagnostics/lib/cpp-log-tester:cpp-log-tester", |
| "//src/lib/diagnostics/accessor2logger", |
| "//src/lib/fsl", |
| "//third_party/rapidjson", |
| "//zircon/system/ulib/async", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| ] |
| } |
| } |
| |
| test("logging_cpp_unittests_structured") { |
| sources = [ "log_structure_unittest.cc" ] |
| |
| deps = [ |
| ":cpp", |
| "//src/lib/files", |
| "//src/lib/fxl/test:gtest_main", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| fuchsia_unittest_component("logging-cpp-unittests") { |
| manifest = "meta/logging_cpp_unittests.cml" |
| deps = [ ":logging_cpp_unittests" ] |
| } |
| |
| fuchsia_unittest_component("logging-cpp-unittests-structured") { |
| deps = [ ":logging_cpp_unittests_structured" ] |
| } |
| |
| fuchsia_test_package("logging-cpp-tests") { |
| test_components = [ |
| ":logging-cpp-unittests", |
| ":logging-cpp-unittests-structured", |
| ] |
| test_specs = { |
| log_settings = { |
| max_severity = "FATAL" |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":logging-cpp-tests", |
| ":logging_cpp_unittests($host_toolchain)", |
| ] |
| } |