blob: 2db2c8087f469068adc68d1634c9858f5169e758 [file] [log] [blame]
# Copyright 2018 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_library.gni")
import("//build/rust/rustc_test.gni")
rust_fuchsia_syslog_visibility_allowlist = [
# ________ _________ ________ ________
# |\ ____\|\___ ___\\ __ \|\ __ \
# \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \
# \ \_____ \ \ \ \ \ \ \\\ \ \ ____\
# \|____|\ \ \ \ \ \ \ \\\ \ \ \___|
# ____\_\ \ \ \__\ \ \_______\ \__\
# |\_________\ \|__| \|_______|\|__|
# \|_________|
#
# This is an allowlist of targets that use the deprecated `fuchsia_syslog` Rust library.
# Rust libraries should now be using `diagnostics_log` either directly or through the `fuchsia`
# crate.
#
# Developers are encouraged to migrate to use the `diagnostics_log` and `tracing` libraries
# instead which bring structured logging support.
#
# The policy at this time is:
# 1. Pre-existing use of fuchsia_syslog in fuchsia.git is allowlisted.
# 2. Use of fuchsia_syslog in new libraries and binaries is strongly discouraged and only allowed
# under special circumstances under which the new library isn't covering the needs.
#
# To add items to the allowlist, please send a change to one of the OWNERS of
# this file to add an element to the visibility list below.
# Please allowlist entire directories rather than individual targets as it
# requires less allowlist churn over time.
#
# To regenerate:
# fx gn refs $(fx get-build-dir) //src/lib/syslog/rust:syslog //src/lib/syslog/rust:rust | grep -v "//src/lib/syslog/rust" | sed 's|\(.*:\).*|"\1*",|' | sort | uniq
"//examples/diagnostics/logs/rust:*",
"//src/sys/run_test_component/test:*",
"//src/bringup/bin/pwrbtn-monitor/test:*",
"//src/cobalt/bin/testing/mock_cobalt:*",
"//src/connectivity/bluetooth/core/bt-init:*",
"//src/connectivity/bluetooth/examples/bt-device-id-client:*",
"//src/connectivity/bluetooth/lib/fuchsia-audio-codec:*",
"//src/connectivity/bluetooth/profiles/bt-a2dp:*",
"//src/connectivity/bluetooth/profiles/bt-avrcp-target:*",
"//src/connectivity/bluetooth/profiles/bt-device-id:*",
"//src/connectivity/bluetooth/profiles/bt-peripheral-hub:*",
"//src/connectivity/bluetooth/profiles/tests/bt-a2dp-loopback:*",
"//src/connectivity/bluetooth/testing/bt-test-harness:*",
"//src/connectivity/bluetooth/testing/mock-piconet-server:*",
"//src/connectivity/bluetooth/testing/test-call-manager:*",
"//src/connectivity/bluetooth/testing/test-harness:*",
"//src/connectivity/bluetooth/testing/test-rfcomm-client:*",
"//src/connectivity/bluetooth/tests/audio-device-output-harness:*",
"//src/connectivity/bluetooth/tests/bt-manifest-integration-tests:*",
"//src/connectivity/bluetooth/tools/bt-avdtp-tool:*",
"//src/connectivity/bluetooth/tools/bt-bredr-profile:*",
"//src/connectivity/bluetooth/tools/bt-snoop:*",
"//src/connectivity/location/emergency:*",
"//src/connectivity/location/regulatory_region:*",
"//src/connectivity/location/regulatory_region/tests:*",
"//src/connectivity/lowpan/drivers/lowpan-dummy-driver:*",
"//src/connectivity/lowpan/drivers/lowpan-ot-driver:*",
"//src/connectivity/lowpan/drivers/lowpan-spinel-driver:*",
"//src/connectivity/lowpan/drivers/lowpan-spinel-driver/tests/lib:*",
"//src/connectivity/lowpan/drivers/lowpan-spinel-driver/tests/test-code:*",
"//src/connectivity/lowpan/drivers/lowpan-spinel-driver/tests/test-components:*",
"//src/connectivity/lowpan/lib/lowpan_driver_common:*",
"//src/connectivity/lowpan/lib/openthread_fuchsia:*",
"//src/connectivity/lowpan/lib/openthread_rust:*",
"//src/connectivity/lowpan/service:*",
"//src/connectivity/lowpan/tools/lowpanctl:*",
"//src/connectivity/openthread/tests/lib:*",
"//src/connectivity/openthread/tests/test-code:*",
"//src/connectivity/openthread/tests/test-components:*",
"//src/connectivity/overnet/lib/hoist:*",
"//src/connectivity/overnet/tools/debug-serial:*",
"//src/connectivity/ppp/lib/ppp_packet:*",
"//src/connectivity/ppp/lib/ppp_protocol:*",
"//src/connectivity/telephony/ril-at:*",
"//src/connectivity/telephony/ril-qmi:*",
"//src/connectivity/telephony/telephony:*",
"//src/connectivity/telephony/telephony-snooper:*",
"//src/connectivity/telephony/tests/component-integration/fake-at-driver-test:*",
"//src/connectivity/telephony/tests/component-integration/fake-at-query:*",
"//src/connectivity/telephony/tests/component-integration/fake-qmi-query:*",
"//src/connectivity/telephony/tests/component-integration/snooper:*",
"//src/connectivity/telephony/tools/tel-snoop-cli:*",
"//src/connectivity/weave/tests/weave_ip_forward:*",
"//src/connectivity/wlan/lib/mlme/rust:*",
"//src/connectivity/wlan/lib/stash:*",
"//src/connectivity/wlan/testing/hw-sim:*",
"//src/connectivity/wlan/testing/hw-sim/test/handle_tx_event_hooks:*",
"//src/connectivity/wlan/testing/hw-sim/test/reconnect_to_wpa2_network:*",
"//src/connectivity/wlan/testing/wlan-service-util:*",
"//src/connectivity/wlan/wlancfg:*",
"//src/connectivity/wlan/wlandevicemonitor:*",
"//src/connectivity/wlan/wlanstack:*",
"//src/developer/remote-control:*",
"//src/developer/remote-control/diagnostics-bridge:*",
"//src/developer/remote-control/testing/mock-sys-launcher:*",
"//src/devices/bin/driver-index:*",
"//src/diagnostics/archivist:*",
"//src/diagnostics/archivist/tests/logs-connector:*",
"//src/diagnostics/archivist/tests/v2:*",
"//src/diagnostics/iquery:*",
"//src/diagnostics/validator/logs/sink:*",
"//src/factory/factory_store_providers:*",
"//src/factory/fake_factory_store_providers:*",
"//src/firmware/bin/vboot-fwparam:*",
"//src/firmware/fastboot-tcp:*",
"//src/fonts:*",
"//src/fonts/testing/mock_font_resolver:*",
"//src/fonts/tests/integration:*",
"//src/hwinfo:*",
"//src/identity/bin/account_handler:*",
"//src/identity/bin/account_manager:*",
"//src/identity/bin/credential_manager:*",
"//src/identity/bin/dev_authenticator:*",
"//src/identity/bin/dev_auth_provider:*",
"//src/identity/bin/google_auth_provider:*",
"//src/identity/bin/password_authenticator:*",
"//src/identity/tests/account_manager_integration:*",
"//src/identity/tools/accountctl:*",
"//src/identity/tools/sktool:*",
"//src/lib/diagnostics/data/rust:*",
"//src/lib/diagnostics/log/message/rust:*",
"//src/lib/fake-clock/examples/rust:*",
"//src/lib/fake-clock/svc:*",
"//src/lib/fuchsia-component-test/realm_builder_server:*",
"//src/lib/fuchsia-component-test/tests:*",
"//src/lib/intl/lookup/rust:*",
"//src/lib/storage/block_client/rust:*",
"//src/lib/ui/carnelian:*",
"//src/lib/ui/flatland-frame-scheduling:*",
"//src/lib/ui/input-synthesis:*",
"//src/lib/ui/keymaps:*",
"//src/media/sessions:*",
"//src/media/stream_processors/test:*",
"//src/power/battery-manager:*",
"//src/power/battery-manager/battery-cli:*",
"//src/power/power-manager:*",
"//src/power/shutdown-shim/tests:*",
"//src/power/temperature-logger:*",
"//src/recovery/factory-reset-trigger:*",
"//src/recovery/progress-ui:*",
"//src/security/cr50_agent:*",
"//src/security/kms:*",
"//src/security/pkg_test/dns_resolver:*",
"//src/security/pkg_test/fake_boot_arguments:*",
"//src/security/pkg_test/fshost:*",
"//src/security/pkg_test/paver:*",
"//src/security/pkg_test/pkg_server:*",
"//src/security/pkg_test/reboot:*",
"//src/security/pkg_test/tests/access_ota_blob_as_executable:*",
"//src/security/pkg_test/tests/bad_signature_update:*",
"//src/security/tee_manager:*",
"//src/session/examples/graphical-session:*",
"//src/session/examples/tiles-session:*",
"//src/session/tests/session_manager:*",
"//src/settings/service:*",
"//src/settings/service/integration_tests:*",
"//src/storage/conformance/conformance_harness/rustvfs:*",
"//src/storage/ext4/lib:*",
"//src/storage/ext4/read-only:*",
"//src/storage/ext4/server:*",
"//src/storage/fshost-rust/tests:*",
"//src/storage/fuchsia-fatfs:*",
"//src/storage/flashmap:*",
"//src/storage/fuchsia-fatfs/mounter:*",
"//src/sys/base-resolver/tests/as-a-component-resolver:*",
"//src/sys/component_manager:*",
"//src/sys/component_manager/lib/logger:*",
"//src/sys/component_manager/src/elf_runner/tests/lifecycle:*",
"//src/sys/component_manager/stress_tests:*",
"//src/sys/fuzzing/manager:*",
"//src/sys/fuzzing/registry:*",
"//src/sys/pkg/bin/omaha-client:*",
"//src/sys/pkg/bin/pkg-cache:*",
"//src/sys/pkg/bin/pkg-local-mirror:*",
"//src/sys/pkg/bin/pkg-resolver:*",
"//src/sys/pkg/bin/system-update-checker:*",
"//src/sys/pkg/bin/system-update-committer:*",
"//src/sys/pkg/bin/system-updater:*",
"//src/sys/pkg/bin/usb-system-update-checker:*",
"//src/sys/pkg/lib/blobfs:*",
"//src/sys/pkg/lib/forced-fdr:*",
"//src/sys/pkg/lib/isolated-swd:*",
"//src/sys/pkg/lib/package-directory:*",
"//src/sys/pkg/lib/system-image:*",
"//src/sys/pkg/tests/pkg-cache:*",
"//src/sys/pkg/tests/pkgdir/pkg-harness:*",
"//src/sys/pkg/tests/pkg-resolver:*",
"//src/sys/pkg/tests/system-updater:*",
"//src/sys/pkg/tests/usb-system-update-checker:*",
"//src/sys/tools/stash_ctl:*",
"//src/sys/universe-resolver:*",
"//src/testing/fidl/intl_property_manager:*",
"//src/testing/metrics-logger:*",
"//src/testing/sl4f:*",
"//src/testing/sl4f/proxy:*",
"//src/testing/system-metrics-logger:*",
"//src/tests/intl/timezone:*",
"//src/ui/bin/brightness_manager:*",
"//src/ui/bin/input-pipeline:*",
"//src/ui/bin/scene_manager:*",
"//src/ui/bin/shortcut:*",
"//src/ui/bin/terminal:*",
"//src/ui/bin/text:*",
"//src/ui/examples/flatland-display:*",
"//src/ui/examples/flatland-view-provider:*",
"//src/ui/lib/input_pipeline:*",
"//src/ui/lib/scene_management:*",
"//src/ui/tests/integration_input_tests/factory-reset-handler:*",
"//src/ui/tests/scenic-stress-tests:*",
"//src/ui/tools/tiles/flatland:*",
"//src/virtualization/bin/vmm/device/virtio_block:*",
"//src/virtualization/bin/vmm/device/virtio_rng:*",
"//src/virtualization/bin/vmm/device/virtio_sound:*",
"//src/virtualization/bin/vmm/device/virtio_vsock:*",
"//src/virtualization/tests/virtio_net_test_util:*",
"//src/zircon/bin/vsock_service:*",
]
# At this time we are not enforcing restrictions on the below.
rust_fuchsia_syslog_visibility_allowlist += [
"//third_party/*",
"//vendor/*",
]
group("rust") {
deps = [ ":syslog" ]
visibility =
rust_fuchsia_syslog_visibility_allowlist + [ "//src/lib/syslog:*" ]
}
rustc_library("syslog") {
assert(is_fuchsia)
name = "fuchsia_syslog"
version = "0.1.0"
edition = "2021"
deps = [
"//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:log",
"//third_party/rust_crates:tempfile",
]
non_rust_deps = [ "//zircon/system/ulib/syslog" ]
visibility = rust_fuchsia_syslog_visibility_allowlist + [
":*",
"tests:*",
]
sources = [
"src/lib.rs",
"src/syslog.rs",
]
}
rustc_test("syslog-tests") {
edition = "2021"
version = "0.1.0"
name = "fuchsia_syslog_lib_test"
deps = [
":syslog",
"//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc",
"//sdk/fidl/fuchsia.sys.internal:fuchsia.sys.internal-rustc",
"//src/lib/diagnostics/data/rust:lib",
"//src/lib/diagnostics/hierarchy/rust",
"//src/lib/diagnostics/log/message/rust",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:log",
"//third_party/rust_crates:tempfile",
]
source_root = "src/lib.rs"
sources = [
"src/lib.rs",
"src/syslog.rs",
]
}
rustc_library("syslog-listener") {
name = "fuchsia_syslog_listener"
version = "0.1.0"
edition = "2021"
source_root = "syslog-listener/src/lib.rs"
deps = [
":syslog",
"//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics-rustc",
"//sdk/fidl/fuchsia.logger:fuchsia.logger-rustc",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-component",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:thiserror",
]
sources = [ "syslog-listener/src/lib.rs" ]
}
fuchsia_unittest_package("fuchsia-syslog-tests") {
manifest = "meta/fuchsia_syslog_lib_test.cml"
deps = [ ":syslog-tests" ]
}
group("tests") {
testonly = true
deps = [
":fuchsia-syslog-tests",
":syslog-tests",
"tests",
]
}