blob: 7608352abb4df71ce32dfeac65234afb091f0242 [file] [log] [blame]
# Copyright 2021 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_staticlib.gni")
import("//build/test.gni")
import("//build/testing/cc_test_executable.gni")
cc_test_executable("cpp-log-decoder-unittest") {
testonly = true
sources = [ "test.cc" ]
deps = [
":staticlib",
"//sdk/lib/syslog/cpp",
"//src/lib/fxl/test:gtest_main",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
"//third_party/rapidjson",
]
}
_sources = [ "src/lib.rs" ]
_deps = [
"//src/lib/diagnostics/log/encoding/rust",
"//src/lib/diagnostics/log/message/rust",
"//third_party/rust_crates:bumpalo",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:thiserror",
]
# NOTE: It isn't currently possible to link to more than one rustc_staticlib; it results in
# duplicate definition linker errors on LTO builds. To workaround this, log_decoder_c_bindings is
# included in the fake-log-sink rustc static library, which is then used by the C++ fake-log-sink
# library.
rustc_library("lib") {
visibility = [ "//src/lib/diagnostics/fake-log-sink/rust:*" ]
name = "log_decoder_c_bindings"
with_unit_tests = true
edition = "2024"
sources = _sources
deps = _deps
}
# Use this target if you need both fake-log-sink and cpp-log-decoder (see comment above).
source_set("headers") {
testonly = true
sources = [ "log_decoder.h" ]
deps = [ "//src/lib/diagnostics/fake-log-sink/rust:rust_ffi" ]
}
rustc_staticlib("staticlib") {
name = "log_decoder_c_bindings"
with_unit_tests = true
edition = "2024"
sources = _sources
public = [ "log_decoder.h" ]
deps = _deps
test_deps = [
"//sdk/fidl/fuchsia.logger:fuchsia.logger_rust",
"//third_party/rust_crates:serde",
]
}
fuchsia_unittest_package("cpp-log-decoder-tests") {
deps = [ ":cpp-log-decoder-unittest" ]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
deps = [ ":cpp-log-decoder-tests" ]
}