load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

cpp_library(
    name = "atomic_read_mostly_main_ptr",
    headers = [
        "AtomicReadMostlyMainPtr.h",
    ],
    exported_deps = [
        "//folly/concurrency/memory:atomic_read_mostly_main_ptr",
    ],
)

cpp_library(
    name = "auto_timer",
    headers = [
        "AutoTimer.h",
    ],
    exported_deps = [
        "//folly/logging:auto_timer",
    ],
)

cpp_library(
    name = "bit_vector_coding",
    headers = [
        "BitVectorCoding.h",
    ],
    exported_deps = [
        "//folly/compression/elias_fano:bit_vector_coding",
    ],
)

cpp_library(
    name = "bits",
    headers = ["Bits.h"],
    exported_deps = [
        "//folly:portability",
        "//folly:range",
        "//folly/lang:bits",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "coding_detail",
    headers = [
        "CodingDetail.h",
    ],
    exported_deps = [
        "//folly/compression/elias_fano:coding_detail",
    ],
)

cpp_library(
    name = "dynamic_parser",
    headers = [
        "DynamicParser.h",
        "DynamicParser-inl.h",
    ],
    exported_deps = [
        "//folly/json:dynamic_parser",
    ],
)

cpp_library(
    name = "elias_fano_coding",
    headers = [
        "EliasFanoCoding.h",
    ],
    exported_deps = [
        "//folly/compression/elias_fano:elias_fano_coding",
    ],
)

cpp_library(
    name = "env_util",
    headers = [
        "EnvUtil.h",
    ],
    exported_deps = [
        "//folly/system:env_util",
    ],
)

cpp_library(
    name = "event_count",
    headers = [
        "EventCount.h",
    ],
    exported_deps = [
        "//folly/synchronization:event_count",
    ],
)

cpp_library(
    name = "execution_observer",
    srcs = ["ExecutionObserver.cpp"],
    headers = ["ExecutionObserver.h"],
    deps = [
        "//folly/tracing:static_tracepoint",
    ],
    exported_external_deps = [
        "boost",
    ],
)

cpp_library(
    name = "flat_combining_priority_queue",
    headers = ["FlatCombiningPriorityQueue.h"],
    exported_deps = [
        "//folly:optional",
        "//folly/detail:futex",
        "//folly/synchronization:flat_combining",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "relaxed_concurrent_priority_queue",
    headers = [
        "RelaxedConcurrentPriorityQueue.h",
    ],
    exported_deps = [
        "//folly/concurrency/container:relaxed_concurrent_priority_queue",
    ],
)

cpp_library(
    name = "function_scheduler",
    headers = [
        "FunctionScheduler.h",
    ],
    exported_deps = [
        "//folly/executors:function_scheduler",
    ],
)

cpp_library(
    name = "instructions",
    headers = ["Instructions.h"],
    exported_deps = [
        "//folly:cpu_id",
        "//folly:portability",
        "//folly/lang:assume",
        "//folly/portability:builtins",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "json_schema",
    headers = [
        "JSONSchema.h",
    ],
    exported_deps = [
        "//folly/json:json_schema",
    ],
)

cpp_library(
    name = "lock_free_ring_buffer",
    headers = [
        "LockFreeRingBuffer.h",
    ],
    exported_deps = [
        "//folly/concurrency/container:lock_free_ring_buffer",
    ],
)

cpp_library(
    name = "cleanup",
    headers = ["Cleanup.h"],
    exported_deps = [
        "//folly/futures:core",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "primary_ptr",
    headers = ["PrimaryPtr.h"],
    exported_deps = [
        ":cleanup",
        "//folly:function",
        "//folly/futures:core",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "program_options",
    headers = [
        "NestedCommandLineApp.h",
        "ProgramOptions.h",
    ],
    exported_deps = [
        "//folly/cli:program_options",
    ],
)

cpp_library(
    name = "read_mostly_shared_ptr",
    headers = [
        "ReadMostlySharedPtr.h",
    ],
    exported_deps = [
        "//folly/concurrency/memory:read_mostly_shared_ptr",
    ],
)

cpp_library(
    name = "select64",
    srcs = ["Select64.cpp"],
    headers = ["Select64.h"],
    deps = [
        "//folly:constexpr_math",
        "//folly:utility",
    ],
    exported_deps = [
        ":instructions",
        "//folly:portability",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "single_writer_fixed_hash_map",
    headers = [
        "SingleWriterFixedHashMap.h",
    ],
    exported_deps = [
        "//folly/lang:bits",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "singleton_relaxed_counter",
    headers = [
        "SingletonRelaxedCounter.h",
    ],
    exported_deps = [
        "//folly/concurrency:singleton_relaxed_counter",
    ],
)

cpp_library(
    name = "test_util",
    srcs = ["TestUtil.cpp"],
    headers = ["TestUtil.h"],
    deps = [
        "//folly:exception",
        "//folly:file",
        "//folly:file_util",
        "//folly:memory",
        "//folly:string",
        "//folly/ext:test_ext",
        # @fb-only: "//folly/facebook:test_ext", 
        "//folly/portability:fcntl",
    ],
    exported_deps = [
        "//folly:range",
        "//folly:scope_guard",
        "//folly/experimental/io:fs_util",
    ],
    external_deps = [
        "glog",
        ("boost", None, "boost_regex"),
    ],
)

cpp_library(
    name = "timerfd",
    srcs = [
        "STTimerFDTimeoutManager.cpp",
        "TimerFD.cpp",
        "TimerFDTimeoutManager.cpp",
    ],
    headers = [
        "STTimerFDTimeoutManager.h",
        "TimerFD.h",
        "TimerFDTimeoutManager.h",
    ],
    deps = [
        "//folly:file_util",
        "//folly/io/async:event_util",
    ],
    exported_deps = [
        "//folly/io/async:async_base",
        "//folly/io/async:delayed_destruction",
    ],
)

cpp_library(
    name = "threaded_repeating_function_runner",
    srcs = ["ThreadedRepeatingFunctionRunner.cpp"],
    headers = ["ThreadedRepeatingFunctionRunner.h"],
    deps = [
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "tl_ref_count",
    headers = ["TLRefCount.h"],
    exported_deps = [
        "//folly:thread_local",
        "//folly/synchronization:asymmetric_thread_fence",
        "//folly/synchronization/detail:sleeper",
    ],
)

cpp_library(
    name = "quotient_multiset",
    srcs = [
        "QuotientMultiSet.cpp",
    ],
    headers = [
        "QuotientMultiSet.h",
        "QuotientMultiSet-inl.h",
    ],
    deps = [
        "//folly:math",
    ],
    exported_deps = [
        ":bits",
        ":instructions",
        ":select64",
        "//folly:format",
        "//folly:portability",
        "//folly:range",
        "//folly/io:iobuf",
        "//folly/lang:bits",
        "//folly/lang:safe_assert",
    ],
    exported_external_deps = [
        "glog",
    ],
)
