load("//:build_variables.bzl", "COPTS")
load("//cuttlefish/bazel:rules.bzl", "cf_cc_library")

package(
    default_visibility = ["//:android_cuttlefish"],
)

cf_cc_library(
    name = "common",
    srcs = ["common.cpp"],
    hdrs = ["common.h"],
    clang_format_enabled = False,
    copts = COPTS + ["-Werror=sign-compare"],
    deps = [
        "//cuttlefish/common/libs/utils:contains",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/host/commands/cvd/cli:types",
        "//cuttlefish/host/libs/config:config_utils",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:str_format",
    ],
)

cf_cc_library(
    name = "flags_collector",
    srcs = ["flags_collector.cpp"],
    hdrs = ["flags_collector.h"],
    copts = COPTS + ["-Werror=sign-compare"],
    deps = [
        "//libbase",
        "@abseil-cpp//absl/log",
        "@tinyxml2",
    ],
)

cf_cc_library(
    name = "interrupt_listener",
    srcs = ["interrupt_listener.cpp"],
    hdrs = ["interrupt_listener.h"],
    copts = COPTS + ["-Werror=sign-compare"],
    deps = [
        "//cuttlefish/common/libs/utils:signals",
        "//cuttlefish/posix:strerror",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/log:check",
    ],
)

cf_cc_library(
    name = "subprocess_waiter",
    srcs = ["subprocess_waiter.cpp"],
    hdrs = ["subprocess_waiter.h"],
    copts = COPTS + ["-Werror=sign-compare"],
    deps = [
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/posix:strerror",
        "//cuttlefish/result",
    ],
)

cf_cc_library(
    name = "utils",
    hdrs = [
        "common.h",
        "flags_collector.h",
        "interrupt_listener.h",
        "subprocess_waiter.h",
    ],
    copts = COPTS + ["-Werror=sign-compare"],
    deps = [
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/host/commands/cvd/cli:types",
        "//cuttlefish/host/commands/cvd/utils:common",
        "//cuttlefish/host/commands/cvd/utils:flags_collector",
        "//cuttlefish/host/commands/cvd/utils:interrupt_listener",
        "//cuttlefish/host/commands/cvd/utils:subprocess_waiter",
        "//cuttlefish/result",
        "//libbase",
    ],
)
