| # 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 |
| "//src/connectivity/bluetooth/core/bt-init:*", |
| "//src/connectivity/bluetooth/examples/bt-device-id-client:*", |
| "//src/connectivity/bluetooth/profiles/bt-device-id:*", |
| "//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/tests/audio-device-output-harness:*", |
| "//src/connectivity/bluetooth/tests/bt-manifest-integration-tests:*", |
| "//src/connectivity/bluetooth/tools/bt-bredr-profile:*", |
| "//src/connectivity/bluetooth/tools/bt-snoop:*", |
| "//src/connectivity/location/emergency:*", |
| "//src/connectivity/location/regulatory_region:*", |
| "//src/connectivity/lowpan/drivers/lowpan-dummy-driver:*", |
| "//src/connectivity/lowpan/drivers/lowpan-ot-driver:*", |
| "//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/ppp/lib/ppp_packet:*", |
| "//src/connectivity/ppp/lib/ppp_protocol:*", |
| "//src/connectivity/weave/tests/weave_ip_forward:*", |
| "//src/connectivity/wlan/lib/mlme/rust:*", |
| "//src/connectivity/wlan/lib/stash:*", |
| "//src/connectivity/wlan/testing/wlan-service-util:*", |
| "//src/connectivity/wlan/wlancfg:*", |
| "//src/connectivity/wlan/wlandevicemonitor:*", |
| "//src/connectivity/wlan/wlanstack:*", |
| "//src/devices/bin/driver-index:*", |
| "//src/factory/factory_store_providers:*", |
| "//src/factory/fake_factory_store_providers:*", |
| "//src/fonts:*", |
| "//src/hwinfo:*", |
| "//src/media/stream_processors/test:*", |
| "//src/power/power-manager:*", |
| "//src/recovery/factory-reset-trigger:*", |
| "//src/security/bin/tee_manager:*", |
| "//src/settings/service:*", |
| "//src/settings/storage:*", |
| "//src/sys/pkg/bin/pkg-local-mirror:*", |
| "//src/sys/pkg/bin/system-updater:*", |
| "//src/sys/pkg/lib/forced-fdr:*", |
| "//src/ui/bin/brightness_manager:*", |
| "//src/ui/bin/input-pipeline:*", |
| "//src/ui/bin/text:*", |
| "//src/ui/lib/input_pipeline:*", |
| ] |
| |
| # 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 = [ |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:log", |
| ] |
| 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 = [ |
| "//src/lib/diagnostics/data/rust:lib", |
| "//src/lib/diagnostics/log/message/rust", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:log", |
| ] |
| non_rust_deps = [ "//zircon/system/ulib/syslog" ] |
| |
| 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 = [ |
| "//sdk/fidl/fuchsia.diagnostics:fuchsia.diagnostics_rust", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger_rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| ] |
| |
| sources = [ "syslog-listener/src/lib.rs" ] |
| } |
| |
| fuchsia_unittest_package("fuchsia-syslog-tests") { |
| deps = [ ":syslog-tests" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fuchsia-syslog-tests", |
| ":syslog-tests", |
| "tests", |
| ] |
| } |