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

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "settings",
    srcs = [
        "Settings.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Settings.h",
        "detail/SettingsImpl.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//xplat/folly:conv",
        "//xplat/folly:cpp_attributes",
        "//xplat/folly:function",
        "//xplat/folly:likely",
        "//xplat/folly:optional",
        "//xplat/folly:portability",
        "//xplat/folly:shared_mutex",
        "//xplat/folly:synchronized",
        "//xplat/folly:thread_local",
        "//xplat/folly:traits",
        "//xplat/folly:utility",
        "//xplat/folly/concurrency:singleton_relaxed_counter",
        "//xplat/folly/container:f14_hash",
        "//xplat/folly/container:map_util",
        "//xplat/folly/lang:aligned",
        "//xplat/folly/observer:observer",
        "//xplat/folly/observer:simple_observable",
        "//xplat/folly/settings:immutables",
        "//xplat/folly/settings:types",
        "//xplat/folly/synchronization:delayed_init",
        "//xplat/folly/synchronization:relaxed_atomic",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "settings",
    srcs = [
        "Settings.cpp",
    ],
    headers = [
        "Settings.h",
        "detail/SettingsImpl.h",
    ],
    deps = [
        "//folly:synchronized",
    ],
    exported_deps = [
        "fbsource//third-party/fmt:fmt",
        ":immutables",
        ":types",
        "//folly:conv",
        "//folly:cpp_attributes",
        "//folly:function",
        "//folly:likely",
        "//folly:optional",
        "//folly:portability",
        "//folly:shared_mutex",
        "//folly:thread_local",
        "//folly:traits",
        "//folly:utility",
        "//folly/concurrency:singleton_relaxed_counter",
        "//folly/container:f14_hash",
        "//folly/container:map_util",
        "//folly/lang:aligned",
        "//folly/observer:observer",
        "//folly/observer:simple_observable",
        "//folly/synchronization:delayed_init",
        "//folly/synchronization:relaxed_atomic",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "types",
    srcs = [
        "Types.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Types.h",
    ],
    deps = [
        "//xplat/folly:conv",
        "//xplat/folly:expected",
        "//xplat/folly:unit",
        "//xplat/folly:utility",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "types",
    srcs = [
        "Types.cpp",
    ],
    exported_deps = [
        "//folly:conv",
        "//folly:expected",
        "//folly:unit",
        "//folly:utility",
    ],
)

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "immutables",
    srcs = [
        "Immutables.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    raw_headers = [
        "Immutables.h",
    ],
    deps = [
        "//xplat/folly:indestructible",
        "//xplat/folly:synchronized",
        "//xplat/folly/container:f14_hash",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "immutables",
    srcs = [
        "Immutables.cpp",
    ],
    deps = [
        "//folly:indestructible",
        "//folly:synchronized",
    ],
    exported_deps = [
        "//folly/container:f14_hash",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "command_line_parser",
    srcs = [
        "CommandLineParser.cpp",
    ],
    headers = [
        "CommandLineParser.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:exception_string",
        "//folly:function",
        "//folly:string",
        "//folly/logging:logging",
    ],
    exported_deps = [
        ":settings",
        ":settings_accessor_proxy",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "settings_accessor_proxy",
    srcs = [
        "SettingsAccessorProxy.cpp",
    ],
    headers = [
        "SettingsAccessorProxy.h",
    ],
    exported_deps = [
        ":settings",
    ],
)

fbcode_target(
    _kind = cpp_library,
    name = "observer",
    headers = [
        "Observer.h",
    ],
    exported_deps = [
        ":settings",
        "//folly/observer:observer",
        "//folly/observer:simple_observable",
    ],
)
