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_cxx_library")
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_cxx_library,
    name = "atomic_queue",
    srcs = [],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "AtomicQueue.h",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly/lang:assume",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_cxx_library,
    name = "channel_bridge",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["ChannelBridge.h"],
    exported_deps = [
        "//xplat/folly:try",
        "//xplat/folly/experimental/channels/detail:atomic_queue",
    ],
)

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

fbcode_target(
    _kind = cpp_library,
    name = "atomic_queue",
    headers = [
        "AtomicQueue.h",
    ],
    exported_deps = [
        "//folly/lang:assume",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "channel_bridge",
    headers = ["ChannelBridge.h"],
    exported_deps = [
        "//folly:try",
        "//folly/experimental/channels/detail:atomic_queue",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "intrusive_ptr",
    headers = ["IntrusivePtr.h"],
    exported_external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "multiplexer_traits",
    headers = ["MultiplexerTraits.h"],
    exported_deps = [
        "//folly:traits",
        "//folly/functional:traits",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "pointer_variant",
    headers = ["PointerVariant.h"],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:demangle",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "utility",
    headers = [
        "Utility.h",
    ],
    exported_deps = [
        "//folly:exception_wrapper",
        "//folly:function",
        "//folly:scope_guard",
        "//folly/channels:channel",
        "//folly/channels:rate_limiter",
        "//folly/coro:promise",
        "//folly/coro:task",
        "//folly/executors:sequenced_executor",
    ],
)
