load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load(
    "@fbsource//xplat/folly:defs.bzl",
    "folly_xplat_library",
)
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "observer_manager",
    srcs = [
        "Core.cpp",
        "ObserverManager.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "Core.h",
        "ObserverManager.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:exception_string",
        "//xplat/folly:format",
        "//xplat/folly:function",
        "//xplat/folly:futures_core",
        "//xplat/folly:portability_gflags",
        "//xplat/folly:range",
        "//xplat/folly:singleton",
        "//xplat/folly:synchronization_sanitize_thread",
        "//xplat/folly:synchronized",
        "//xplat/folly:system_thread_name",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/experimental/observer/detail:graph_cycle_detector",
    ],
    exported_deps = [
        "//xplat/folly/fibers:core_manager",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "graph_cycle_detector",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "GraphCycleDetector.h",
    ],
    deps = [
        "//third-party/glog:glog",
    ],
)

# !!!! fbcode/folly/observer/detail/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!

fbcode_target(
    _kind = cpp_library,
    name = "graph_cycle_detector",
    headers = ["GraphCycleDetector.h"],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "observer_manager",
    srcs = [
        "Core.cpp",
        "ObserverManager.cpp",
    ],
    headers = [
        "Core.h",
        "ObserverManager.h",
    ],
    deps = [
        "//folly:exception_string",
        "//folly:format",
        "//folly:range",
        "//folly:singleton",
        "//folly/concurrency:unbounded_queue",
        "//folly/portability:gflags",
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
        "//folly:portability",
        "//folly:synchronized",
        "//folly/experimental/observer/detail:graph_cycle_detector",
        "//folly/fibers:core_manager",
        "//folly/functional:invoke",
        "//folly/futures:core",
        "//folly/synchronization:sanitize_thread",
    ],
    exported_external_deps = [
        "glog",
    ],
)
