blob: d2ed4763631fafa1434b6b851f17505ad1ca1781 [file] [log] [blame]
# 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/dist/component_manifest_resources.gni")
import("//build/fuzzing/fuzzer.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_fuzzer.gni")
import("//build/rust/rustc_library.gni")
import("//src/sys/build/components.gni")
rustc_library("lib") {
name = "archivist_lib"
with_unit_tests = true
edition = "2018"
deps = [
"fidl:controller-rustc",
"//garnet/lib/rust/files_async",
"//garnet/lib/rust/io_util",
"//sdk/fidl/fuchsia.boot:fuchsia.boot-rustc",
"//sdk/fidl/fuchsia.component:fuchsia.component-rustc",
"//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics-rustc",
"//sdk/fidl/fuchsia.diagnostics.stream:fuchsia.diagnostics.stream-rustc",
"//sdk/fidl/fuchsia.inspect:fuchsia.inspect-rustc",
"//sdk/fidl/fuchsia.inspect.deprecated:fuchsia.inspect.deprecated-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc",
"//sdk/fidl/fuchsia.mem:fuchsia.mem-rustc",
"//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle-rustc",
"//sdk/fidl/fuchsia.sys.internal:fuchsia.sys.internal-rustc",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc",
"//src/diagnostics/lib/inspect-fidl-load",
"//src/diagnostics/lib/selectors",
"//src/diagnostics/lib/validating-log-listener",
"//src/lib/diagnostics/data/rust",
"//src/lib/diagnostics/hierarchy/rust",
"//src/lib/diagnostics/inspect/contrib/rust",
"//src/lib/diagnostics/inspect/derive",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/diagnostics/stream/rust",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fidl_table_validation",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-runtime",
"//src/lib/storage/fuchsia-watch",
"//src/lib/storage/vfs/rust:vfs",
"//src/lib/syslog/rust:syslog",
"//src/lib/syslog/rust:syslog-listener",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/lib/zircon/rust:fuchsia-zircon-status",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:byteorder",
"//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:libc",
"//third_party/rust_crates:parking_lot",
"//third_party/rust_crates:paste",
"//third_party/rust_crates:pin-project",
"//third_party/rust_crates:pin-utils",
"//third_party/rust_crates:pretty_assertions",
"//third_party/rust_crates:proptest",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:tempfile",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
test_deps = [ "//third_party/rust_crates:matches" ]
sources = [
"src/accessor.rs",
"src/archive.rs",
"src/archivist.rs",
"src/configs.rs",
"src/constants.rs",
"src/container.rs",
"src/diagnostics.rs",
"src/error.rs",
"src/events/error.rs",
"src/events/mod.rs",
"src/events/source_registry.rs",
"src/events/sources/core.rs",
"src/events/sources/legacy.rs",
"src/events/sources/log_connector.rs",
"src/events/sources/mod.rs",
"src/events/sources/static_event_stream.rs",
"src/events/sources/unattributed_log_sink.rs",
"src/events/types.rs",
"src/formatter.rs",
"src/inspect/collector.rs",
"src/inspect/container.rs",
"src/inspect/mod.rs",
"src/lib.rs",
"src/lifecycle/container.rs",
"src/lifecycle/mod.rs",
"src/logs/budget.rs",
"src/logs/buffer.rs",
"src/logs/buffer/arc_list.rs",
"src/logs/container.rs",
"src/logs/debuglog.rs",
"src/logs/error.rs",
"src/logs/listener.rs",
"src/logs/listener/asbestos.rs",
"src/logs/listener/filter.rs",
"src/logs/message.rs",
"src/logs/mod.rs",
"src/logs/redact.rs",
"src/logs/redact/serialize.rs",
"src/logs/socket.rs",
"src/logs/stats.rs",
"src/logs/testing.rs",
"src/pipeline.rs",
"src/repository.rs",
]
}
rustc_binary("bin") {
name = "archivist"
with_unit_tests = true
edition = "2018"
force_opt = "z"
# Archivist must always be small (even in debug builds) since it is part of bootfs.
#
# The add/remove/add ensures we get the configuration without producing errors for builds which
# enable ThinLTO themselves.
configs += [ "//build/config/lto:thinlto" ]
configs -= [ "//build/config/lto:thinlto" ]
configs += [ "//build/config/lto:thinlto" ]
# we can't dynamically link std when we're in the zbi :(
configs -= [ "//build/config/fuchsia:dynamic_rust_standard_library" ]
deps = [
":lib",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc",
"//sdk/fidl/fuchsia.sys.internal:fuchsia.sys.internal-rustc",
"//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc",
"//src/diagnostics/lib/selectors",
"//src/lib/fdio/rust:fdio",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-runtime",
"//src/lib/syslog/rust:syslog",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:argh",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
sources = [ "src/main.rs" ]
}
fuchsia_component("archivist-with-klog") {
manifest = "meta/archivist-with-klog.cmx"
deps = [
":bin",
":embedding-config-file",
]
}
fuchsia_component("archivist-for-embedding-v1") {
component_name = "archivist-for-embedding"
manifest = "meta/archivist-for-embedding.cmx"
deps = [
":bin",
":embedding-config-file",
]
}
fuchsia_component("archivist-for-embedding-v2") {
component_name = "archivist-for-embedding"
manifest = "meta/archivist-for-embedding.cml"
deps = [
":bin",
":embedding-config-file",
]
}
component_manifest_resources("root-manifest") {
sources = [ "meta/archivist.cml" ]
}
resource("root-config") {
sources = [ "configs/root-config.json" ]
outputs = "config/archivist/archivist_config.json"
}
resource("default-service-config") {
sources = [ "configs/default-service-config.json" ]
outputs = "config/archivist/archivist_service_config.json"
}
resource("no-detect-service-config") {
sources = [ "configs/no-detect-service-config.json" ]
outputs = "config/archivist/archivist_service_config.json"
}
group("bootfs") {
deps = [
":bin",
":root-config",
":root-manifest",
]
}
fuchsia_package("archivist-for-embedding") {
deps = [
":archivist-for-embedding-v1",
":archivist-for-embedding-v2",
":archivist-with-klog",
]
}
resource("embedding-config-file") {
sources = [ "configs/embedding-config.json" ]
outputs = "data/{{source_file_part}}"
}
group("with_default_config") {
}
rustc_fuzzer("convert_debuglog_to_log_message_fuzzer") {
deps = [
":lib",
"//src/lib/fuzzing/rust:fuzz",
"//src/lib/syslog/rust:syslog",
"//zircon/system/ulib/syslog",
]
non_rust_deps = []
source_root = "src/fuzzer.rs"
sources = [ "src/fuzzer.rs" ]
}
fuzzers_package("archivist-fuzzers") {
rust_fuzzers = [ ":convert_debuglog_to_log_message_fuzzer" ]
}
fuchsia_unittest_component("archivist-unittests") {
manifest = "meta/archivist_tests.cmx"
deps = [ ":lib_test" ]
}
fuchsia_test_package("archivist-tests") {
test_components = [ ":archivist-unittests" ]
}
group("archivist") {
testonly = true
deps = [
":archivist-for-embedding",
":bootfs",
":tests",
]
}
group("tests") {
testonly = true
public_deps = [
":archivist-fuzzers",
":archivist-tests",
"bench",
"tests",
]
}