load("@bazel_skylib//lib:selects.bzl", "selects")
load("@fbcode_macros//build_defs:auto_headers.bzl", "AutoHeaders")
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//tools/build_defs:fb_native_wrapper.bzl", "fb_native")
load("@fbsource//tools/build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
load("@fbsource//tools/build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test")
load("@fbsource//tools/build_defs:fbsource_utils.bzl", "is_arvr_mode")
load(
    "@fbsource//tools/build_defs:platform_defs.bzl",
    "ANDROID",
    "APPLE",
    "CXX",
    "FBCODE",
    "IOS",
    "MACOSX",
    "WATCHOS",
    "WINDOWS",
)
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
load(
    "@fbsource//xplat/folly:defs.bzl",
    "CXXFLAGS",
    "DEFAULT_APPLE_SDKS",
    "FBANDROID_CPPFLAGS",
    "FBANDROID_CXXFLAGS",
    "FBOBJC_CXXFLAGS",
    "WINDOWS_CLANG_CXX_FLAGS",
    "cpp_flags",
    "folly_xplat_cxx_test",
    "folly_xplat_library",
    "override_soname_if_needed",
    "should_enable_gflags",
)
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")
load(":folly_extended_library.bzl", "folly_extended_xplat_library")

oncall("fbcode_entropy_wardens_folly")

CPPFLAGS = cpp_flags()

# A subset of folly which does not create any linker dependencies (srcs and deps are both empty).
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "headers_only_do_not_use",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        # Header-only deps
        "//third-party/boost:boost",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:config",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:function",
        "//xplat/folly:functional_apply_tuple",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:functional_partial",
        "//xplat/folly:likely",
        "//xplat/folly:math",
        "//xplat/folly:move_wrapper",
        "//xplat/folly:portability",
        "//xplat/folly:portability_iovec",
        "//xplat/folly:portability_math",
        "//xplat/folly:portability_windows",
        "//xplat/folly:preprocessor",
        "//xplat/folly:traits",
        "//xplat/folly:unit",
        "//xplat/folly/container:enumerate",
        "//xplat/folly/container:foreach",
        "//xplat/folly/lang:checked_math",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:uncaught_exceptions",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "memory",
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Memory.h",
    ],
    exported_deps = [
        ":constexpr_math",
        ":functional_invoke",
        ":likely",
        ":portability",
        ":portability_config",
        ":portability_constexpr",
        ":portability_malloc",
        ":traits",
        ":utility",
        "//xplat/folly/lang:align",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:thunk",
        "//xplat/folly/memory:malloc",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "observer_container",
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ObserverContainer.h",
    ],
    exported_deps = [
        ":constructor_callback_list",
        ":function",
        ":optional",
        ":scope_guard",
        ":small_vector",
        "//xplat/folly/io/async:destructor_check",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "operation_cancelled",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["OperationCancelled.h"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "optional",
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Optional.h",
    ],
    exported_deps = [
        "//xplat/folly:hash_traits",
        "//xplat/folly:portability",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/experimental/coro:coroutine",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "benchmark_util",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "BenchmarkUtil.h",
    ],
    exported_deps = [
        ":portability",
        "//xplat/folly/lang:hint",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "benchmark",
    srcs = [
        "Benchmark.cpp",
    ],
    enable_static_variant = False,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Benchmark.h",
    ],
    deps = [
        ":file_util",
        ":json",
        ":map_util",
        ":string",
        "//third-party/boost:boost_regex",
        "//xplat/folly/container:foreach",
        "//xplat/folly/detail:perf_scoped",
        "//xplat/folly/lang:hint",
    ],
    exported_deps = [
        ":benchmark_util",
        ":functional_invoke",
        ":portability",
        ":portability_gflags",
        ":preprocessor",
        ":range",
        ":scope_guard",
        ":traits",
        "//third-party/boost:boost",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "scope_guard",
    srcs = [
        "ScopeGuard.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ScopeGuard.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:preprocessor",
        "//xplat/folly:utility",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:uncaught_exceptions",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronized",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Synchronized.h",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:function",
        "//xplat/folly:functional_apply_tuple",
        "//xplat/folly:likely",
        "//xplat/folly:preprocessor",
        "//xplat/folly:shared_mutex",
        "//xplat/folly:synchronization_lock",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/container:foreach",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "singleton",
    srcs = [
        "Singleton.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//compiler:clang": [
            "-Wno-invalid-noreturn",
        ],
    }),
    cxx_deps = [
        "//xplat/third-party/linker_lib:dl",
        "//third-party/toolchains:rt",
    ],
    exported_preprocessor_flags = select({
        "//xplat/folly/buck_config:folly-singleton-schedule-at-exit-disabled": [
            "-DFOLLY_SINGLETON_SKIP_SCHEDULE_ATEXIT=1",
        ],
        "DEFAULT": [],
    }) + select({
        # Symbolizer is not available for all platforms, disable it for now.
        "DEFAULT": ["-DFOLLY_HAVE_DWARF=0"],
        "ovr_config//os:linux": [],
    }),
    fbandroid_deps = [
        "//xplat/third-party/linker_lib:dl",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Singleton-inl.h",
        "Singleton.h",
        # Instead of depending on experimental_symbolizer_symbolizer, reference always-included headers here.
        "debugging/symbolizer/Dwarf.h",
        "debugging/symbolizer/DwarfImpl.h",
        "debugging/symbolizer/DwarfLineNumberVM.h",
        "debugging/symbolizer/DwarfSection.h",
        "debugging/symbolizer/DwarfUtil.h",
        "debugging/symbolizer/Elf.h",
        "debugging/symbolizer/Elf-inl.h",
        "debugging/symbolizer/ElfCache.h",
        "debugging/symbolizer/Symbolizer.h",
        "debugging/symbolizer/SymbolizedFrame.h",
        "debugging/symbolizer/SymbolizePrinter.h",
        "debugging/symbolizer/StackTrace.h",
        "experimental/symbolizer/Dwarf.h",
        "experimental/symbolizer/DwarfImpl.h",
        "experimental/symbolizer/DwarfLineNumberVM.h",
        "experimental/symbolizer/DwarfSection.h",
        "experimental/symbolizer/DwarfUtil.h",
        "experimental/symbolizer/Elf.h",
        "experimental/symbolizer/Elf-inl.h",
        "experimental/symbolizer/ElfCache.h",
        "experimental/symbolizer/Symbolizer.h",
        "experimental/symbolizer/SymbolizedFrame.h",
        "experimental/symbolizer/SymbolizePrinter.h",
        "experimental/symbolizer/StackTrace.h",
    ],
    deps = [
        "//xplat/folly:portability_fmt_compile",
    ],
    exported_deps = [
        "fbsource//xplat/folly/io:iobuf",
        "//third-party/double-conversion:double-conversion",
        "//third-party/fmt:fmt",
        "//third-party/glog:glog",
        "//xplat/folly:c_portability",
        "//xplat/folly:cancellation_token",
        "//xplat/folly:conv",
        "//xplat/folly:demangle",
        "//xplat/folly:exception",
        "//xplat/folly:executor",
        "//xplat/folly:fbstring",
        "//xplat/folly:file_util",
        "//xplat/folly:hash_hash",
        "//xplat/folly:memory",
        "//xplat/folly:optional",
        "//xplat/folly:portability_config",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly:portability_sys_syscall",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly:string",
        "//xplat/folly:synchronization_baton",
        "//xplat/folly:synchronized",
        "//xplat/folly/concurrency:core_cached_shared_ptr",
        "//xplat/folly/concurrency/memory:read_mostly_shared_ptr",
        "//xplat/folly/container:evicting_cache_map",
        "//xplat/folly/detail:singleton",
        "//xplat/folly/detail:static_singleton_manager",
        "//xplat/folly/lang:exception",
        "//xplat/folly/memory:reentrant_allocator",
        "//xplat/folly/memory:sanitize_leak",
    ] + select({
        "DEFAULT": [],
        "ovr_config//os:linux": ["//xplat/folly:experimental_symbolizer_symbolizer"],
    }),
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_test_util",
    srcs = [
        "testing/TestUtil.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//compiler:clang": [
            "-Wno-narrowing",
        ],
    }),
    fbandroid_deps = [
        "//xplat/third-party/linker_lib:atomic",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/TestUtil.h",
        "testing/TestUtil.h",
    ],
    deps = [
        "//third-party/boost:boost",
    ],
    exported_deps = [
        "//third-party/boost:boost_regex",
        "//third-party/glog:glog",
        "//xplat/folly:exception",
        "//xplat/folly:experimental_io_fs_util",
        "//xplat/folly:file",
        "//xplat/folly:file_util",
        "//xplat/folly:memory",
        "//xplat/folly:portability_fcntl",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly:string",
        "//xplat/folly/ext:test_ext",
        "//xplat/folly/ext/buck2:test_ext",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "testing_test_util",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        ":experimental_test_util",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_aux_vector",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/AuxVector.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:preprocessor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_thread_id",
    srcs = [
        "system/ThreadId.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/ThreadId.h",
    ],
    windows_exported_deps = [
        "//xplat/folly:assume",
        "//xplat/folly:portability_time",
        "//third-party/boost:boost_thread",
    ],
    deps = [
        "//xplat/folly:likely",
        "//xplat/folly:portability_pthread",
        "//xplat/folly:portability_sys_syscall",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:portability_windows",
        "//xplat/folly:synchronization_relaxed_atomic",
        "//xplat/folly:system_at_fork",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "thread_local",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ThreadLocal.h",
    ],
    exported_deps = [
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:scope_guard",
        "//xplat/folly:shared_mutex",
        "//xplat/folly/detail:thread_local_detail",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "singleton_thread_local",
    srcs = [
        "SingletonThreadLocal.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SingletonThreadLocal.h",
    ],
    exported_deps = [
        "//xplat/folly:functional_invoke",
        "//xplat/folly:scope_guard",
        "//xplat/folly:thread_local",
        "//xplat/folly/detail:iterators",
        "//xplat/folly/detail:singleton",
        "//xplat/folly/detail:unique_instance",
        "//xplat/folly/lang:hint",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "random",
    srcs = [
        "Random.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Random.h",
        "Random-inl.h",
    ],
    deps = [
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:portability_config",
        "//xplat/folly:synchronization_relaxed_atomic",
        "//xplat/folly/random:xoshiro256pp",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:portability",
        "//xplat/folly:portability_sys_time",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:singleton_thread_local",
        "//xplat/folly:synchronization_call_once",
        "//xplat/folly:thread_local",
        "//xplat/folly:traits",
        "//xplat/folly/detail:file_util_detail",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "file",
    srcs = [
        "File.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//build_mode:whatsapp": [
            "-fexceptions",
            "-frtti",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "File.h",
    ],
    deps = [
        ":exception",
        ":file_util",
        ":portability_fcntl",
        ":portability_fmt_compile",
        ":portability_sys_file",
        ":scope_guard",
        "//third-party/glog:glog",
    ],
    exported_deps = [
        ":exception_wrapper",
        ":expected",
        ":portability",
        ":portability_unistd",
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "file_util",
    srcs = [
        "FileUtil.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//build_mode:whatsapp": [
            "-fexceptions",
            "-frtti",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FileUtil.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_fcntl",
        "//xplat/folly:portability_sockets",
        "//xplat/folly:portability_stdlib",
        "//xplat/folly:portability_sys_file",
        "//xplat/folly:portability_sys_stat",
        "//xplat/folly:portability_sys_uio",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly/detail:file_util_detail",
        "//xplat/folly/detail:file_util_vector_detail",
        "//xplat/folly/net:net_ops",
        "//xplat/folly/net:network_socket",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "executor",
    srcs = [
        "Executor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = select({
        "DEFAULT": False,
        "ovr_config//os:macos": True,
    }) if is_arvr_mode() else False,
    raw_headers = [
        "Executor.h",
    ],
    soname = override_soname_if_needed("executor"),
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:exception_string",
        "//xplat/folly:function",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:range",
        "//xplat/folly:utility",
        "//xplat/folly/lang:exception",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "inline_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/executors:inline_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "subprocess",
    srcs = [
        "Subprocess.cpp",
    ],
    cxx_deps = [
        "//xplat/third-party/linker_lib:dl",
    ],
    fbandroid_deps = [
        "//xplat/third-party/linker_lib:dl",
    ],
    fbandroid_use_host_platform = True,
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    platforms = (CXX, ANDROID, APPLE),
    raw_headers = [
        "Subprocess.h",
    ],
    deps = [
        ":conv",
        ":logging_logging",
        ":portability_fcntl",
        ":portability_sockets",
        ":portability_stdlib",
        ":portability_sys_syscall",
        ":portability_unistd",
        ":scope_guard",
        ":string",
        ":system_at_fork",
        ":system_shell",
        "//third-party/boost:boost_range",
        "//xplat/folly:portability_dirent",
        "//xplat/folly/lang:assume",
    ],
    exported_deps = [
        ":exception",
        ":file",
        ":file_util",
        ":function",
        ":gen_string",
        ":io_iobuf",
        ":map_util",
        ":optional",
        ":portability",
        ":portability_sys_resource",
        ":range",
        "//third-party/boost:boost",
        "//third-party/boost:boost_container",
        "//xplat/folly/container:span",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "uri",
    srcs = [
        "Uri.cpp",
    ],
    enable_static_variant = False,
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "Uri.h",
        "Uri-inl.h",
    ],
    deps = [
        "//third-party/boost:boost_regex",
        "//third-party/glog:glog",
    ],
    exported_deps = [
        "//third-party/boost:boost_regex",
        "//xplat/folly:conv",
        "//xplat/folly:hash_hash",
        "//xplat/folly:string",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "turnsequencer",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/detail:turn_sequencer",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_stdlib",
    srcs = select({
        "DEFAULT": [],
        "ovr_config//os:windows": [
            "portability/Stdlib.cpp",
        ],
    }),
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//os:windows-clang": WINDOWS_CLANG_CXX_FLAGS,
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Stdlib.h",
    ],
    deps = [
        "//xplat/folly:portability_fcntl",
        "//xplat/folly:portability_sys_stat",
        "//xplat/folly:portability_windows",
    ],
    exported_deps = select({
        "DEFAULT": [
            "//xplat/folly:portability_config",
        ],
        "ovr_config//os:windows": [
            "//xplat/folly:portability_config",
            "//xplat/folly:portability_fcntl",
        ],
    }) + ["//xplat/folly:c_portability"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_dirent",
    srcs = [
        "portability/Dirent.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Dirent.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_fcntl",
    srcs = [
        "portability/Fcntl.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Fcntl.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_sockets",
        "//xplat/folly:portability_sys_stat",
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_filesystem",
    srcs = ["portability/Filesystem.cpp"],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["portability/Filesystem.h"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_fmt_compile",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["portability/FmtCompile.h"],
    deps = [
        "//third-party/fmt:fmt",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_event",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Event.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_fcntl",
        "//xplat/folly:portability_windows",
        "//xplat/folly/net/detail:socket_file_descriptor_map",
        "//xplat/third-party/event:event",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_headers",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly:portability_asm",
        "//xplat/folly:portability_atomic",
        "//xplat/folly:portability_sys_syscall",
        "//xplat/folly:portability_syslog",
        "//xplat/third-party/linker_lib:atomic",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_openssl",
    srcs = [
        "portability/OpenSSL.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//compiler:clang": [
            "-Wno-unused-function",
        ],
    }),
    raw_headers = [
        "portability/OpenSSL.h",
    ],
    exported_deps = [
        ":portability",
        ":portability_windows",
        "//xplat/third-party/openssl:crypto",
        "//xplat/third-party/openssl:ssl",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_source_location",
    raw_headers = [
        "portability/SourceLocation.h",
    ],
    exported_deps = [
        "//third-party/fmt:fmt",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "range",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Range.h",
    ],
    exported_deps = [
        "//third-party/fmt:fmt",
        "//xplat/folly:cpu_id",
        "//xplat/folly:hash_spooky_hash_v2",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:portability_constexpr",
        "//xplat/folly:traits",
        "//xplat/folly/detail:range_common",
        "//xplat/folly/detail:range_simd",
        "//xplat/folly/detail:range_sse42",
        "//xplat/folly/lang:c_string",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fbvector",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FBVector.h",
    ],
    exported_deps = [
        "//xplat/folly/container:fbvector",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fixed_string",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FixedString.h",
    ],
    exported_deps = [
        "//xplat/folly:constexpr_math",
        "//xplat/folly:portability",
        "//xplat/folly:portability_constexpr",
        "//xplat/folly:range",
        "//xplat/folly:utility",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:ordering",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fbstring",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FBString.h",
    ],
    exported_deps = [
        "//third-party/fmt:fmt",
        "//xplat/folly:c_portability",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:hash_hash",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:traits",
        "//xplat/folly/lang:assume",
        "//xplat/folly/lang:checked_math",
        "//xplat/folly/lang:exception",
        "//xplat/folly/memory:malloc",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "format",
    srcs = [
        "Format.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Format.h",
        "Format-inl.h",
        "FormatArg.h",
    ],
    exported_deps = [
        "//third-party/double-conversion:double-conversion",
        "//xplat/folly:c_portability",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:conv",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:exception",
        "//xplat/folly:format_traits",
        "//xplat/folly:likely",
        "//xplat/folly:map_util",
        "//xplat/folly:portability",
        "//xplat/folly:portability_windows",
        "//xplat/folly:range",
        "//xplat/folly:string",
        "//xplat/folly:traits",
        "//xplat/folly/container:array",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:to_ascii",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "string",
    srcs = [
        "String.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ] + select({
        "DEFAULT": [],
        "ovr_config//build_mode:whatsapp": [
            "-fexceptions",
            "-frtti",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "String.h",
        "String-inl.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly/container:array",
        "//xplat/folly/detail:simple_simd_string_utils",
        "//xplat/folly/detail:split_string_simd",
    ],
    exported_deps = [
        ":conv",
        ":cpp_attributes",
        ":exception_string",
        ":optional",
        ":portability",
        ":range",
        ":scope_guard",
        ":traits",
        ":unit",
        "//xplat/folly/container:reserve",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_extended",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly:portability_builtins",
        "//xplat/folly:portability_dirent",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly:portability_sys_resource",
        "//xplat/folly:portability_time",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_unistd",
    srcs = [
        "portability/Unistd.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Unistd.h",
    ],
    windows_exported_deps = [
        "//xplat/folly:portability_sockets",
    ],
    deps = [
        ":scope_guard",
        "//xplat/folly/net/detail:socket_file_descriptor_map",
    ],
    exported_deps = [
        "//xplat/folly:portability_sockets",
        "//xplat/folly:portability_sys_types",
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sockets",
    srcs = [
        "portability/Sockets.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Sockets.h",
    ],
    deps = [
        "//xplat/folly/net/detail:socket_file_descriptor_map",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:scope_guard",
        "//xplat/folly/net:net_ops",
        "//xplat/folly/net:network_socket",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_string",
    srcs = [
        "portability/String.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/String.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_config",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_constexpr",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Constexpr.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_gflags",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    exported_preprocessor_flags = select({
        "//xplat/folly/buck_config:folly-gflags-enabled": ["-DFOLLY_HAVE_LIBGFLAGS=1"],
        "DEFAULT": ["-DFOLLY_HAVE_LIBGFLAGS=1"] if should_enable_gflags() else ["-DFOLLY_HAVE_LIBGFLAGS=0"],
        "ovr_config//os:linux": ["-DFOLLY_HAVE_LIBGFLAGS=1"],
        "ovr_config//os:macos": ["-DFOLLY_HAVE_LIBGFLAGS=1"],
        "ovr_config//os:windows": ["-DFOLLY_HAVE_LIBGFLAGS=1"],
        # In some cases, fbandroid suffixed rules can build with the fbcode platforms.
        "ovr_config//runtime:fbcode": ["-DFOLLY_HAVE_LIBGFLAGS=1"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/GFlags.h",
    ],
    exported_deps = [":portability_config"] + select({
        "//xplat/folly/buck_config:folly-gflags-enabled": ["//third-party/gflags:gflags"],
        "DEFAULT": ["//third-party/gflags:gflags"] if should_enable_gflags() else [],
        "ovr_config//os:linux": ["//third-party/gflags:gflags"],
        "ovr_config//os:macos": ["//third-party/gflags:gflags"],
        "ovr_config//os:windows": ["//third-party/gflags:gflags"],
        "ovr_config//runtime:fbcode": ["//third-party/gflags:gflags"],
    }),
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_time",
    srcs = [
        "portability/Time.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Time.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:likely",
        "//xplat/folly:portability_config",
        "//xplat/folly:portability_windows",
        "//xplat/folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_time",
    srcs = [
        "portability/SysTime.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysTime.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_stat",
    srcs = [
        "portability/SysStat.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysStat.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:portability_sys_types",
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_membarrier",
    srcs = [
        "portability/SysMembarrier.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysMembarrier.h",
    ],
    exported_deps = [
        ":portability",
        ":portability_sys_syscall",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_mman",
    srcs = [
        "portability/SysMman.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysMman.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_resource",
    srcs = [
        "portability/SysResource.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysResource.h",
    ],
    windows_exported_deps = [
        "//xplat/folly:portability_sys_time",
    ],
    exported_deps = [
        "//xplat/folly:portability_sys_time",
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_file",
    srcs = [
        "portability/SysFile.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysFile.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:portability_windows",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_uio",
    srcs = [
        "portability/SysUio.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysUio.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_config",
        "//xplat/folly:portability_iovec",
        "//xplat/folly:portability_sockets",
        "//xplat/folly:portability_sys_file",
        "//xplat/folly:portability_sys_types",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:scope_guard",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_builtins",
    srcs = [
        "portability/Builtins.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Builtins.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_windows",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "assume",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/lang:assume",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "bits",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Bits.h",
    ],
    exported_deps = [
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Hash.h",
    ],
    exported_deps = [
        "//xplat/folly:hash_hash",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_detail_checksum_detail",
    srcs = [
        "hash/detail/ChecksumDetail.cpp",
        "hash/detail/Crc32CombineDetail.cpp",
        "hash/detail/Crc32cDetail.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//os:android-x86_64": ["-mpclmul"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/detail/ChecksumDetail.h",
    ],
    deps = [
        ":bits",
        ":cpp_attributes",
        "//third-party/boost:boost_preprocessor",
    ],
    exported_deps = [
        ":portability",
        "//xplat/folly/external/nvidia/hash:checksum",  # @manual
        "//xplat/folly/external/nvidia/hash/detail:crc32c_detail",  # @manual
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_checksum",
    srcs = [
        "hash/Checksum.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/Checksum.h",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//xplat/folly:cpu_id",
        "//xplat/folly:external_fastcrc32_avx512",
        "//xplat/folly:external_fastcrc32_neon",
        "//xplat/folly:external_fastcrc32_neon_eor3_sha3",
        "//xplat/folly:external_fastcrc32_sse42",
        "//xplat/folly:hash_detail_checksum_detail",
        "//xplat/folly/detail:traponavx512",
        "//xplat/folly/external/nvidia/hash:checksum",  # @manual
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "conv",
    srcs = [
        "Conv.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Conv.h",
    ],
    deps = [
        "fbsource//third-party/fast_float:fast_float",
        "//xplat/folly/lang:safe_assert",
    ],
    exported_deps = [
        "//third-party/double-conversion:double-conversion",
        "//xplat/folly:c_portability",
        "//xplat/folly:demangle",
        "//xplat/folly:expected",
        "//xplat/folly:fbstring",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:portability_math",
        "//xplat/folly:range",
        "//xplat/folly:traits",
        "//xplat/folly:unit",
        "//xplat/folly:utility",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:pretty",
        "//xplat/folly/lang:to_ascii",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "dynamic",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "DynamicConverter.h",
        "dynamic.h",
        "dynamic-inl.h",
        "json.h",
    ],
    deps = [
        "//xplat/folly:utility",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//third-party/boost:boost_algorithm",
        "//third-party/glog:glog",
        "//xplat/folly:c_portability",
        "//xplat/folly:conv",
        "//xplat/folly:expected",
        "//xplat/folly:format",
        "//xplat/folly:function",
        "//xplat/folly:hash_hash",
        "//xplat/folly:json_pointer",
        "//xplat/folly:likely",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:portability_constexpr",
        "//xplat/folly:range",
        "//xplat/folly:string",
        "//xplat/folly:traits",
        "//xplat/folly:unicode",
        "//xplat/folly:utility",
        "//xplat/folly/container:access",
        "//xplat/folly/container:enumerate",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/detail:iterators",
        "//xplat/folly/json:dynamic",
        "//xplat/folly/lang:assume",
        "//xplat/folly/lang:bits",
        "//xplat/folly/lang:exception",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "f14_hash",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/container:f14_hash",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "f14_mask",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/container/detail:f14_mask",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "indestructible",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Indestructible.h",
    ],
    exported_deps = [
        "//xplat/folly:traits",
        "//xplat/folly:utility",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "evicting_cache_map",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/container:evicting_cache_map",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_iobuf",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/io:iobuf",
    ],
)

# xplat/folly/test aliases
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "json_test_util",
    exported_headers = [
        "test/JsonTestUtil.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    platforms = (CXX, ANDROID, APPLE, WINDOWS, FBCODE),
    exported_deps = [
        "//xplat/folly/json:json_test_util",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "json_mock_util",
    exported_headers = [
        "test/JsonMockUtil.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    platforms = (CXX, ANDROID, APPLE, WINDOWS, FBCODE),
    exported_deps = [
        "//xplat/folly/json:json_mock_util",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "comparison_operator_test_util",
    exported_headers = [
        "test/ComparisonOperatorTestUtil.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    platforms = (CXX, ANDROID, APPLE, WINDOWS, FBCODE),
    exported_deps = [
        "//xplat/folly:portability_gtest",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "safe_assert",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "cpu_id",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "CpuId.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "cpp_attributes",
    apple_sdks = (IOS, MACOSX, WATCHOS),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "CppAttributes.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "config",
    apple_sdks = (IOS, MACOSX, WATCHOS),
    exported_preprocessor_flags = CPPFLAGS,
    fbandroid_exported_preprocessor_flags = FBANDROID_CPPFLAGS,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "folly-config.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "constexpr_math",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ConstexprMath.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_constexpr",
        "//xplat/folly/lang:checked_math",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "constructor_callback_list",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ConstructorCallbackList.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "math",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Math.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "move_wrapper",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MoveWrapper.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_iovec",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/IOVec.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_libunwind",
    exported_preprocessor_flags = select({
        "DEFAULT": [],
        "ovr_config//runtime:anywhere-linux": [
            # anywhere-linux links in a different version of libunwind, do not use for now
            "-DFOLLY_HAVE_LIBUNWIND=0",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Libunwind.h",
    ],
    exported_deps = select({
        "DEFAULT": ["//third-party/libunwind:unwind"],
        "ovr_config//os:android": [],
        "ovr_config//os:appletvos": [],  # apple
        "ovr_config//os:iphoneos": [],  # apple
        "ovr_config//os:macos": [],  # apple
        "ovr_config//os:watchos": [],  # apple
        "ovr_config//os:windows": [],
        "ovr_config//runtime:anywhere-linux": [],
    }),
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_math",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Math.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_windows",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Windows.h",
    ],
    exported_deps = select({
        "DEFAULT": [],
        "ovr_config//os:windows": [
            "//third-party/toolchains/win:ws2_32.lib",
        ],
    }),
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_types",
    apple_sdks = (IOS, MACOSX, WATCHOS),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysTypes.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "likely",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Likely.h",
    ],
    exported_deps = [
        "//xplat/folly/lang:builtin",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "unit",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Unit.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_config",
    apple_sdks = (IOS, MACOSX, WATCHOS),
    fbobjc_exported_preprocessor_flags = [
        "-DFOLLY_ASSUME_NO_JEMALLOC=1",
        "-DFOLLY_ASSUME_NO_TCMALLOC=1",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Config.h",
    ],
    exported_deps = [
        ":config",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "c_portability",
    apple_sdks = (IOS, MACOSX, WATCHOS),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "CPortability.h",
    ],
    exported_deps = [
        ":portability_config",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "preprocessor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Preprocessor.h",
    ],
    exported_deps = [
        ":c_portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability",
    apple_sdks = (IOS, MACOSX, WATCHOS),
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Portability.h",
    ],
    exported_deps = [
        ":c_portability",
        ":portability_config",
        ":portability_sys_types",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "traits",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Traits.h",
    ],
    exported_deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "utility",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Utility.h",
    ],
    exported_deps = [
        ":c_portability",
        ":portability",
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "functional_invoke",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "functional/Invoke.h",
    ],
    exported_deps = [
        ":cpp_attributes",
        ":portability",
        ":preprocessor",
        ":traits",
        ":utility",
        "//third-party/boost:boost_preprocessor",
        "//xplat/folly/lang:customization_point",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "functional_protocol",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "functional/protocol.h",
    ],
    exported_deps = [
        ":functional_invoke",
        ":functional_traits",
        ":portability",
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "functional_traits",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "functional/traits.h",
    ],
    exported_deps = [
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "function",
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Function.h",
    ],
    exported_deps = [
        ":cpp_attributes",
        ":functional_invoke",
        ":portability",
        ":traits",
        "//xplat/folly/lang:align",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:new",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "functional_apply_tuple",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "functional/ApplyTuple.h",
    ],
    exported_deps = [
        ":functional_invoke",
        ":traits",
        ":utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "functional_partial",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "functional/Partial.h",
    ],
    exported_deps = [
        ":functional_invoke",
        ":utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "atomic_hash_map",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "AtomicHashMap.h",
        "AtomicHashMap-inl.h",
    ],
    exported_deps = [
        "//xplat/folly:atomic_hash_array",
        "//xplat/folly:c_portability",
        "//xplat/folly:hash_hash",
        "//xplat/folly:likely",
        "//xplat/folly:thread_cached_int",
        "//xplat/folly/container:foreach",
        "//xplat/folly/detail:atomic_hash_utils",
        "//xplat/folly/detail:iterators",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "atomic_linked_list",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "AtomicIntrusiveLinkedList.h",
        "AtomicLinkedList.h",
    ],
    exported_deps = [
        "//xplat/folly:memory",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "chrono",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Chrono.h",
    ],
    exported_deps = [
        ":portability",
        ":portability_time",
        "//xplat/folly/lang:exception",
    ],
)

fb_native.constraint_setting(
    name = "folly_demangle_macos_use_iberty_constraint",
)

fb_native.constraint_value(
    name = "folly_demangle_macos_disable_iberty",
    constraint_setting = ":folly_demangle_macos_use_iberty_constraint",
    visibility = ["PUBLIC"],
)

fb_native.config_setting(
    name = "folly_demangle_macos_disable_iberty_config",
    constraint_values = [
        "ovr_config//os/constraints:macos",
        ":folly_demangle_macos_disable_iberty",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "demangle",
    srcs = [
        "Demangle.cpp",
    ],
    compiler_flags = selects.with_or({
        (
            "ovr_config//os:android"
        ): [
            "-Wno-error=deprecated-dynamic-exception-spec",
            "-fno-omit-frame-pointer",
        ],
        "DEFAULT": ["-fno-omit-frame-pointer"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Demangle.h",
    ],
    deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:utility",
        "//xplat/folly/lang:c_string",
    ] + select({
        "//xplat/folly:folly_demangle_macos_disable_iberty_config": [],
        "DEFAULT": [],
        "ovr_config//os:linux": ["//third-party/binutils:iberty-demangle"],
        "ovr_config//os:macos": ["//third-party/binutils:iberty-demangle"],
    }),
    exported_deps = [
        "//xplat/folly:fbstring",
        "//xplat/folly:portability_config",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "exception",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Exception.h",
    ],
    exported_deps = [
        "//xplat/folly:conv",
        "//xplat/folly:fbstring",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "exception_string",
    srcs = [
        "ExceptionString.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ExceptionString.h",
    ],
    deps = [
        "//xplat/folly:demangle",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:type_info",
    ],
    exported_deps = [
        "//xplat/folly:fbstring",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "exception_wrapper",
    srcs = [
        "ExceptionWrapper.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//build_mode:whatsapp": [
            "-fexceptions",
            "-frtti",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ExceptionWrapper.h",
        "ExceptionWrapper-inl.h",
    ],
    exported_deps = [
        ":c_portability",
        ":cpp_attributes",
        ":demangle",
        ":exception_string",
        ":fbstring",
        ":functional_traits",
        ":portability",
        ":traits",
        ":utility",
        "//xplat/folly/lang:assume",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "expected",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Expected.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:preprocessor",
        "//xplat/folly:traits",
        "//xplat/folly:unit",
        "//xplat/folly:utility",
        "//xplat/folly/experimental/coro:coroutine",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:hint",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fmt_utility",
    srcs = [
        "FmtUtility.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FmtUtility.h",
    ],
    deps = [
        "//xplat/folly:range",
        "//xplat/folly:string",
        "//xplat/folly/ssl:openssl_hash",
    ],
    exported_deps = [
        "//xplat/folly:cpp_attributes",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "format_traits",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "FormatTraits.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "glog",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "GLog.h",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:likely",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "indexed_mem_pool",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "IndexedMemPool.h",
    ],
    exported_deps = [
        ":portability",
        ":portability_sys_mman",
        ":portability_unistd",
        ":synchronization_atomic_struct",
        "//xplat/folly/concurrency:cache_locality",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "intrusive_list",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "IntrusiveList.h",
    ],
    exported_deps = [
        "//xplat/folly/container:intrusive_list",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_shutdown_socket_set",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/io:shutdown_socket_set",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_socket_option_map",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/io:socket_option_map",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "map_util",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MapUtil.h",
    ],
    exported_deps = [
        "//xplat/folly/container:map_util",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "micro_lock",
    srcs = [
        "MicroLock.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MicroLock.h",
    ],
    exported_deps = [
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:portability_asm",
        "//xplat/folly:synchronization_atomic_notification",
        "//xplat/folly:synchronization_atomic_ref",
        "//xplat/folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "mpmc_queue",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MPMCQueue.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_unistd",
        "//xplat/folly:traits",
        "//xplat/folly/concurrency:cache_locality",
        "//xplat/folly/detail:turn_sequencer",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "network_address",
    srcs = [
        "IPAddress.cpp",
        "IPAddressV4.cpp",
        "IPAddressV6.cpp",
        "MacAddress.cpp",
        "SocketAddress.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "IPAddress.h",
        "IPAddressException.h",
        "IPAddressV4.h",
        "IPAddressV6.h",
        "MacAddress.h",
        "SocketAddress.h",
    ],
    windows_exported_linker_flags = [
        "iphlpapi.lib",
    ],
    deps = [
        "//xplat/folly:scope_guard",
        "//xplat/folly:small_vector",
    ],
    exported_deps = [
        "//third-party/boost:boost",
        "//xplat/folly:c_portability",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:conv",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:exception",
        "//xplat/folly:expected",
        "//xplat/folly:fbstring",
        "//xplat/folly:format",
        "//xplat/folly:hash_hash",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:portability_sockets",
        "//xplat/folly:range",
        "//xplat/folly:string",
        "//xplat/folly:unit",
        "//xplat/folly/detail:ip_address",
        "//xplat/folly/detail:ip_address_source",
        "//xplat/folly/lang:bits",
        "//xplat/folly/lang:exception",
        "//xplat/folly/net:net_ops",
        "//xplat/folly/net:network_socket",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "overload",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Overload.h",
    ],
    exported_deps = [
        ":functional_invoke",
        ":portability",
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_pthread",
    srcs = [
        "portability/PThread.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    cxx_exported_deps = [
        "//xplat/third-party/linker_lib:pthread",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/PThread.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:portability_config",
        "//xplat/folly:portability_sched",
        "//xplat/folly:portability_time",
        "//xplat/folly:portability_windows",
        "//xplat/folly:range",
        "//xplat/folly/lang:assume",
    ] + select({
        "DEFAULT": [],
        "ovr_config//os:android": ["//xplat/third-party/linker_lib:pthread"],
        "ovr_config//os:windows": ["//third-party/boost:boost_thread"],
    }),
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "shared_mutex",
    srcs = [
        "SharedMutex.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SharedMutex.h",
    ],
    deps = [
        "//xplat/folly:indestructible",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:likely",
        "//xplat/folly:portability_asm",
        "//xplat/folly:portability_sys_resource",
        "//xplat/folly:synchronization_lock",
        "//xplat/folly:synchronization_relaxed_atomic",
        "//xplat/folly:synchronization_sanitize_thread",
        "//xplat/folly:system_thread_id",
        "//xplat/folly/chrono:hardware",
        "//xplat/folly/concurrency:cache_locality",
        "//xplat/folly/detail:futex",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "small_vector",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "small_vector.h",
    ],
    exported_deps = [
        "//xplat/folly/container:small_vector",
        "//xplat/folly/memory:sanitize_leak",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "sorted_vector_types",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["sorted_vector_types.h"],
    exported_deps = [
        "//xplat/folly/container:sorted_vector_types",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "spin_lock",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SpinLock.h",
    ],
    exported_deps = [
        "//xplat/folly:portability",
        "//xplat/folly:synchronization_small_locks",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stop_watch",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stop_watch.h",
    ],
    exported_deps = [
        ":chrono",
        ":portability_time",
        ":utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_asymmetric_thread_fence",
    srcs = [
        "synchronization/AsymmetricThreadFence.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/AsymmetricThreadFence.h",
    ],
    deps = [
        "//xplat/folly:synchronization_relaxed_atomic",
    ],
    exported_deps = [
        ":exception",
        ":indestructible",
        ":portability_asm",
        ":portability_sys_membarrier",
        ":portability_sys_mman",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_atomic_util",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/AtomicUtil.h",
        "synchronization/AtomicUtil-inl.h",
    ],
    exported_deps = [
        ":constexpr_math",
        ":likely",
        ":portability",
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_atomic_notification",
    srcs = [
        "synchronization/AtomicNotification.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/AtomicNotification.h",
        "synchronization/AtomicNotification-inl.h",
    ],
    exported_deps = [
        ":synchronization_parking_lot",
        "//xplat/folly:portability",
        "//xplat/folly/detail:futex",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_atomic_ref",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/AtomicRef.h",
    ],
    exported_deps = [
        ":traits",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_atomic_struct",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/AtomicStruct.h",
    ],
    exported_deps = [
        ":constexpr_math",
        ":synchronization_detail_atomic_utils",
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_baton",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/Baton.h",
    ],
    exported_deps = [
        ":likely",
        ":portability_asm",
        ":synchronization_atomic_util",
        ":synchronization_detail_spin",
        ":synchronization_wait_options",
        "//xplat/folly/detail:async_trace",
        "//xplat/folly/detail:futex",
        "//xplat/folly/detail:memory_idler",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_call_once",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/CallOnce.h",
    ],
    exported_deps = [
        "//xplat/folly:functional_invoke",
        "//xplat/folly:likely",
        "//xplat/folly:micro_lock",
        "//xplat/folly:portability",
        "//xplat/folly:shared_mutex",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_delayed_init",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["synchronization/DelayedInit.h"],
    exported_deps = [
        "//xplat/folly:synchronization_call_once",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_distributed_mutex",
    srcs = [
        "synchronization/DistributedMutex.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/DistributedMutex.h",
        "synchronization/DistributedMutex-inl.h",
    ],
    exported_deps = [
        "//third-party/glog:glog",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:likely",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:portability_asm",
        "//xplat/folly:scope_guard",
        "//xplat/folly:synchronization_atomic_notification",
        "//xplat/folly:synchronization_atomic_util",
        "//xplat/folly:synchronization_detail_inline_function_ref",
        "//xplat/folly:synchronization_detail_sleeper",
        "//xplat/folly:synchronization_lock",
        "//xplat/folly:utility",
        "//xplat/folly/chrono:hardware",
        "//xplat/folly/detail:futex",
        "//xplat/folly/lang:align",
        "//xplat/folly/lang:bits",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_flat_combining",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/FlatCombining.h",
    ],
    deps = [
        "//xplat/folly:function",
        "//xplat/folly:indexed_mem_pool",
        "//xplat/folly:portability",
        "//xplat/folly:synchronization_saturating_semaphore",
    ],
    exported_deps = [
        "//xplat/folly:system_thread_name",
        "//xplat/folly/concurrency:cache_locality",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_hazptr",
    srcs = [
        "synchronization/Hazptr.cpp",
        "synchronization/HazptrDomain.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/Hazptr.h",
        "synchronization/Hazptr-fwd.h",
        "synchronization/HazptrDomain.h",
        "synchronization/HazptrHolder.h",
        "synchronization/HazptrObj.h",
        "synchronization/HazptrObjLinked.h",
        "synchronization/HazptrRec.h",
        "synchronization/HazptrThrLocal.h",
    ],
    deps = [
        ":portability_gflags",
    ],
    exported_deps = [
        ":c_portability",
        ":executor",
        ":indestructible",
        ":memory",
        ":portability",
        ":scope_guard",
        ":singleton_thread_local",
        ":synchronization_asymmetric_thread_fence",
        ":synchronization_detail_hazptr_utils",
        ":traits",
        "//third-party/glog:glog",
        "//xplat/folly/concurrency:cache_locality",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/executors:inline_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_hazptr_thread_pool_executor",
    srcs = [
        "synchronization/HazptrThreadPoolExecutor.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/HazptrThreadPoolExecutor.h",
    ],
    exported_deps = [
        ":singleton",
        ":synchronization_hazptr",
        "//xplat/folly/executors:cpu_thread_pool_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_latch",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/Latch.h",
    ],
    exported_deps = [
        ":c_portability",
        ":likely",
        ":synchronization_saturating_semaphore",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_lifo_sem",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/LifoSem.h",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:indexed_mem_pool",
        "//xplat/folly:likely",
        "//xplat/folly:portability",
        "//xplat/folly:synchronization_atomic_struct",
        "//xplat/folly:synchronization_saturating_semaphore",
        "//xplat/folly:traits",
        "//xplat/folly/detail:static_singleton_manager",
        "//xplat/folly/lang:aligned",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_throttled_lifo_sem",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/ThrottledLifoSem.h",
    ],
    exported_deps = [
        ":glog",
        ":intrusive_list",
        ":optional",
        ":synchronization_detail_spin",
        ":synchronization_distributed_mutex",
        ":synchronization_saturating_semaphore",
        ":synchronization_wait_options",
        "//xplat/folly/lang:align",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_lock",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/Lock.h",
    ],
    exported_deps = [
        "//xplat/folly:functional_invoke",
        "//xplat/folly:portability",
        "//xplat/folly:traits",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_micro_spin_lock",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/MicroSpinLock.h",
    ],
    exported_deps = [
        ":portability",
        ":synchronization_detail_sleeper",
        ":synchronization_sanitize_thread",
        "//xplat/folly/lang:align",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_native_semaphore",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/NativeSemaphore.h",
    ],
    exported_deps = [
        ":portability_windows",
        ":utility",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_pico_spin_lock",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/PicoSpinLock.h",
    ],
    exported_deps = [
        ":portability",
        ":synchronization_atomic_ref",
        ":synchronization_atomic_util",
        ":synchronization_detail_sleeper",
        ":synchronization_sanitize_thread",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_parking_lot",
    srcs = [
        "synchronization/ParkingLot.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/ParkingLot.h",
    ],
    exported_deps = [
        "//xplat/folly:hash",
        "//xplat/folly:indestructible",
        "//xplat/folly:portability",
        "//xplat/folly:unit",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_rcu",
    srcs = [
        "synchronization/Rcu.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/Rcu.h",
    ],
    exported_deps = [
        "//xplat/folly:function",
        "//xplat/folly:indestructible",
        "//xplat/folly:optional",
        "//xplat/folly:synchronization_detail_rcu-detail",
        "//xplat/folly:system_at_fork",
        "//xplat/folly/detail:static_singleton_manager",
        "//xplat/folly/detail:turn_sequencer",
        "//xplat/folly/executors:queued_immediate_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_relaxed_atomic",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/RelaxedAtomic.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_rw_spin_lock",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/RWSpinLock.h",
    ],
    exported_deps = [
        ":likely",
        ":portability",
        ":portability_asm",
        ":synchronization_lock",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_sanitize_thread",
    srcs = [
        "synchronization/SanitizeThread.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/SanitizeThread.h",
    ],
    deps = [
        "//xplat/folly/lang:extern",
    ],
    exported_deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_saturating_semaphore",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/SaturatingSemaphore.h",
    ],
    exported_deps = [
        ":likely",
        ":portability_asm",
        ":synchronization_atomic_util",
        ":synchronization_detail_spin",
        ":synchronization_wait_options",
        "//third-party/glog:glog",
        "//xplat/folly/detail:futex",
        "//xplat/folly/detail:memory_idler",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_small_locks",
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/SmallLocks.h",
    ],
    exported_deps = [
        "//xplat/folly:micro_lock",
        "//xplat/folly:portability",
        "//xplat/folly:synchronization_micro_spin_lock",
        "//xplat/folly:synchronization_pico_spin_lock",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_wait_options",
    srcs = [
        "synchronization/WaitOptions.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/WaitOptions.h",
    ],
    exported_deps = [
        ":c_portability",
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_atomic_utils",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/AtomicUtils.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_hazptr_utils",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/HazptrUtils.h",
    ],
    exported_deps = [
        ":portability",
        ":synchronization_detail_sleeper",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_sleeper",
    srcs = [
        "synchronization/detail/Sleeper.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/Sleeper.h",
    ],
    exported_deps = [
        ":portability",
        ":portability_asm",
        ":portability_time",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_spin",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/Spin.h",
    ],
    exported_deps = [
        ":portability_asm",
        ":synchronization_wait_options",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_inline_function_ref",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/InlineFunctionRef.h",
    ],
    exported_deps = [
        "//xplat/folly:function",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_thread_name",
    srcs = [
        "system/ThreadName.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/ThreadName.h",
    ],
    exported_deps = [
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:portability_config",
        "//xplat/folly:portability_pthread",
        "//xplat/folly:portability_windows",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly:traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "varint",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Varint.h",
    ],
    exported_deps = [
        ":conv",
        ":expected",
        ":likely",
        ":portability",
        ":range",
    ],
)

# Legacy alias
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "farmhash",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        ":external_farmhash_farmhash",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "external_farmhash_farmhash",
    srcs = [
        "external/farmhash/farmhash.cpp",
    ],
    compiler_flags = [
        "-fno-omit-frame-pointer",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "external/farmhash/farmhash.h",
    ],
    exported_deps = [
        "//xplat/folly:portability_config",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "external_fastcrc32_avx512",
    srcs = [
        "external/fast-crc32/avx512_crc32c_v8s3x4.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//os:android-x86_64": ["-mpclmul"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "external/fast-crc32/avx512_crc32c_v8s3x4.h",
    ],
    exported_deps = [":portability"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "external_fastcrc32_sse42",
    srcs = [
        "external/fast-crc32/sse_crc32c_v8s3x3.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//os:android-x86_64": ["-mpclmul"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "external/fast-crc32/sse_crc32c_v8s3x3.h",
    ],
    exported_deps = [":portability"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "external_fastcrc32_neon",
    srcs = [
        "external/fast-crc32/neon_crc32c_v3s4x2e_v2.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//os:android-arm64": ["-march=armv8-a+crypto+crc"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "external/fast-crc32/neon_crc32c_v3s4x2e_v2.h",
    ],
    exported_deps = [
        ":portability",
        ":system_aux_vector",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "external_fastcrc32_neon_eor3_sha3",
    srcs = [
        "external/fast-crc32/neon_eor3_crc32_v9s3x2e_s3.cpp",
        "external/fast-crc32/neon_eor3_crc32c_v8s2x4_s3.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//os:android-arm64": ["-march=armv8.2-a+crypto+sha3"],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "external/fast-crc32/neon_eor3_crc32_v9s3x2e_s3.h",
        "external/fast-crc32/neon_eor3_crc32c_v8s2x4_s3.h",
    ],
    exported_deps = [
        ":portability",
        ":system_aux_vector",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "external_rapidhash",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "external/rapidhash/rapidhash.h",
    ],
    exported_deps = [
        ":bits",
        ":cpp_attributes",
        ":portability",
    ],
)

# A basic pieces of folly
#   Should only require glog and boost
non_fbcode_target(
    _kind = fb_xplat_cxx_library,
    name = "molly",
    header_namespace = "",
    apple_sdks = DEFAULT_APPLE_SDKS,
    compiler_flags = CXXFLAGS + select({
        "DEFAULT": [
            "-fno-omit-frame-pointer",
        ],
        "ovr_config//os:windows-clang": WINDOWS_CLANG_CXX_FLAGS,
    }),
    cxx_deps = [
        "//xplat/third-party/linker_lib:atomic",
        "//xplat/third-party/linker_lib:pthread",
    ],
    enable_static_variant = True,
    fbandroid_compiler_flags = FBANDROID_CXXFLAGS,
    fbandroid_deps = [
        "//xplat/third-party/linker_lib:atomic",
        "//xplat/third-party/linker_lib:pthread",
    ],
    fbandroid_tests = [
        "//xplat/folly:folly-test",
    ],
    fbobjc_compiler_flags = FBOBJC_CXXFLAGS,
    fbobjc_complete_nullability = True,
    feature = triage_InfrastructureSupermoduleOptou,
    ios_tests = [
        "//xplat/folly:folly-test",
    ],
    labels = [
        # This is an "umbrella" target to just depend on the mobile subset
        # of folly. Until that changes, removing it via depslint is more
        # hassle than it's worth.
        "depslint_never_remove",
        # This is a legacy "umbrella" target
        "legacy_target",
    ],
    platforms = (ANDROID, APPLE, CXX, WINDOWS, FBCODE),
    soname = "libfolly.$(ext)",
    visibility = ["PUBLIC"],
    windows_msvc_compiler_flags_override = [
        "/EHs",
    ],
    windows_preferred_linkage = "static",
    exported_deps = [
        "fbsource//xplat/folly/io:iobuf",
        "//third-party/boost:boost",
        "//third-party/double-conversion:double-conversion",
        "//third-party/glog:glog",
        "//xplat/folly:atomic_hash_map",
        "//xplat/folly:atomic_linked_list",
        "//xplat/folly:c_portability",
        "//xplat/folly:config",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:conv",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:demangle",
        "//xplat/folly:dynamic",
        "//xplat/folly:exception",
        "//xplat/folly:exception_string",
        "//xplat/folly:executor",
        "//xplat/folly:expected",
        "//xplat/folly:f14_hash",
        "//xplat/folly:fbstring",
        "//xplat/folly:fbvector",
        "//xplat/folly:file",
        "//xplat/folly:format",
        "//xplat/folly:format_traits",
        "//xplat/folly:function",
        "//xplat/folly:functional_apply_tuple",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:functional_partial",
        "//xplat/folly:glog",
        "//xplat/folly:indestructible",
        "//xplat/folly:intrusive_list",
        "//xplat/folly:json",
        "//xplat/folly:likely",
        "//xplat/folly:math",
        "//xplat/folly:micro_lock",
        "//xplat/folly:move_wrapper",
        "//xplat/folly:optional",
        "//xplat/folly:overload",
        "//xplat/folly:portability",
        "//xplat/folly:portability_extended",
        "//xplat/folly:portability_fcntl",
        "//xplat/folly:portability_gflags",
        "//xplat/folly:portability_headers",
        "//xplat/folly:portability_iovec",
        "//xplat/folly:portability_math",
        "//xplat/folly:portability_pthread",
        "//xplat/folly:portability_stdlib",
        "//xplat/folly:portability_sys_resource",
        "//xplat/folly:portability_sys_stat",
        "//xplat/folly:portability_sys_time",
        "//xplat/folly:portability_time",
        "//xplat/folly:portability_windows",
        "//xplat/folly:preprocessor",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly:shared_mutex",
        "//xplat/folly:singleton_thread_local",
        "//xplat/folly:small_vector",
        "//xplat/folly:sorted_vector_types",
        "//xplat/folly:spin_lock",
        "//xplat/folly:synchronization_call_once",
        "//xplat/folly:synchronization_micro_spin_lock",
        "//xplat/folly:synchronization_pico_spin_lock",
        "//xplat/folly:synchronization_small_locks",
        "//xplat/folly:system_thread_id",
        "//xplat/folly:system_thread_name",
        "//xplat/folly:thread_local",
        "//xplat/folly:traits",
        "//xplat/folly:unit",
        "//xplat/folly/concurrency:cache_locality",
        "//xplat/folly/container:array",
        "//xplat/folly/container:enumerate",
        "//xplat/folly/container:foreach",
        "//xplat/folly/container:heap_vector_types",
        "//xplat/folly/container:iterator",
        "//xplat/folly/container:sparse_byte_set",
        "//xplat/folly/detail:futex",
        "//xplat/folly/lang:bits",
        "//xplat/folly/lang:checked_math",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:rvalue_reference_wrapper",
        "//xplat/folly/lang:uncaught_exceptions",
        "//xplat/folly/memory:arena",
        "//xplat/folly/memory:malloc",
    ],
)

non_fbcode_target(
    _kind = folly_extended_xplat_library,
    name = "extended",
    labels = [
        # This library "re-exports" symbosl in :extended_light. Depslint doesn't
        # support the concept of target-reexports (nor do we know the best
        # design for such a feature), so we just exclude this target from being
        # removed.
        "depslint_never_remove",
        # This is a legacy "umbrella" target
        "legacy_target",
    ],
    exported_deps = [
        "//xplat/folly:extended_light",
        "//xplat/folly:observer_container",
        "//xplat/folly:portability_openssl",
        "//xplat/folly/io/async:async_pipe",
        "//xplat/folly/io/async:async_socket",
        "//xplat/folly/io/async:async_ssl_socket",
        "//xplat/folly/io/async:async_transport",
        "//xplat/folly/io/async:async_transport_certificate",
        "//xplat/folly/io/async:decorated_async_transport_wrapper",
        "//xplat/folly/io/async:scoped_event_base_thread",
        "//xplat/folly/io/async:ssl_context",
        "//xplat/folly/io/async:ssl_options",
        "//xplat/folly/io/async/ssl:basic_transport_certificate",
        "//xplat/folly/io/async/ssl:openssl_utils",
        "//xplat/folly/io/async/ssl:ssl_errors",
        "//xplat/folly/net:tcpinfo",
        "//xplat/folly/net:tcpinfo_dispatcher",
        "//xplat/folly/ssl:openssl_cert_utils",
        "//xplat/folly/ssl:openssl_hash",
        "//xplat/folly/ssl:openssl_ptr_types",
        "//xplat/folly/ssl:ssl_session",
        "//xplat/folly/ssl:ssl_session_manager",
        "//xplat/third-party/openssl:crypto",
        "//xplat/third-party/openssl:ssl",
    ],
)

non_fbcode_target(
    _kind = folly_extended_xplat_library,
    name = "extended_light",
    feature = triage_InfrastructureSupermoduleOptou,
    labels = [
        # This library should be used via :extended or :futures. Depslint
        # doesn't support the concept of target-reexports (nor do we know the
        # best design for such a feature), so we just exclude this target from
        # being added.
        "depslint_never_add",
        # This is a legacy "umbrella" target
        "legacy_target",
    ],
    visibility = [
        # Robolectric tests need to be able to see this library
        "//fbandroid/javatests/...",
        # And some robolectric tests live under instrumentation_tests
        "//fbandroid/instrumentation_tests/...",
        "//fbandroid/native/...",
        "//xplat/sonar/android/src/test/...",
        "//xplat/folly:extended",
        "//xplat/folly:futures",
        "fbsource//fbandroid/apps/fblite/xMob-android/...",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:chrono",
        "//xplat/folly:config",
        "//xplat/folly:constexpr_math",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:function",
        "//xplat/folly:functional_apply_tuple",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:functional_partial",
        "//xplat/folly:indexed_mem_pool",
        "//xplat/folly:likely",
        "//xplat/folly:math",
        "//xplat/folly:memory",
        "//xplat/folly:molly",
        "//xplat/folly:move_wrapper",
        "//xplat/folly:mpmc_queue",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:portability_event",
        "//xplat/folly:portability_iovec",
        "//xplat/folly:portability_math",
        "//xplat/folly:portability_windows",
        "//xplat/folly:preprocessor",
        "//xplat/folly:random",
        "//xplat/folly:scope_guard",
        "//xplat/folly:singleton",
        "//xplat/folly:synchronization_hazptr",
        "//xplat/folly:synchronization_lifo_sem",
        "//xplat/folly:synchronized",
        "//xplat/folly:traits",
        "//xplat/folly:turnsequencer",
        "//xplat/folly:unit",
        "//xplat/folly/concurrency:concurrent_hash_map",
        "//xplat/folly/concurrency:priority_unbounded_queue_set",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/container:bit_iterator",
        "//xplat/folly/container:enumerate",
        "//xplat/folly/container:evicting_cache_map",
        "//xplat/folly/container:foreach",
        "//xplat/folly/detail:socket_fast_open",
        "//xplat/folly/executors:cpu_thread_pool_executor",
        "//xplat/folly/executors:global_executor",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/executors:io_thread_pool_executor",
        "//xplat/folly/executors:serial_executor",
        "//xplat/folly/executors/task_queue:priority_lifo_sem_mpmc_queue",
        "//xplat/folly/executors/task_queue:priority_unbounded_blocking_queue",
        "//xplat/folly/executors/task_queue:unbounded_blocking_queue",
        "//xplat/folly/io/async:async_base",
        "//xplat/folly/io/async:async_signal_handler",
        "//xplat/folly/io/async:async_socket_base",
        "//xplat/folly/io/async:async_socket_exception",
        "//xplat/folly/io/async:async_udp_server_socket",
        "//xplat/folly/io/async:async_udp_socket",
        "//xplat/folly/io/async:destructor_check",
        "//xplat/folly/io/async/ssl:tls_definitions",
        "//xplat/folly/lang:checked_math",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:uncaught_exceptions",
        "//xplat/folly/tracing:scoped_trace_section",
        "//xplat/folly/tracing:static_tracepoint",
        "//xplat/third-party/event:event",
    ],
)

non_fbcode_target(
    _kind = fb_xplat_cxx_library,
    name = "futures",
    header_namespace = "",
    apple_sdks = DEFAULT_APPLE_SDKS,
    compiler_flags = CXXFLAGS,
    enable_static_variant = True,
    fbandroid_compiler_flags = FBANDROID_CXXFLAGS,
    fbandroid_deps = [
        "//xplat/third-party/linker_lib:atomic",
    ],
    fbobjc_compiler_flags = FBOBJC_CXXFLAGS,
    feature = triage_InfrastructureSupermoduleOptou,
    labels = [
        # This library "re-exports" symbols in :futures_core. Depslint doesn't
        # support the concept of target-reexports (nor do we know the best
        # design for such a feature), so we just exclude this target from being
        # removed.
        "depslint_never_remove",
        # This is a legacy "umbrella" target
        "legacy_target",
    ],
    platforms = (ANDROID, APPLE, CXX, WINDOWS),
    public_include_directories = [
        "..",
    ],
    soname = "libfolly-futures.$(ext)",
    visibility = ["PUBLIC"],
    windows_clang_compiler_flags_override = [
        "-Wno-deprecated-declarations",
    ],
    windows_msvc_compiler_flags_override = [
        "/EHsc",
    ],
    windows_preferred_linkage = "static",
    deps = [
        "//xplat/folly:memory",
    ],
    exported_deps = [
        ":extended_light",
        ":futures_barrier",
        ":futures_core",
        ":futures_future_splitter",
        ":futures_shared_promise",
        "//third-party/boost:boost",
        "//third-party/boost:boost_system",
        "//xplat/folly:futures_detail_core",
        "//xplat/folly:futures_detail_types",
        "//xplat/folly:futures_portability",
        "//xplat/folly:molly",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly:singleton",
        "//xplat/folly:try",
        "//xplat/folly:turnsequencer",
        "//xplat/folly/executors:executor_with_priority",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/executors:manual_executor",
        "//xplat/folly/executors:queued_immediate_executor",
        "//xplat/folly/executors:timed_drivable_executor",
        "//xplat/folly/experimental/coro:traits",
        "//xplat/folly/io/async:async_base",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "test_test_utils",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "test/TestUtils.h",
    ],
    exported_deps = [
        "//xplat/folly:conv",
        "//xplat/folly:exception_string",
        "//xplat/folly:fbstring",
        "//xplat/folly:fixed_string",
        "//xplat/folly:portability_gtest",
        "//xplat/folly:range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "test_socket_address_test_helper",
    srcs = [
        "test/SocketAddressTestHelper.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "test/SocketAddressTestHelper.h",
    ],
    deps = [
        "//xplat/folly:portability_sockets",
        "//xplat/folly/net:tcpinfo_dispatcher",
    ],
)

# Folly test targets
non_fbcode_target(
    _kind = fb_xplat_cxx_library,
    name = "test-headers",
    header_namespace = "",
    apple_sdks = DEFAULT_APPLE_SDKS,
    force_static = True,
    platforms = (ANDROID, APPLE, CXX, FBCODE, WINDOWS),
    public_include_directories = [
        "..",
    ],
    visibility = ["PUBLIC"],
    deps = [
        ":memory",
        "//xplat/folly/concurrency/test:test-headers",
        "//xplat/folly/container/test:test-headers",
        "//xplat/folly/experimental/flat_combining/test:test-headers",
        "//xplat/folly/futures/test:test-headers",
        "//xplat/folly/logging/test:test-headers",
        "//xplat/folly/tracing/test:test-headers",
    ],
)

non_fbcode_target(
    _kind = fb_xplat_cxx_library,
    name = "test-util",
    header_namespace = "",
    apple_sdks = DEFAULT_APPLE_SDKS,
    compiler_flags = CXXFLAGS + [
        "-Wno-narrowing",
    ],
    fbandroid_compiler_flags = FBANDROID_CXXFLAGS,
    fbandroid_deps = [
        "//xplat/third-party/linker_lib:atomic",
    ],
    fbobjc_compiler_flags = FBOBJC_CXXFLAGS,
    platforms = (ANDROID, APPLE, CXX, FBCODE, WINDOWS),
    visibility = ["PUBLIC"],
    deps = [
        "//third-party/boost:boost",
        "//third-party/boost:boost_regex",
        "//xplat/folly:memory",
    ],
    exported_deps = [
        "fbsource//xplat/folly/io:typed_io_buf",
        "//third-party/boost:boost_filesystem",
        "//third-party/boost:boost_system",
        "//xplat/folly:discriminated_ptr",
        "//xplat/folly:extended",
        "//xplat/folly:logging_init",
        "//xplat/folly:logging_init_weak",
        "//xplat/folly:logging_log_handler",
        "//xplat/folly:logging_log_level",
        "//xplat/folly:logging_log_name",
        "//xplat/folly:logging_logging",
        "//xplat/folly:logging_rate_limiter",
        "//xplat/folly:molly",
        "//xplat/folly:portability_gmock",
        "//xplat/folly:portability_gtest",
        "//xplat/folly:stop_watch",
        "//xplat/folly:synchronization_rcu",
        "//xplat/folly/detail:discriminated_ptr_detail",
        "//xplat/folly/fibers:core",
        "//xplat/folly/fibers:event_base_loop_controller",
        "//xplat/folly/fibers:fiber_manager_map",
        "//xplat/folly/io/async:server_socket",
    ],
)

FOLLY_TEST_SRCS = [
    "test/ApplyTupleTest.cpp",
    "test/CallOnceTest.cpp",
    "test/ConvTest.cpp",
    # "test/CpuIdTest.cpp",
    "test/DemangleTest.cpp",
    "test/DynamicConverterTest.cpp",
    "test/FBStringTest.cpp",
    "test/FBVectorTestUtil.cpp",
    "test/FBVectorTest.cpp",
    "test/ForeachTest.cpp",
    "test/FormatTest.cpp",
    "test/FunctionTest.cpp",
    "test/HashTest.cpp",
    "test/LoggingTest.cpp",
    "test/MacAddressTest.cpp",
    "test/MathTest.cpp",
    "test/MoveWrapperTest.cpp",
    "test/OptionalTest.cpp",
    "test/PortabilityTest.cpp",
    # "test/RandomTest.cpp",
    # "test/RangeTest.cpp",
    # "test/ScopeGuardTest.cpp",
    "test/SmallLocksTest.cpp",
    "test/StringTest.cpp",
    "test/TraitsTest.cpp",
]

FOLLY_EXTENDED_TEST_SRCS = [
    "test/AtomicStructTest.cpp",
    "test/CacheLocalityTest.cpp",
    "test/EvictingCacheMapTest.cpp",
    # "test/ExceptionWrapperTest.cpp",
    "test/MemoryIdlerTest.cpp",
]

non_fbcode_target(
    _kind = fb_xplat_cxx_test,
    name = "folly-test",
    srcs = glob(FOLLY_TEST_SRCS),
    compiler_flags = CXXFLAGS + [
        "-Wno-unused-private-field",
    ],
    contacts = ["oncall+folly@xmail.facebook.com"],
    fbandroid_compiler_flags = FBANDROID_CXXFLAGS,
    fbandroid_cpu_suffixes = [
        "64bit",
        None,
    ],
    fbobjc_compiler_flags = FBOBJC_CXXFLAGS + [
        "-Wno-format",
        "-Wno-missing-prototypes",
        "-Wno-shadow",
    ],
    platforms = (ANDROID, APPLE, CXX, WINDOWS),
    preprocessor_flags = CPPFLAGS + [
        "-DFOLLY_SKIP_AS_FAILURE=0",
    ] + select({
        "DEFAULT": [],
        "ovr_config//os:linux": FBANDROID_CPPFLAGS,
    }),
    use_instrumentation_test = True,
    deps = [
        "//third-party/boost:boost",
        "//third-party/boost:boost_regex",
        "//third-party/googletest:gmock_main",
        "//xplat/folly:expected",
        "//xplat/folly:extended",
        "//xplat/folly:fixed_string",
        "//xplat/folly:memory",
        "//xplat/folly:molly",
        "//xplat/folly:optional",
        "//xplat/folly:test-headers",
        "//xplat/folly:test-util",
        "//xplat/folly/lang:keep",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_cxx_test,
    name = "folly-extended-test",
    srcs = glob(FOLLY_EXTENDED_TEST_SRCS),
    compiler_flags = CXXFLAGS,
    fbandroid_compiler_flags = FBANDROID_CXXFLAGS,
    fbobjc_compiler_flags = FBOBJC_CXXFLAGS,
    platforms = (ANDROID, APPLE, CXX, WINDOWS),
    preprocessor_flags = CPPFLAGS + select({
        "DEFAULT": [],
        "ovr_config//os:linux": FBANDROID_CPPFLAGS,
    }),
    use_instrumentation_test = True,
    deps = [
        "//third-party/boost:boost",
        "//third-party/boost:boost_regex",
        "//third-party/googletest:gmock_main",
        "//xplat/folly:extended",
        "//xplat/folly:molly",
        "//xplat/folly:test-headers",
        "//xplat/folly:test-util",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_cxx_test,
    name = "folly-futures-test",
    srcs = [
        "futures/test/BarrierTest.cpp",
        "futures/test/ContextTest.cpp",
        "futures/test/CoreTest.cpp",
        "futures/test/EnsureTest.cpp",
        "futures/test/FilterTest.cpp",
        "futures/test/HeaderCompileTest.cpp",
        "futures/test/MapTest.cpp",
        "futures/test/NonCopyableLambdaTest.cpp",
        "futures/test/PollTest.cpp",
        "futures/test/PromiseTest.cpp",
        "futures/test/ReduceTest.cpp",
        "futures/test/SelfDestructTest.cpp",
        "futures/test/SharedPromiseTest.cpp",
        "futures/test/TestExecutor.cpp",
        "futures/test/ThenCompileTest.cpp",
        "futures/test/ThenTest.cpp",
        "futures/test/TimesTest.cpp",
        "futures/test/UnwrapTest.cpp",
        "futures/test/ViaTest.cpp",
        "futures/test/WhenTest.cpp",
        "futures/test/WhileDoTest.cpp",
        "futures/test/WillEqualTest.cpp",
    ],
    compiler_flags = CXXFLAGS + select({
        "DEFAULT": [],
        "ovr_config//os:android": FBANDROID_CXXFLAGS + [
            "-Wno-deprecated-declarations",
        ],
    }),
    # TODO(T188948036): Fix xplat/folly:folly-futures-test and folly_xplat_cxx_test
    # The arguments below are unused by folly_xplat_cxx_test.
    # They need to be investigated and fixed (i.e., correctly used or removed).
    cxx_srcs = [
        "futures/test/FutureTest.cpp",
        "futures/test/InterruptTest.cpp",
        "futures/test/TimekeeperTest.cpp",
        "futures/test/WaitTest.cpp",
        "futures/test/WindowTest.cpp",
    ],
    fbobjc_compiler_flags = FBOBJC_CXXFLAGS,
    fbobjc_srcs = [
        "futures/test/FutureTest.cpp",
        "futures/test/InterruptTest.cpp",
        "futures/test/TimekeeperTest.cpp",
        "futures/test/WaitTest.cpp",
        "futures/test/WindowTest.cpp",
    ],
    include_directories = [
        "..",
    ],
    platforms = (ANDROID, APPLE, CXX, WINDOWS),
    preprocessor_flags = CPPFLAGS + select({
        "DEFAULT": [],
        "ovr_config//os:linux": FBANDROID_CPPFLAGS,
    }),
    raw_headers = glob([
        "futures/test/ThenCompileTest.h",
    ]),
    use_instrumentation_test = True,
    deps = [
        "//third-party/boost:boost",
        "//third-party/boost:boost_system",
        "//third-party/boost:boost_thread",
        "//third-party/googletest:gtest_main",
        "//xplat/folly:extended",
        "//xplat/folly:futures",
        "//xplat/folly:memory",
        "//xplat/folly:molly",
        "//xplat/folly:test-headers",
        "//xplat/folly:test-util",
        "//xplat/folly/test/common:test_main",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_cxx_test,
    name = "system_test_thread_id_test",
    srcs = [
        "system/test/ThreadIdTest.cpp",
    ],
    include_directories = [
        "..",
    ],
    platforms = (CXX,),
    preprocessor_flags = CPPFLAGS + select({
        "DEFAULT": [],
        "ovr_config//os:linux": FBANDROID_CPPFLAGS,
    }),
    deps = [
        ":benchmark",
        "//xplat/folly:portability_pthread",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_cxx_test,
    name = "system_test_thread_name_test",
    srcs = [
        "system/test/ThreadNameTest.cpp",
    ],
    include_directories = [
        "..",
    ],
    platforms = (CXX,),
    preprocessor_flags = CPPFLAGS + select({
        "DEFAULT": [],
        "ovr_config//os:linux": FBANDROID_CPPFLAGS,
    }),
    deps = [
        "//xplat/folly:portability_pthread",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sched",
    srcs = [
        "portability/Sched.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Sched.h",
    ],
    deps = [
        "//xplat/folly:portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_sys_syscall",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/SysSyscall.h",
    ],
    exported_deps = [
        ":c_portability",
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_stack_trace",
    srcs = [
        "debugging/symbolizer/StackTrace.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/StackTrace.h",
        "experimental/symbolizer/StackTrace.h",
    ],
    deps = [
        ":cpp_attributes",
        ":portability",
        ":portability_config",
        "//xplat/folly/tracing:async_stack",
    ],
    exported_deps = [
        ":portability_libunwind",
        ":portability_sys_types",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_detail_double_radix_sort",
    srcs = [
        "stats/detail/DoubleRadixSort.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/detail/DoubleRadixSort.h",
    ],
    deps = [
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_detail_types",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "futures/detail/Types.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_detail_bucket",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/detail/Bucket.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_syslog",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Syslog.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "timeout_queue",
    srcs = [
        "TimeoutQueue.cpp",
    ],
    apple_sdks = (IOS, MACOSX),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "TimeoutQueue.h",
    ],
    deps = [
        "//third-party/boost:boost",
        "//third-party/boost:boost_multi_index",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_libgen",
    srcs = [
        "portability/Libgen.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Libgen.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "try",
    srcs = [
        "Try.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Try.h",
        "Try-inl.h",
    ],
    deps = [
        ":exception_wrapper",
        ":functional_invoke",
        ":likely",
        ":memory",
        ":portability",
        ":unit",
        ":utility",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "thread_cached_int",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ThreadCachedInt.h",
    ],
    deps = [
        ":likely",
        ":thread_local",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "cancellation_token",
    srcs = [
        "CancellationToken.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "CancellationToken.h",
        "CancellationToken-inl.h",
    ],
    deps = [
        ":cpp_attributes",
        ":function",
        ":operation_cancelled",
        ":optional",
        ":portability_memory",
        ":scope_guard",
        ":synchronization_detail_sleeper",
        "//third-party/glog:glog",
        "//xplat/folly/lang:new",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_gmock",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/GMock.h",
    ],
    deps = [
        "//third-party/googletest:gmock",
    ],
    exported_deps = [
        ":portability",
        ":portability_unistd",
        ":portability_windows",
        "//third-party/googletest:gmock",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_bucketed_time_series",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/BucketedTimeSeries.h",
        "stats/BucketedTimeSeries-inl.h",
    ],
    deps = [
        ":likely",
        ":stats_detail_bucket",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_histogram",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/Histogram.h",
        "stats/Histogram-inl.h",
    ],
    deps = [
        ":c_portability",
        ":conv",
        ":stats_detail_bucket",
        ":traits",
        "//third-party/glog:glog",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "quantile_histogram",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/QuantileHistogram.h",
        "stats/QuantileHistogram-inl.h",
    ],
    deps = [
        ":c_portability",
        ":conv",
        ":stats_digest_builder",
        "//third-party/glog:glog",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_streaming_stats",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/StreamingStats.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_memory_mapping",
    srcs = [
        "system/MemoryMapping.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//build_mode:whatsapp": [
            "-fexceptions",
            "-frtti",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/MemoryMapping.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:experimental_io_huge_pages",
        "//xplat/folly:file",
        "//xplat/folly:portability",
        "//xplat/folly:portability_gflags",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly:portability_sys_syscall",
        "//xplat/folly:range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_io_huge_pages",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/experimental/io:huge_pages",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_io_fs_util",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/experimental/io:fs_util",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_cleanup",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "futures/Cleanup.h",
    ],
    deps = [
        ":futures_core",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_base",
    apple_sdks = DEFAULT_APPLE_SDKS,
    raw_headers = [
        "gen/Base.h",
        "gen/Base-inl.h",
    ],
    deps = [
        "//third-party/range-v3:range-v3",
        "//xplat/folly:conv",
        "//xplat/folly:functional_invoke",
        "//xplat/folly:gen_core",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:range",
        "//xplat/folly:utility",
        "//xplat/folly/container:access",
        "//xplat/folly/container:f14_hash",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_file",
    raw_headers = [
        "gen/File.h",
        "gen/File-inl.h",
    ],
    deps = [
        ":exception",
        ":file",
        ":gen_base",
        ":gen_string",
        ":io_iobuf",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_string",
    raw_headers = [
        "gen/String.h",
        "gen/String-inl.h",
    ],
    exported_deps = [
        ":conv",
        ":gen_base",
        ":io_iobuf",
        ":portability",
        ":range",
        ":string",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_core",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "gen/Core.h",
        "gen/Core-inl.h",
    ],
    deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_global_shutdown_socket_set",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/io:global_shutdown_socket_set",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_function_scheduler",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/FunctionScheduler.h",
    ],
    deps = [
        "//xplat/folly/executors:function_scheduler",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_spooky_hash_v1",
    srcs = [
        "hash/SpookyHashV1.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/SpookyHashV1.h",
    ],
    deps = [
        ":cpp_attributes",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_traits",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/traits.h",
    ],
    deps = [
        ":traits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_murmur_hash",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/MurmurHash.h",
    ],
    deps = [
        ":bits",
        ":c_portability",
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_asm",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Asm.h",
    ],
    deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_malloc",
    srcs = [
        "portability/Malloc.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Malloc.h",
    ],
    deps = [
        # "//xplat/third-party/jemalloc:headers",  # not available in xplat
        ":bits",
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "poly_exception",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "PolyException.h",
    ],
    deps = [
        ":c_portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_farm_hash",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/FarmHash.h",
    ],
    deps = [
        ":external_farmhash_farmhash",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_rapidhash",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/rapidhash.h",
    ],
    deps = [
        ":external_rapidhash",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_init_weak",
    srcs = [
        "logging/InitWeak.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        ":c_portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_portability",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "futures/Portability.h",
    ],
    deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "clock_gettime_wrappers",
    srcs = [
        "ClockGettimeWrappers.cpp",
    ],
    cxx_deps = ["//third-party/toolchains:rt"],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ClockGettimeWrappers.h",
    ],
    deps = [
        ":c_portability",
        ":likely",
        ":portability_time",
        "//xplat/third-party/linker_lib:dl",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_atomic",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Atomic.h",
    ],
    deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_spooky_hash_v2",
    srcs = [
        "hash/SpookyHashV2.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/SpookyHashV2.h",
    ],
    deps = [
        ":cpp_attributes",
        ":portability",
        "//xplat/folly/lang:c_string",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "concurrent_bit_set",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ConcurrentBitSet.h",
    ],
    deps = [
        ":portability",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "padded",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Padded.h",
    ],
    deps = [
        ":portability",
        ":portability_sys_types",
        ":traits",
        "//third-party/boost:boost",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_istream",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "gen/IStream.h",
    ],
    deps = [
        ":gen_core",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_hardware",
    srcs = [
        "synchronization/detail/Hardware.cpp",
    ],
    compiler_flags = [
        "-mrtm",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/Hardware.h",
    ],
    deps = [
        "//third-party/boost:boost",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:portability",
        "//xplat/folly/lang:assume",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "replaceable",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Replaceable.h",
    ],
    deps = [
        ":portability",
        ":traits",
        ":utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_rate_limiter",
    srcs = [
        "logging/RateLimiter.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/RateLimiter.h",
    ],
    deps = [
        ":chrono",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_glog_bridge",
    srcs = [
        "logging/BridgeFromGoogleLogging.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/BridgeFromGoogleLogging.h",
    ],
    deps = [
        ":logging_logging",
        "//third-party/glog:glog",
        "//xplat/folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "rw_spin_lock",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "RWSpinLock.h",
    ],
    deps = [
        ":synchronization_rw_spin_lock",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_gtest",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/GTest.h",
    ],
    exported_deps = [
        ":portability",
        ":portability_unistd",
        ":portability_windows",
        "//third-party/googletest:gtest",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_gtest_prod",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["portability/GTestProd.h"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_at_fork",
    srcs = [
        "system/AtFork.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/AtFork.h",
    ],
    deps = [
        ":function",
        ":portability_pthread",
        ":scope_guard",
        ":synchronization_sanitize_thread",
        "//xplat/folly:portability_sys_types",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_detail_sliding_window",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/detail/SlidingWindow.h",
        "stats/detail/SlidingWindow-inl.h",
    ],
    deps = [
        ":function",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "fingerprint",
    srcs = [
        "Fingerprint.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Fingerprint.h",
    ],
    deps = [
        ":portability",
        ":range",
        ":utility",
        "//xplat/folly/detail:fingerprint_polynomial",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_memory",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Memory.h",
    ],
    deps = [
        ":memory",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "micro_spin_lock",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MicroSpinLock.h",
    ],
    deps = [
        ":synchronization_micro_spin_lock",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_tdigest",
    srcs = [
        "stats/TDigest.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/TDigest.h",
    ],
    deps = [
        ":overload",
        ":range",
        ":stats_detail_double_radix_sort",
        ":utility",
        "//third-party/glog:glog",
        "//xplat/folly/algorithm:binary_heap",
        "//xplat/folly/memory:malloc",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "discriminated_ptr",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "DiscriminatedPtr.h",
    ],
    deps = [
        ":likely",
        ":portability",
        "//third-party/glog:glog",
        "//xplat/folly/detail:discriminated_ptr_detail",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "group_varint",
    srcs = [
        "GroupVarint.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "GroupVarint.h",
    ],
    deps = [
        ":portability",
        ":portability_builtins",
        ":range",
        "//third-party/glog:glog",
        "//xplat/folly/container:array",
        "//xplat/folly/detail:group_varint_detail",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_log_name",
    srcs = [
        "logging/LogName.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/LogName.h",
    ],
    deps = [
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "lazy",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Lazy.h",
    ],
    deps = [
        ":functional_invoke",
        ":optional",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "hash_hash",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "hash/Hash.h",
    ],
    deps = [
        ":functional_apply_tuple",
        ":hash_murmur_hash",
        ":hash_spooky_hash_v1",
        ":hash_spooky_hash_v2",
        ":traits",
        ":utility",
        "//xplat/folly:c_portability",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "utf8_string",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "UTF8String.h",
    ],
    deps = [
        ":range",
        "//third-party/boost:boost_regex",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "utf8_string_icu",
    apple_sdks = (IOS, MACOSX),
    enable_static_variant = False,
    feature = triage_InfrastructureSupermoduleOptou,
    platforms = (CXX, ANDROID, APPLE),
    raw_headers = [
        "UTF8String.h",
    ],
    deps = [
        ":range",
        "//third-party/boost:boost_regex_icu",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_threaded_repeating_function_runner",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/ThreadedRepeatingFunctionRunner.h",
    ],
    deps = [
        "//xplat/folly/executors:threaded_repeating_function_runner",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "poly",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Poly.h",
        "Poly-inl.h",
    ],
    deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:poly_exception",
        "//xplat/folly:traits",
        "//xplat/folly/detail:poly_detail",
        "//xplat/folly/detail:typelist",
        "//xplat/folly/lang:assume",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "portability_stdio",
    srcs = [
        "portability/Stdio.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "portability/Stdio.h",
    ],
    deps = [
        ":portability_unistd",
        ":scope_guard",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "unicode",
    srcs = [
        "Unicode.cpp",
    ],
    compiler_flags = select({
        "DEFAULT": [],
        "ovr_config//build_mode:whatsapp": [
            "-fexceptions",
            "-frtti",
        ],
    }),
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Unicode.h",
    ],
    deps = [
        ":conv",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_log_level",
    srcs = [
        "logging/LogLevel.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/LogLevel.h",
    ],
    deps = [
        ":conv",
        ":portability",
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "init_init",
    srcs = [
        "init/Init.cpp",
    ],
    fbcode_deps = [
        "fbcode//folly/experimental/symbolizer:signal_handler",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "init/Init.h",
    ],
    deps = [
        ":experimental_symbolizer_symbolizer",
        ":init_phase",
        ":logging_init",
        ":portability",
        ":portability_config",
        ":portability_gflags",
        ":portability_sys_syscall",
        ":singleton",
        ":synchronization_hazptr_thread_pool_executor",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "init_phase",
    srcs = [
        "init/Phase.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "init/Phase.h",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_pid",
    srcs = [
        "system/Pid.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/Pid.h",
    ],
    deps = [
        ":likely",
        ":portability_unistd",
        ":system_at_fork",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_init",
    srcs = [
        "logging/Init.cpp",
        "logging/LogConfigParser.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/Init.h",
        "logging/LogConfigParser.h",
    ],
    deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:conv",
        "//xplat/folly:dynamic",
        "//xplat/folly:json",
        "//xplat/folly:logging_init_weak",
        "//xplat/folly:logging_log_name",
        "//xplat/folly:logging_logging",
        "//xplat/folly:range",
        "//xplat/folly:string",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_logging",
    srcs = [
        "logging/AsyncFileWriter.cpp",
        "logging/AsyncLogWriter.cpp",
        "logging/CustomLogFormatter.cpp",
        "logging/FileWriterFactory.cpp",
        "logging/GlogStyleFormatter.cpp",
        "logging/ImmediateFileWriter.cpp",
        "logging/LogCategory.cpp",
        "logging/LogCategoryConfig.cpp",
        "logging/LogConfig.cpp",
        "logging/LogMessage.cpp",
        "logging/LogStream.cpp",
        "logging/LogStreamProcessor.cpp",
        "logging/Logger.cpp",
        "logging/LoggerDB.cpp",
        "logging/ObjectToString.cpp",
        "logging/StandardLogHandler.cpp",
        "logging/StandardLogHandlerFactory.cpp",
        "logging/StreamHandlerFactory.cpp",
        "logging/xlog.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "logging/AsyncFileWriter.h",
        "logging/AsyncLogWriter.h",
        "logging/CustomLogFormatter.h",
        "logging/FileWriterFactory.h",
        "logging/GlogStyleFormatter.h",
        "logging/ImmediateFileWriter.h",
        "logging/LogCategory.h",
        "logging/LogCategoryConfig.h",
        "logging/LogConfig.h",
        "logging/LogFormatter.h",
        "logging/LogMessage.h",
        "logging/LogStream.h",
        "logging/LogStreamProcessor.h",
        "logging/LogWriter.h",
        "logging/Logger.h",
        "logging/LoggerDB.h",
        "logging/ObjectToString.h",
        "logging/StandardLogHandler.h",
        "logging/StandardLogHandlerFactory.h",
        "logging/StreamHandlerFactory.h",
        "logging/xlog.h",
    ],
    deps = [
        ":constexpr_math",
        ":demangle",
        ":exception",
        ":file_util",
        ":format",
        ":map_util",
        ":portability_pthread",
        ":portability_time",
        ":portability_unistd",
        ":string",
        ":system_at_fork",
        ":system_thread_id",
        ":system_thread_name",
    ],
    exported_deps = [
        ":c_portability",
        ":conv",
        ":cpp_attributes",
        ":exception_string",
        ":file",
        ":likely",
        ":logging_log_handler",
        ":logging_log_level",
        ":logging_log_name",
        ":logging_rate_limiter",
        ":optional",
        ":portability",
        ":range",
        ":scope_guard",
        ":synchronized",
        "//third-party/fmt:fmt",
        "//xplat/folly/detail:static_singleton_manager",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:type_info",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_log_handler",
    srcs = [
        "logging/LogHandlerConfig.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/LogHandler.h",
        "logging/LogHandlerConfig.h",
        "logging/LogHandlerFactory.h",
    ],
    deps = [
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:logging_log_level",
        "//xplat/folly:optional",
        "//xplat/folly:range",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_typed_io_buf",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/io:typed_io_buf",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_multi_level_time_series",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/MultiLevelTimeSeries.h",
        "stats/MultiLevelTimeSeries-inl.h",
    ],
    deps = [
        ":constexpr_math",
        ":stats_bucketed_time_series",
        ":string",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_env_util",
    srcs = [
        "system/EnvUtil.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/EnvUtil.h",
    ],
    deps = [
        ":c_portability",
        ":memory",
        ":portability_stdlib",
        ":portability_unistd",
        ":string",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_shell",
    srcs = [
        "system/Shell.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/Shell.h",
    ],
    deps = [
        ":conv",
        ":format",
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "system_hardware_concurrency",
    srcs = [
        "system/HardwareConcurrency.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "system/HardwareConcurrency.h",
    ],
    deps = [
        ":portability_sched",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_program_options",
    srcs = [
        "cli/NestedCommandLineApp.cpp",
        "cli/ProgramOptions.cpp",
    ],
    apple_sdks = (IOS, MACOSX),
    fbandroid_deps = [
        "//third-party/gflags:gflags",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    platforms = (ANDROID, APPLE, CXX, FBCODE, WINDOWS),
    raw_headers = [
        "cli/NestedCommandLineApp.h",
        "cli/ProgramOptions.h",
    ],
    # Note: keeping relative target labels otherwise fbcode_macros will complain about a dependency
    # on a restricted repo since experimental_program_options is in fbcode_allowed_list.bzl.
    deps = [
        ":c_portability",
        ":conv",
        ":experimental_io_fs_util",
        ":file_util",
        ":format",
        ":optional",
        ":portability",
        ":portability_gflags",
        ":string",
        "//third-party/boost:boost",
        "//third-party/boost:boost_program_options",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_detail_debug",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/detail/Debug.h",
        "experimental/symbolizer/detail/Debug.h",
    ],
    deps = [
        ":cpp_attributes",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_line_reader",
    srcs = [
        "debugging/symbolizer/LineReader.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/LineReader.h",
        "experimental/symbolizer/LineReader.h",
    ],
    deps = [
        ":file_util",
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_auto_timer",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/AutoTimer.h",
    ],
    deps = [
        ":conv",
        ":format",
        ":optional",
        ":string",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_timeseries_histogram",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/TimeseriesHistogram.h",
        "stats/TimeseriesHistogram-inl.h",
    ],
    deps = [
        ":stats_histogram",
        ":stats_multi_level_time_series",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_elf",
    srcs = [
        "debugging/symbolizer/Elf.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/Elf.h",
        "debugging/symbolizer/Elf-inl.h",
        "experimental/symbolizer/Elf.h",
        "experimental/symbolizer/Elf-inl.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:conv",
        "//xplat/folly:exception",
        "//xplat/folly:likely",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly/lang:c_string",
        "//xplat/folly/lang:safe_assert",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "token_bucket",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "TokenBucket.h",
    ],
    deps = [
        ":constexpr_math",
        ":likely",
        ":optional",
    ],
    exported_deps = [
        "//xplat/folly/concurrency:cache_locality",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "producer_consumer_queue",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ProducerConsumerQueue.h",
    ],
    exported_deps = [
        "//xplat/folly/concurrency:cache_locality",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_elf_cache",
    srcs = ["debugging/symbolizer/ElfCache.cpp"],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/ElfCache.h",
        "experimental/symbolizer/ElfCache.h",
    ],
    exported_deps = [
        ":experimental_symbolizer_elf",
        ":scope_guard",
        "//third-party/boost:boost",
        "//xplat/folly:conv",
        "//xplat/folly:hash_hash",
        "//xplat/folly:optional",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly/memory:reentrant_allocator",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_dwarf",
    srcs = [
        "debugging/symbolizer/Dwarf.cpp",
        "debugging/symbolizer/DwarfImpl.cpp",
        "debugging/symbolizer/DwarfLineNumberVM.cpp",
        "debugging/symbolizer/DwarfSection.cpp",
        "debugging/symbolizer/DwarfUtil.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/Dwarf.h",
        "debugging/symbolizer/DwarfImpl.h",
        "debugging/symbolizer/DwarfLineNumberVM.h",
        "debugging/symbolizer/DwarfSection.h",
        "debugging/symbolizer/DwarfUtil.h",
        "experimental/symbolizer/Dwarf.h",
        "experimental/symbolizer/DwarfImpl.h",
        "experimental/symbolizer/DwarfLineNumberVM.h",
        "experimental/symbolizer/DwarfSection.h",
        "experimental/symbolizer/DwarfUtil.h",
    ],
    deps = [
        ":experimental_symbolized_frame",
        ":experimental_symbolizer_elf_cache",
        ":function",
        ":portability_sys_mman",
        ":scope_guard",
        "//third-party/boost:boost",
        "//third-party/glog:glog",
        "//third-party/libdwarf:dwarf",
        "//xplat/folly:experimental_symbolizer_elf",
        "//xplat/folly:optional",
        "//xplat/folly:portability_unistd",
        "//xplat/folly:range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolized_frame",
    srcs = [
        "debugging/symbolizer/SymbolizedFrame.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/SymbolizedFrame.h",
        "experimental/symbolizer/SymbolizedFrame.h",
    ],
    deps = [
        ":experimental_symbolizer_elf",
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_event_count",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/EventCount.h",
        "synchronization/EventCount.h",
    ],
    deps = [
        ":likely",
        ":portability_sys_time",
        ":portability_unistd",
        "//third-party/glog:glog",
        "//xplat/folly/detail:futex",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "packed_sync_ptr",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "PackedSyncPtr.h",
    ],
    deps = [
        ":portability",
        ":synchronization_small_locks",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_combine",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "gen/Combine.h",
        "gen/Combine-inl.h",
    ],
    deps = [
        ":gen_base",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronized_ptr",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "SynchronizedPtr.h",
    ],
    deps = [
        ":synchronized",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_parallel",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "gen/Parallel.h",
        "gen/Parallel-inl.h",
    ],
    deps = [
        ":experimental_event_count",
        ":gen_base",
        ":mpmc_queue",
        ":scope_guard",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_symbolizer_detail",
    srcs = [
        "debugging/symbolizer/detail/Debug.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/detail/Debug.h",
    ],
    deps = [
        ":portability",
        "//xplat/third-party/linker_lib:dl",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_symbolizer_symbolizer",
    srcs = [
        "debugging/symbolizer/SignalHandler.cpp",
        "debugging/symbolizer/SymbolizePrinter.cpp",
        "debugging/symbolizer/Symbolizer.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "debugging/symbolizer/SignalHandler.h",
        "debugging/symbolizer/SymbolizePrinter.h",
        "debugging/symbolizer/Symbolizer.h",
        "experimental/symbolizer/SignalHandler.h",
        "experimental/symbolizer/SymbolizePrinter.h",
        "experimental/symbolizer/Symbolizer.h",
    ],
    deps = [
        "fbsource//xplat/folly/io:iobuf",
        ":experimental_symbolizer_symbolizer_detail",
        ":scope_guard",
        "//third-party/glog:glog",
        "//xplat/folly:experimental_symbolizer_detail_debug",
        "//xplat/folly:experimental_symbolizer_dwarf",
        "//xplat/folly:experimental_symbolizer_elf_cache",
        "//xplat/folly:experimental_symbolizer_line_reader",
        "//xplat/folly:experimental_symbolizer_stack_trace",
        "//xplat/folly:fbstring",
        "//xplat/folly:file_util",
        "//xplat/folly:memory",
        "//xplat/folly:optional",
        "//xplat/folly:portability_sys_mman",
        "//xplat/folly:portability_sys_syscall",
        "//xplat/folly:range",
        "//xplat/folly:scope_guard",
        "//xplat/folly:string",
        "//xplat/folly:synchronized",
        "//xplat/folly/container:evicting_cache_map",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/lang:to_ascii",
        "//xplat/folly/memory:sanitize_address",
        "//xplat/folly/tracing:async_stack",
    ],
    exported_deps = [
        "//xplat/folly:portability_unistd",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_digest_builder",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/DigestBuilder.h",
        "stats/DigestBuilder-inl.h",
    ],
    deps = [
        ":spin_lock",
        ":synchronization_lock",
    ],
    exported_deps = [
        "//xplat/folly/concurrency:cache_locality",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_file_handler_factory",
    srcs = [
        "logging/FileHandlerFactory.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/FileHandlerFactory.h",
    ],
    deps = [
        ":logging_log_handler",
        ":logging_logging",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_dynamic_parser",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/json:dynamic_parser",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "logging_example_lib",
    srcs = [
        "logging/example/lib.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "logging/example/lib.h",
    ],
    deps = [
        ":logging_logging",
        ":range",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "mpmc_pipeline",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "MPMCPipeline.h",
    ],
    deps = [
        ":portability",
        "//third-party/glog:glog",
        "//xplat/folly/detail:mpmc_pipeline_detail",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "gen_parallel_map",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "gen/ParallelMap.h",
        "gen/ParallelMap-inl.h",
    ],
    deps = [
        ":expected",
        ":experimental_event_count",
        ":functional_invoke",
        ":gen_core",
        ":mpmc_pipeline",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_detail_rcu-detail",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/detail/ThreadCachedLists.h",
        "synchronization/detail/ThreadCachedReaders.h",
        "synchronization/detail/ThreadCachedTag.h",
    ],
    deps = [
        ":function",
        ":synchronization_asymmetric_thread_fence",
        ":synchronization_relaxed_atomic",
        ":synchronized",
        ":thread_local",
        "//third-party/glog:glog",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "concurrent_lazy",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["ConcurrentLazy.h"],
    deps = [
        ":functional_invoke",
        ":synchronization_delayed_init",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "concurrent_skip_list",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "ConcurrentSkipList.h",
        "ConcurrentSkipList-inl.h",
    ],
    deps = [
        ":constexpr_math",
        ":likely",
        ":memory",
        ":synchronization_micro_spin_lock",
        ":thread_local",
        "//third-party/boost:boost_random",
        "//third-party/glog:glog",
        "//xplat/folly/detail:iterators",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_detail_buffered_stat",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/detail/BufferedStat.h",
        "stats/detail/BufferedStat-inl.h",
    ],
    deps = [
        ":shared_mutex",
        ":stats_detail_sliding_window",
        ":stats_digest_builder",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_settings_settings",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/settings/Immutables.h",
        "experimental/settings/Settings.h",
        "experimental/settings/Types.h",
        "experimental/settings/detail/SettingsImpl.h",
    ],
    deps = [
        "//xplat/folly/settings:settings_settings",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "default_keep_alive_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "DefaultKeepAliveExecutor.h",
    ],
    exported_deps = [
        ":executor",
        ":synchronization_baton",
        "//third-party/glog:glog",
        "//xplat/folly/executors:sequenced_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "virtual_executor",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "VirtualExecutor.h",
    ],
    exported_deps = [
        "//xplat/folly/executors:virtual_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "atomic_hash_array",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "AtomicHashArray.h",
        "AtomicHashArray-inl.h",
    ],
    deps = [
        "//xplat/folly:hash_hash",
        "//xplat/folly:thread_cached_int",
        "//xplat/folly:utility",
        "//xplat/folly/detail:atomic_hash_utils",
        "//xplat/folly/detail:iterators",
        "//xplat/folly/lang:bits",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_flat_combining_priority_queue",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/FlatCombiningPriorityQueue.h",
    ],
    deps = [
        "//xplat/folly/concurrency/container:flat_combining_priority_queue",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "atomic_unordered_map",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "AtomicUnorderedMap.h",
    ],
    deps = [
        ":conv",
        ":likely",
        ":portability_sys_mman",
        ":portability_unistd",
        ":random",
        ":scope_guard",
        ":traits",
        "//xplat/folly/detail:atomic_unordered_map_utils",
        "//xplat/folly/lang:bits",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_detail_core",
    srcs = [
        "futures/detail/Core.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "futures/detail/Core.h",
    ],
    exported_deps = [
        ":executor",
        ":function",
        ":futures_detail_types",
        ":optional",
        ":scope_guard",
        ":synchronization_atomic_util",
        ":synchronization_micro_spin_lock",
        ":try",
        ":utility",
        "//third-party/fmt:fmt",
        "//third-party/glog:glog",
        "//xplat/folly/io/async:request_context",
        "//xplat/folly/lang:assume",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_example_hazptr_swmr_set",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/example/HazptrSWMRSet.h",
    ],
    deps = [
        ":synchronization_hazptr",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_example_hazptr_lock_free_lifo",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/example/HazptrLockFreeLIFO.h",
    ],
    deps = [
        ":synchronization_hazptr",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "stats_quantile_estimator",
    srcs = [
        "stats/QuantileEstimator.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "stats/QuantileEstimator.h",
        "stats/QuantileEstimator-inl.h",
    ],
    deps = [
        ":stats_detail_buffered_stat",
        ":stats_tdigest",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "io_record_io",
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//xplat/folly/io:record_io",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "synchronization_example_hazptr_wide_cas",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "synchronization/example/HazptrWideCAS.h",
    ],
    deps = [
        ":synchronization_hazptr",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "json_schema",
    apple_sdks = (IOS, MACOSX),
    feature = triage_InfrastructureSupermoduleOptou,
    platforms = (APPLE, CXX, FBCODE, WINDOWS),
    exported_deps = [
        "//xplat/folly/json:json_schema",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_core",
    srcs = [
        "futures/Future.cpp",
        "futures/HeapTimekeeper.cpp",
        "futures/Promise.cpp",
        "futures/ThreadWheelTimekeeper.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    labels = [
        # This library should be used via :futures. Depslint
        # doesn't support the concept of target-reexports (nor do we know the
        # best design for such a feature), so we just exclude this target from
        # being added.
        "depslint_never_add",
    ],
    raw_headers = [
        "futures/Future.h",
        "futures/Future-inl.h",
        "futures/Future-pre.h",
        "futures/HeapTimekeeper.h",
        "futures/Promise.h",
        "futures/Promise-inl.h",
        "futures/Retrying.h",
        "futures/ThreadWheelTimekeeper.h",
        "futures/WTCallback.h",
    ],
    soname = override_soname_if_needed("futures_core"),
    deps = [
        ":likely",
        ":safe_assert",
        ":singleton",
        ":system_thread_name",
    ],
    exported_deps = [
        ":chrono",
        ":functional_invoke",
        ":futures_detail_core",
        ":futures_detail_types",
        ":futures_portability",
        ":optional",
        ":portability",
        ":portability_gflags",
        ":random",
        ":scope_guard",
        ":synchronization_distributed_mutex",
        ":synchronization_relaxed_atomic",
        ":synchronization_saturating_semaphore",
        ":traits",
        ":try",
        ":unit",
        ":utility",
        "//xplat/folly/container:intrusive_heap",
        "//xplat/folly/detail:async_trace",
        "//xplat/folly/executors:drivable_executor",
        "//xplat/folly/executors:executor_with_priority",
        "//xplat/folly/executors:global_executor",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/executors:queued_immediate_executor",
        "//xplat/folly/executors:timed_drivable_executor",
        "//xplat/folly/experimental/coro:traits",
        "//xplat/folly/fibers:core",
        "//xplat/folly/io/async:async_base",
        "//xplat/folly/lang:exception",
        "//xplat/folly/lang:pretty",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_manual_timekeeper",
    srcs = [
        "futures/ManualTimekeeper.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "futures/ManualTimekeeper.h",
    ],
    deps = [
        ":futures_core",
        ":synchronized",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_barrier",
    srcs = [
        "futures/Barrier.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "futures/Barrier.h",
    ],
    deps = [
        "//third-party/glog:glog",
        "//xplat/folly:scope_guard",
        "//xplat/folly/lang:new",
    ],
    exported_deps = [":futures_core"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_shared_promise",
    srcs = [
        "futures/SharedPromise.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "futures/SharedPromise.h",
        "futures/SharedPromise-inl.h",
    ],
    exported_deps = [
        ":futures_core",
        ":portability",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_future_splitter",
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "futures/FutureSplitter.h",
    ],
    exported_deps = [
        ":futures_core",
        ":futures_shared_promise",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "futures_futures",
    feature = triage_InfrastructureSupermoduleOptou,
    deps = [
        ":futures_barrier",
        ":futures_core",
        ":futures_future_splitter",
        ":futures_shared_promise",
        "//xplat/folly/executors:inline_executor",
        "//xplat/folly/executors:manual_executor",
        "//xplat/folly/executors:queued_immediate_executor",
        "//xplat/folly/executors:scheduled_executor",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_io_async_base",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "experimental/io/AsyncBase.h",
    ],
    exported_deps = [
        "//xplat/folly/io/async:async_base_class",
    ],
)

# xplat/third-party/libaio does not exist yet; disabling target
# folly_xplat_library(
#     name = "experimental_io_async_io",
#     srcs = [
#         "experimental/io/AsyncIO.cpp",
#     ],
#     public_include_directories = [
#         "..",
#     ],
#     raw_headers = [
#         "experimental/io/AsyncIO.h",
#     ],
#     deps = [
#         "//third-party/boost:boost",
#         "//third-party/glog:glog",
#         "//xplat/third-party/libaio:aio",
#         ":exception",
#         ":experimental_io_async_base",
#         ":format",
#         ":likely",
#         ":portability_unistd",
#         ":string",
#     ],
# )

# xplat/third-party/liburing does not exist yet; disabling target
# folly_xplat_library(
#     name = "experimental_io_io_uring",
#     srcs = [
#         "experimental/io/IoUring.cpp",
#     ],
#     public_include_directories = [
#         "..",
#     ],
#     raw_headers = [
#         "experimental/io/IoUring.h",
#     ],
#     deps = [
#         "//third-party/boost:boost",
#         "//third-party/glog:glog",
#         "//xplat/third-party/liburing:uring",
#         ":exception",
#         ":experimental_io_async_base",
#         ":format",
#         ":likely",
#         ":portability_unistd",
#         ":shared_mutex",
#         ":string",
#     ],
# )

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "experimental_io_async_io_uring_socket",
    raw_headers = [
        "experimental/io/AsyncIoUringSocket.h",
        "experimental/io/AsyncIoUringSocketFactory.h",
        "experimental/io/IoUringBackend.h",
        "experimental/io/IoUringBase.h",
        "experimental/io/Liburing.h",
    ],
    exported_deps = [
        "//xplat/folly/io/async:async_io_uring_socket",
    ],
)

# This adds the symbol __folly_memcpy through FollyMemcpy.h, but does not
# replace the default memcpy.
# NOTE: for mobile, this is a no-op. we have this here for symmetry with fbcode
non_fbcode_target(
    _kind = folly_xplat_library,
    name = "memcpy",
    srcs = [
        "FollyMemcpy.cpp",
        "memcpy.S",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["FollyMemcpy.h"],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "base64",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["base64.h"],
    deps = [
        "//xplat/folly/detail/base64_detail:base64_common",
        "//xplat/folly/memory:uninitialized_memory_hacks",
    ],
    exported_deps = [
        "//xplat/folly:c_portability",
        "//xplat/folly:portability",
        "//xplat/folly/detail/base64_detail:base64_api",
        "//xplat/folly/lang:exception",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "maybe_managed_ptr",
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = ["MaybeManagedPtr.h"],
    deps = [
    ],
    exported_deps = [
    ],
)

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

######################################################################
# Libraries

fbcode_target(
    _kind = cpp_library,
    name = "concurrent_bit_set",
    headers = ["ConcurrentBitSet.h"],
    exported_deps = [":portability"],
)

fbcode_target(
    _kind = cpp_library,
    name = "atomic_hash_array",
    headers = [
        "AtomicHashArray.h",
        "AtomicHashArray-inl.h",
    ],
    exported_deps = [
        ":thread_cached_int",
        ":utility",
        "//folly/detail:atomic_hash_utils",
        "//folly/detail:iterators",
        "//folly/hash:hash",
        "//folly/lang:bits",
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "atomic_hash_map",
    headers = [
        "AtomicHashMap.h",
        "AtomicHashMap-inl.h",
    ],
    exported_deps = [
        ":atomic_hash_array",
        ":c_portability",
        ":likely",
        ":thread_cached_int",
        "//folly/container:foreach",
        "//folly/detail:atomic_hash_utils",
        "//folly/detail:iterators",
        "//folly/hash:hash",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "atomic_linked_list",
    headers = [
        "AtomicIntrusiveLinkedList.h",
        "AtomicLinkedList.h",
    ],
    exported_deps = [":memory"],
)

fbcode_target(
    _kind = cpp_library,
    name = "atomic_unordered_map",
    headers = ["AtomicUnorderedMap.h"],
    exported_deps = [
        ":conv",
        ":likely",
        ":random",
        ":scope_guard",
        ":traits",
        "//folly/detail:atomic_unordered_map_utils",
        "//folly/lang:bits",
        "//folly/portability:sys_mman",
        "//folly/portability:unistd",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "base64",
    headers = ["base64.h"],
    exported_deps = [
        ":c_portability",
        ":portability",
        "//folly/detail/base64_detail:base64_api",
        "//folly/detail/base64_detail:base64_common",
        "//folly/lang:exception",
        "//folly/memory:uninitialized_memory_hacks",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "benchmark_util",
    headers = [
        "BenchmarkUtil.h",
    ],
    exported_deps = [
        ":portability",
        "//folly/lang:hint",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "benchmark",
    srcs = ["Benchmark.cpp"],
    headers = ["Benchmark.h"],
    deps = [
        ":file_util",
        ":map_util",
        ":string",
        "//folly/detail:perf_scoped",
        "//folly/json:dynamic",
    ],
    exported_deps = [
        ":benchmark_util",
        ":portability",
        ":preprocessor",
        ":range",
        ":scope_guard",
        ":traits",
        "//folly/functional:invoke",
        "//folly/lang:hint",
        "//folly/portability:gflags",
    ],
    external_deps = [
        ("boost", None, "boost_regex"),
    ],
    exported_external_deps = [
        "boost",
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    # @shim
    name = "bits",
    headers = ["Bits.h"],
    exported_deps = ["//folly/lang:bits"],
)

fbcode_target(
    _kind = cpp_library,
    name = "c_portability",
    headers = ["CPortability.h"],
    exported_deps = [
        "//folly/portability:config",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "cancellation_token",
    srcs = ["CancellationToken.cpp"],
    headers = [
        "CancellationToken.h",
        "CancellationToken-inl.h",
    ],
    deps = [
        ":optional",
        "//folly:scope_guard",
        "//folly/lang:new",
        "//folly/portability:memory",
        "//folly/synchronization/detail:sleeper",
    ],
    exported_deps = [
        ":cpp_attributes",
        ":function",
        ":operation_cancelled",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "chrono",
    headers = ["Chrono.h"],
    exported_deps = [
        ":portability",
        "//folly/lang:exception",
        "//folly/portability:time",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "clock_gettime_wrappers",
    srcs = ["ClockGettimeWrappers.cpp"],
    headers = ["ClockGettimeWrappers.h"],
    deps = [
        ":likely",
    ],
    exported_deps = [
        "//folly/portability:time",
    ],
    external_deps = [
        ("glibc", None, "dl"),
    ],
    exported_external_deps = [
        ("glibc", None, "rt"),
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "concurrent_lazy",
    headers = ["ConcurrentLazy.h"],
    exported_deps = [
        "//folly/functional:invoke",
        "//folly/synchronization:delayed_init",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "concurrent_skip_list",
    headers = [
        "ConcurrentSkipList.h",
        "ConcurrentSkipList-inl.h",
    ],
    exported_deps = [
        ":constexpr_math",
        ":likely",
        ":memory",
        ":thread_local",
        "//folly/detail:iterators",
        "//folly/synchronization:micro_spin_lock",
    ],
    exported_external_deps = [
        "glog",
        ("boost", None, "boost_random"),
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "config",
    # @fb-only[end= ]: headers = ["folly-config.h"],
    propagated_pp_flags = select({
        "DEFAULT": [],
        # The `liblz4.so` in the default conda channel doesn't *publicly* export
        # symbols used for fast reset support (although they are availabel as
        # "internal" symbols and would link statically).
        "ovr_config//distro:conda": [
            "-DFOLLY_USE_LZ4_FAST_RESET=0",
        ],
    }),
    headers = ["//:folly-config.h"], # @oss-only
    labels = ["oss_dependency"], # @oss-only
)

fbcode_target(
    _kind = cpp_library,
    name = "constexpr_math",
    headers = ["ConstexprMath.h"],
    exported_deps = [
        ":portability",
        "//folly/lang:checked_math",
        "//folly/portability:constexpr",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "constructor_callback_list",
    headers = [
        "ConstructorCallbackList.h",
    ],
    exported_deps = [
        ":format",
        ":function",
        ":shared_mutex",
        "//folly/detail:static_singleton_manager",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "conv",
    srcs = ["Conv.cpp"],
    headers = ["Conv.h"],
    undefined_symbols = True,  # TODO(T23121628): fix deps and remove
    deps = [
        "fbsource//third-party/fast_float:fast_float",
        "//folly/lang:safe_assert",
    ],
    exported_deps = [
        ":c_portability",
        ":demangle",
        ":expected",
        ":fbstring",
        ":likely",
        ":portability",
        ":range",
        ":traits",
        ":unit",
        ":utility",
        "//folly/lang:exception",
        "//folly/lang:pretty",
        "//folly/lang:to_ascii",
        "//folly/portability:math",
    ],
    exported_external_deps = [
        "double_conversion",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "cpp_attributes",
    headers = ["CppAttributes.h"],
    exported_deps = [":portability"],
)

fbcode_target(
    _kind = cpp_library,
    name = "cpu_id",
    headers = ["CpuId.h"],
    exported_deps = [":portability"],
)

fbcode_target(
    _kind = cpp_library,
    name = "default_keep_alive_executor",
    headers = [
        "DefaultKeepAliveExecutor.h",
    ],
    exported_deps = [
        ":executor",
        "//folly/executors:sequenced_executor",
        "//folly/synchronization:baton",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "demangle",
    srcs = ["Demangle.cpp"],
    headers = ["Demangle.h"],
    os_deps = [(
        "linux",
        ["third-party//binutils:iberty"],
    )],
    deps = [
        ":c_portability",
        ":cpp_attributes",
        ":utility",
        "//folly/functional:invoke",
        "//folly/lang:c_string",
    ],
    exported_deps = [
        ":fbstring",
        "//folly/portability:config",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "discriminated_ptr",
    headers = ["DiscriminatedPtr.h"],
    exported_deps = [
        ":likely",
        ":portability",
        "//folly/detail:discriminated_ptr_detail",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "dynamic",
    headers = [
        "DynamicConverter.h",
        "dynamic.h",
        "dynamic-inl.h",
        "json.h",
    ],
    exported_deps = [
        "//folly/json:dynamic",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "exception",
    headers = ["Exception.h"],
    exported_deps = [
        ":conv",
        ":fbstring",
        ":likely",
        ":portability",
        "//folly/portability:sys_types",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "exception_string",
    srcs = ["ExceptionString.cpp"],
    headers = ["ExceptionString.h"],
    deps = [
        ":demangle",
        "//folly/lang:exception",
        "//folly/lang:type_info",
    ],
    exported_deps = [
        ":fbstring",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "exception_wrapper",
    srcs = ["ExceptionWrapper.cpp"],
    headers = [
        "ExceptionWrapper.h",
        "ExceptionWrapper-inl.h",
    ],
    undefined_symbols = True,  # TODO(T23121628): fix deps and remove
    exported_deps = [
        ":c_portability",
        ":cpp_attributes",
        ":demangle",
        ":exception_string",
        ":fbstring",
        ":portability",
        ":traits",
        ":utility",
        "//folly/functional:traits",
        "//folly/lang:assume",
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "executor",
    srcs = ["Executor.cpp"],
    headers = [
        "Executor.h",
    ],
    deps = [
        ":exception_string",
        ":portability",
    ],
    exported_deps = [
        ":function",
        ":optional",
        ":range",
        ":utility",
        "//folly/lang:exception",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "expected",
    headers = ["Expected.h"],
    exported_deps = [
        ":c_portability",
        ":cpp_attributes",
        ":likely",
        ":portability",
        ":preprocessor",
        ":traits",
        ":unit",
        ":utility",
        "//folly/coro:coroutine",
        "//folly/lang:exception",
        "//folly/lang:hint",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fbstring",
    headers = ["FBString.h"],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        ":c_portability",
        ":cpp_attributes",
        ":likely",
        ":portability",
        ":traits",
        "//folly/hash:hash",
        "//folly/lang:assume",
        "//folly/lang:checked_math",
        "//folly/lang:exception",
        "//folly/memory:malloc",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fbvector",
    headers = [
        "FBVector.h",
    ],
    exported_deps = [
        "//folly/container:fbvector",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "file",
    srcs = ["File.cpp"],
    headers = ["File.h"],
    deps = [
        ":exception",
        ":file_util",
        ":scope_guard",
        "//folly/portability:fmt_compile",
        "//folly/portability:sys_file",
    ],
    exported_deps = [
        ":exception_wrapper",
        ":expected",
        ":file_util",  # @manual
        ":portability",
        ":range",
        "//folly/portability:fcntl",
        "//folly/portability:unistd",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "file_util",
    srcs = ["FileUtil.cpp"],
    headers = ["FileUtil.h"],
    deps = [
        "//folly/detail:file_util_detail",
        "//folly/detail:file_util_vector_detail",
        "//folly/net:net_ops",
        "//folly/portability:sockets",
        "//folly/portability:stdlib",
        "//folly/portability:sys_file",
        "//folly/portability:sys_stat",
    ],
    exported_deps = [
        ":portability",
        ":range",
        ":scope_guard",
        "//folly/net:network_socket",
        "//folly/portability:fcntl",
        "//folly/portability:sys_uio",
        "//folly/portability:unistd",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fingerprint",
    srcs = ["Fingerprint.cpp"],
    headers = ["Fingerprint.h"],
    deps = [
        ":portability",
        ":utility",
        "//folly/detail:fingerprint_polynomial",
    ],
    exported_deps = [
        ":range",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fixed_string",
    headers = ["FixedString.h"],
    exported_deps = [
        ":constexpr_math",
        ":portability",
        ":range",
        ":utility",
        "//folly/lang:exception",
        "//folly/lang:ordering",
        "//folly/portability:constexpr",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "fmt_utility",
    srcs = [
        "FmtUtility.cpp",
    ],
    headers = [
        "FmtUtility.h",
    ],
    deps = [
        ":range",
        ":string",
        "//folly/ssl:openssl_hash",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        ":cpp_attributes",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "format",
    srcs = [
        "Format.cpp",
    ],
    headers = [
        "Format.h",
        "Format-inl.h",
        "FormatArg.h",
    ],
    deps = [
        ":constexpr_math",
        ":cpp_attributes",
        "//folly/container:array",
    ],
    exported_deps = [
        ":c_portability",
        ":conv",
        ":exception",
        ":format_traits",
        ":likely",
        ":map_util",
        ":portability",
        ":range",
        ":string",
        ":traits",
        "//folly/lang:exception",
        "//folly/lang:to_ascii",
        "//folly/portability:windows",
    ],
    external_deps = [
        "double_conversion",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "format_traits",
    headers = ["FormatTraits.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "function",
    headers = ["Function.h"],
    exported_deps = [
        ":cpp_attributes",
        ":portability",
        ":traits",
        "//folly/functional:invoke",
        "//folly/lang:align",
        "//folly/lang:exception",
        "//folly/lang:new",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "group_varint",
    srcs = [
        "GroupVarint.cpp",
    ],
    headers = ["GroupVarint.h"],
    deps = [
        "//folly/container:array",
    ],
    exported_deps = [
        ":portability",
        ":range",
        "//folly/detail:group_varint_detail",
        "//folly/lang:bits",
        "//folly/portability:builtins",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "hash",
    headers = ["Hash.h"],
    exported_deps = [
        "//folly/hash:hash",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "indestructible",
    headers = ["Indestructible.h"],
    exported_deps = [
        ":traits",
        ":utility",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "indexed_mem_pool",
    headers = ["IndexedMemPool.h"],
    exported_deps = [
        ":portability",
        "//folly/concurrency:cache_locality",
        "//folly/portability:sys_mman",
        "//folly/portability:unistd",
        "//folly/synchronization:atomic_struct",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "intrusive_list",
    headers = [
        "IntrusiveList.h",
    ],
    exported_deps = [
        "//folly/container:intrusive_list",
    ],
)

fb_dirsync_cpp_library(
    name = "json",
    feature = triage_InfrastructureSupermoduleOptou,
    xplat_impl = folly_xplat_library,
    exported_deps = [
        ":dynamic",
    ],
)

fb_dirsync_cpp_library(
    name = "json_pointer",
    headers = [
        "json_pointer.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    xplat_impl = folly_xplat_library,
    exported_deps = [
        "//folly/json:json_pointer",
    ],
)

fb_dirsync_cpp_library(
    name = "json_patch",
    headers = [
        "json_patch.h",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    exported_deps = [
        "//folly/json:json_patch",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "lazy",
    headers = ["Lazy.h"],
    exported_deps = [
        ":optional",
        "//folly/functional:invoke",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "likely",
    headers = ["Likely.h"],
    exported_deps = [
        "//folly/lang:builtin",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "glog",
    headers = ["GLog.h"],
    exported_deps = [
        ":likely",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "map_util",
    headers = [
        "MapUtil.h",
    ],
    exported_deps = [
        "//folly/container:map_util",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "math",
    headers = ["Math.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "memset-impl",
    srcs = [
        "FollyMemset.cpp",
    ] + select({
        "DEFAULT": [],
        "ovr_config//cpu:x86_64": [
            "memset.S",
        ],
        "ovr_config//os:linux-arm64": [
            "memset_select_aarch64.cpp",
        ],
    }),
    auto_headers = AutoHeaders.NONE,
    headers = [],
    arch_preprocessor_flags = {
        "x86_64": [
            "-mavx2",
        ],
    },
    modular_headers = False,
    exported_deps = select({
        "DEFAULT": [],
        "ovr_config//os:linux-arm64": [
            "//folly/external/aor:memset_aarch64",  # @manual
        ],
    }),
)

# This exports the symbol __folly_memset to C++ via a header.
fbcode_target(
    _kind = cpp_library,
    name = "memset",
    headers = ["FollyMemset.h"],
    exported_deps = [
        ":memset-impl",  # @manual
    ],
)

# This overrides the libc memset with __folly_memset.
fbcode_target(
    _kind = cpp_library,
    name = "memset-use",
    srcs = [
        "FollyMemset.cpp",
    ] + select({
        "DEFAULT": [],
        "ovr_config//cpu:x86_64": [
            "memset.S",
        ],
        "ovr_config//os:linux-arm64": [
            "memset_select_aarch64.cpp",
        ],
    }),
    auto_headers = AutoHeaders.NONE,
    headers = [],
    arch_preprocessor_flags = {
        "aarch64": [
            "-DFOLLY_MEMSET_IS_MEMSET",
        ],
        "x86_64": [
            "-DFOLLY_MEMSET_IS_MEMSET",
            "-mavx2",
        ],
    },
    link_whole = True,  # Set link_whole to force linker to use __folly_memset
    modular_headers = False,
    exported_deps = select({
        "DEFAULT": [],
        "ovr_config//os:linux-arm64": [
            "//folly/external/aor:memset_aarch64-use",  # @manual
        ],
    }),
)

# This adds the symbol __folly_memcpy but does not replace the default memcpy.
fbcode_target(
    _kind = cpp_library,
    name = "memcpy-impl",
    srcs = [
        "FollyMemcpy.cpp",
    ] + select({
        "ovr_config//cpu:x86_64": [
            "memcpy.S",
        ],
        "ovr_config//os:linux-arm64": [
            "memcpy_select_aarch64.cpp",
        ],
    }),
    auto_headers = AutoHeaders.NONE,
    headers = [],
    arch_preprocessor_flags = {
        "x86_64": [
            "-mavx2",
        ],
    },
    modular_headers = False,
    exported_deps = select({
        "DEFAULT": [],
        "ovr_config//os:linux-arm64": [
            "//folly/external/aor:memcpy_aarch64",  # @manual
        ],
    }),
)

# This exports the symbol __folly_memcpy to C++ via a header.
fbcode_target(
    _kind = cpp_library,
    name = "memcpy",
    headers = ["FollyMemcpy.h"],
    exported_deps = [
        ":memcpy-impl",  # @manual
    ],
)

# This overrides the libc memcpy with __folly_memcpy.
fbcode_target(
    _kind = cpp_library,
    name = "memcpy-use",
    srcs = [
        "FollyMemcpy.cpp",
    ] + select({
        "DEFAULT": [],
        "ovr_config//cpu:x86_64": [
            "memcpy.S",
        ],
        "ovr_config//os:linux-arm64": [
            "memcpy_select_aarch64.cpp",
        ],
    }),
    auto_headers = AutoHeaders.NONE,
    headers = [],
    arch_preprocessor_flags = {
        "aarch64": [
            "-DFOLLY_MEMCPY_IS_MEMCPY",
        ],
        "x86_64": [
            "-DFOLLY_MEMCPY_IS_MEMCPY",
            "-mavx2",
            "-march=haswell",
        ],
    },
    link_whole = True,  # Set link_whole to force linker to use __folly_memcpy
    modular_headers = False,
    exported_deps = select({
        "DEFAULT": [],
        "ovr_config//os:linux-arm64": [
            "//folly/external/aor:memcpy_aarch64-use",  # @manual
        ],
    }),
)

fbcode_target(
    _kind = cpp_library,
    name = "memory",
    headers = ["Memory.h"],
    exported_deps = [
        ":constexpr_math",
        ":likely",
        ":portability",
        ":traits",
        ":utility",
        "//folly/functional:invoke",
        "//folly/lang:align",
        "//folly/lang:exception",
        "//folly/lang:thunk",
        "//folly/memory:malloc",
        "//folly/portability:config",
        "//folly/portability:constexpr",
        "//folly/portability:malloc",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "micro_lock",
    srcs = ["MicroLock.cpp"],
    headers = ["MicroLock.h"],
    deps = [
        "//folly/portability:asm",
    ],
    exported_deps = [
        ":optional",
        ":portability",
        ":utility",
        "//folly/synchronization:atomic_notification",
        "//folly/synchronization:atomic_ref",
    ],
)

fbcode_target(
    _kind = cpp_library,
    # @shim
    name = "micro_spin_lock",
    headers = ["MicroSpinLock.h"],
    exported_deps = ["//folly/synchronization:micro_spin_lock"],
)

fbcode_target(
    _kind = cpp_library,
    name = "move_wrapper",
    headers = ["MoveWrapper.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "mpmc_pipeline",
    headers = ["MPMCPipeline.h"],
    exported_deps = [
        ":portability",
        "//folly/detail:mpmc_pipeline_detail",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "mpmc_queue",
    headers = ["MPMCQueue.h"],
    exported_deps = [
        ":traits",
        "//folly/concurrency:cache_locality",
        "//folly/detail:turn_sequencer",
        "//folly/portability:unistd",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "network_address",
    srcs = [
        "IPAddress.cpp",
        "IPAddressV4.cpp",
        "IPAddressV6.cpp",
        "MacAddress.cpp",
        "SocketAddress.cpp",
    ],
    headers = [
        "IPAddress.h",
        "IPAddressException.h",
        "IPAddressV4.h",
        "IPAddressV6.h",
        "MacAddress.h",
        "SocketAddress.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        ":exception",
        ":format",
        ":scope_guard",
        ":small_vector",
        ":string",
        "//folly/detail:ip_address_source",
        "//folly/net:net_ops",
    ],
    exported_deps = [
        ":c_portability",
        ":constexpr_math",
        ":conv",
        ":expected",
        ":fbstring",
        ":optional",
        ":portability",
        ":range",
        ":unit",
        "//folly/detail:ip_address",
        "//folly/hash:hash",
        "//folly/lang:bits",
        "//folly/lang:exception",
        "//folly/net:network_socket",
        "//folly/portability:config",
        "//folly/portability:sockets",
    ],
    external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "observer_container",
    headers = [
        "ObserverContainer.h",
    ],
    exported_deps = [
        ":constructor_callback_list",
        ":function",
        ":optional",
        ":scope_guard",
        ":small_vector",
        "//folly/io/async:destructor_check",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "operation_cancelled",
    headers = ["OperationCancelled.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "optional",
    headers = ["Optional.h"],
    exported_deps = [
        ":portability",
        ":traits",
        ":utility",
        "//folly/coro:coroutine",
        "//folly/hash:traits",
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "replaceable",
    headers = [
        "Replaceable.h",
    ],
    exported_deps = [
        ":portability",
        ":traits",
        ":utility",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "overload",
    headers = ["Overload.h"],
    exported_deps = [
        ":portability",
        ":traits",
        "//folly/functional:invoke",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "packed_sync_ptr",
    headers = ["PackedSyncPtr.h"],
    exported_deps = [
        ":portability",
        "//folly/synchronization:small_locks",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "padded",
    headers = ["Padded.h"],
    exported_deps = [
        ":portability",
        ":traits",
        "//folly/functional:invoke",
        "//folly/portability:sys_types",
    ],
    exported_external_deps = [
        "boost",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "portability",
    headers = ["Portability.h"],
    exported_deps = [
        ":c_portability",
        "//folly/portability:config",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "preprocessor",
    headers = ["Preprocessor.h"],
    exported_deps = [
        ":c_portability",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "poly",
    headers = [
        "Poly.h",
        "Poly-inl.h",
    ],
    exported_deps = [
        ":c_portability",
        ":cpp_attributes",
        ":poly_exception",
        ":traits",
        "//folly/detail:poly_detail",
        "//folly/detail:typelist",
        "//folly/lang:assume",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "poly_exception",
    headers = ["PolyException.h"],
    exported_deps = [
        "//folly:c_portability",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "producer_consumer_queue",
    headers = ["ProducerConsumerQueue.h"],
    exported_deps = [
        "//folly/concurrency:cache_locality",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "random",
    srcs = [
        "Random.cpp",
    ],
    headers = [
        "Random.h",
        "Random-inl.h",
    ],
    os_deps = [(
        "windows",
        [
            "fbsource//third-party/toolchains/win:advapi32.lib",
        ],
    )],
    deps = [
        ":cpp_attributes",
        ":singleton_thread_local",
        ":thread_local",
        "//folly/detail:file_util_detail",
        "//folly/portability:config",
        "//folly/portability:sys_time",
        "//folly/portability:unistd",
        "//folly/synchronization:relaxed_atomic",
    ],
    exported_deps = [
        ":portability",
        ":traits",
        "//folly/functional:invoke",
        "//folly/lang:bits",
        "//folly/random:xoshiro256pp",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "range",
    headers = ["Range.h"],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        ":cpu_id",
        ":likely",
        ":portability",
        ":traits",
        "//folly/detail:range_common",
        "//folly/detail:range_simd",
        "//folly/hash:spooky_hash_v2",
        "//folly/lang:c_string",
        "//folly/lang:exception",
        "//folly/portability:constexpr",
    ],
)

fbcode_target(
    _kind = cpp_library,
    # @shim
    name = "rw_spin_lock",
    headers = ["RWSpinLock.h"],
    exported_deps = ["//folly/synchronization:rw_spin_lock"],
)

fbcode_target(
    _kind = cpp_library,
    name = "scope_guard",
    srcs = ["ScopeGuard.cpp"],
    headers = ["ScopeGuard.h"],
    exported_deps = [
        ":portability",
        ":preprocessor",
        ":utility",
        "//folly/lang:exception",
        "//folly/lang:uncaught_exceptions",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "shared_mutex",
    srcs = ["SharedMutex.cpp"],
    headers = ["SharedMutex.h"],
    supports_python_dlopen = True,
    deps = [
        ":indestructible",
        "//folly/lang:exception",
        "//folly/portability:sys_resource",
    ],
    exported_deps = [
        ":c_portability",
        ":cpp_attributes",
        ":likely",
        "//folly/chrono:hardware",
        "//folly/concurrency:cache_locality",
        "//folly/detail:futex",
        "//folly/portability:asm",
        "//folly/synchronization:lock",
        "//folly/synchronization:relaxed_atomic",
        "//folly/synchronization:sanitize_thread",
        "//folly/system:thread_id",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "singleton",
    srcs = [
        "Singleton.cpp",
    ],
    headers = [
        "Singleton.h",
        "Singleton-inl.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        ":demangle",
        ":scope_guard",
        "//folly/experimental/symbolizer:symbolizer",
        "//folly/lang:safe_assert",
        "//folly/portability:config",
        "//folly/portability:fmt_compile",
    ],
    exported_deps = [
        ":cancellation_token",
        ":exception",
        ":executor",
        ":memory",
        ":synchronized",
        "//folly/concurrency:core_cached_shared_ptr",
        "//folly/concurrency/memory:read_mostly_shared_ptr",
        "//folly/detail:singleton",
        "//folly/detail:static_singleton_manager",
        "//folly/hash:hash",
        "//folly/lang:exception",
        "//folly/memory:sanitize_leak",
        "//folly/synchronization:baton",
    ],
    external_deps = [
        ("glibc", None, "dl"),
        ("glibc", None, "rt"),
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "singleton_thread_local",
    srcs = ["SingletonThreadLocal.cpp"],
    headers = ["SingletonThreadLocal.h"],
    exported_deps = [
        ":scope_guard",
        ":thread_local",
        "//folly/detail:iterators",
        "//folly/detail:singleton",
        "//folly/detail:unique_instance",
        "//folly/functional:invoke",
        "//folly/lang:hint",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "small_vector",
    headers = [
        "small_vector.h",
    ],
    exported_deps = [
        "//folly/container:small_vector",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "sorted_vector_types",
    headers = [
        "sorted_vector_types.h",
    ],
    exported_deps = [
        "//folly/container:sorted_vector_types",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "spin_lock",
    headers = [
        "SpinLock.h",
    ],
    exported_deps = [
        ":portability",
        "//folly/synchronization:small_locks",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "stop_watch",
    headers = ["stop_watch.h"],
    exported_deps = [
        ":chrono",
        ":utility",
        "//folly/portability:time",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "string",
    srcs = [
        "String.cpp",
    ],
    headers = [
        "String.h",
        "String-inl.h",
    ],
    deps = [
        "//folly/container:array",
    ],
    exported_deps = [
        ":conv",
        ":cpp_attributes",
        ":exception_string",
        ":optional",
        ":portability",
        ":range",
        ":scope_guard",
        ":traits",
        ":unit",
        "//folly/container:reserve",
        "//folly/detail:simple_simd_string_utils",
        "//folly/detail:split_string_simd",
    ],
    external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "subprocess",
    srcs = ["Subprocess.cpp"],
    headers = ["Subprocess.h"],
    deps = [
        ":conv",
        ":scope_guard",
        ":string",
        "//folly/lang:assume",
        "//folly/logging:logging",
        "//folly/portability:dirent",
        "//folly/portability:fcntl",
        "//folly/portability:sockets",
        "//folly/portability:stdlib",
        "//folly/portability:sys_syscall",
        "//folly/portability:unistd",
        "//folly/system:at_fork",
        "//folly/system:shell",
    ],
    exported_deps = [
        ":exception",
        ":file",
        ":file_util",
        ":function",
        ":map_util",
        ":optional",
        ":portability",
        ":range",
        "//folly/container:span",
        "//folly/gen:string",
        "//folly/io:iobuf",
        "//folly/portability:sys_resource",
    ],
    external_deps = [
        ("boost", None, "boost_range"),
        ("glibc", None, "dl"),
    ],
    exported_external_deps = [
        "boost",
        ("boost", None, "boost_container"),
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "synchronized",
    headers = ["Synchronized.h"],
    exported_deps = [
        ":function",
        ":likely",
        ":preprocessor",
        ":shared_mutex",
        ":traits",
        ":utility",
        "//folly/container:foreach",
        "//folly/functional:apply_tuple",
        "//folly/synchronization:lock",
    ],
    exported_external_deps = [
        "glog",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "synchronized_ptr",
    headers = ["SynchronizedPtr.h"],
    exported_deps = [":synchronized"],
)

fbcode_target(
    _kind = cpp_library,
    name = "thread_cached_int",
    headers = ["ThreadCachedInt.h"],
    exported_deps = [
        ":likely",
        ":thread_local",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "thread_local",
    headers = ["ThreadLocal.h"],
    exported_deps = [
        ":likely",
        ":portability",
        ":scope_guard",
        ":shared_mutex",
        "//folly/detail:thread_local_detail",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "timeout_queue",
    srcs = ["TimeoutQueue.cpp"],
    headers = ["TimeoutQueue.h"],
    exported_external_deps = [
        "boost",
        ("boost", None, "boost_multi_index"),
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "token_bucket",
    headers = ["TokenBucket.h"],
    exported_deps = [
        ":constexpr_math",
        ":likely",
        ":optional",
        "//folly/concurrency:cache_locality",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "traits",
    headers = ["Traits.h"],
    exported_deps = [":portability"],
)

fbcode_target(
    _kind = cpp_library,
    name = "try",
    srcs = [
        "Try.cpp",
    ],
    headers = [
        "Try.h",
        "Try-inl.h",
    ],
    exported_deps = [
        ":exception_wrapper",
        ":likely",
        ":memory",
        ":portability",
        ":unit",
        ":utility",
        "//folly/functional:invoke",
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "unicode",
    srcs = ["Unicode.cpp"],
    headers = ["Unicode.h"],
    deps = [
        ":conv",
    ],
    exported_deps = [
        "//folly/lang:exception",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "unit",
    headers = ["Unit.h"],
)

fbcode_target(
    _kind = cpp_library,
    name = "uri",
    srcs = [
        "Uri.cpp",
    ],
    headers = [
        "Uri.h",
        "Uri-inl.h",
    ],
    exported_deps = [
        ":conv",
        ":expected",
        ":string",
        "//folly/hash:hash",
    ],
    external_deps = [
        ("boost", None, "boost_regex"),
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "utf8_string",
    headers = [
        "UTF8String.h",
    ],
    exported_deps = [
        ":range",
    ],
    exported_external_deps = [
        ("boost", None, "boost_regex"),
    ],
)

# For things that would go in c++ stdlib <utility>:
fbcode_target(
    _kind = cpp_library,
    name = "utility",
    headers = [
        "Utility.h",
    ],
    exported_deps = [
        ":c_portability",
        ":portability",
        ":traits",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "varint",
    headers = ["Varint.h"],
    exported_deps = [
        ":conv",
        ":expected",
        ":likely",
        ":portability",
        ":range",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "virtual_executor",
    headers = [
        "VirtualExecutor.h",
    ],
    exported_deps = [
        "//folly/executors:virtual_executor",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "maybe_managed_ptr",
    headers = ["MaybeManagedPtr.h"],
    deps = [
    ],
    exported_deps = [
    ],
)
