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

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

exports_files([".clang-tidy"])

cf_cc_library(
    name = "boot_state_machine",
    srcs = ["boot_state_machine.cc"],
    hdrs = ["boot_state_machine.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/common/libs/utils:tee_logging",
        "//cuttlefish/host/commands/assemble_cvd:flags_defaults",
        "//cuttlefish/host/commands/kernel_log_monitor:kernel_log_monitor_utils",
        "//cuttlefish/host/commands/openwrt_control_server:libopenwrt_control_server",
        "//cuttlefish/host/commands/openwrt_control_server:openwrt_control_server_cc_proto",
        "//cuttlefish/host/commands/run_cvd:validate",
        "//cuttlefish/host/libs/command_util",
        "//cuttlefish/host/libs/config:config_constants",
        "//cuttlefish/host/libs/config:config_instance_derived",
        "//cuttlefish/host/libs/config:config_utils",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//cuttlefish/host/libs/feature",
        "//cuttlefish/host/libs/vm_manager",
        "//cuttlefish/posix:strerror",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/log:check",
        "@abseil-cpp//absl/time",
        "@fruit",
        "@gflags",
        "@grpc",
        "@grpc//:grpc++",
    ],
)

cf_cc_library(
    name = "reporting",
    srcs = ["reporting.cpp"],
    hdrs = ["reporting.h"],
    deps = [
        "//libbase",
        "@abseil-cpp//absl/log",
        "@fruit",
    ],
)

cf_cc_binary(
    name = "run_cvd",
    srcs = ["main.cc"],
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:tee_logging",
        "//cuttlefish/host/commands/run_cvd:boot_state_machine",
        "//cuttlefish/host/commands/run_cvd:reporting",
        "//cuttlefish/host/commands/run_cvd:server_loop",
        "//cuttlefish/host/commands/run_cvd:validate",
        "//cuttlefish/host/commands/run_cvd/launch:auto_cmd",
        "//cuttlefish/host/commands/run_cvd/launch:automotive_proxy",
        "//cuttlefish/host/commands/run_cvd/launch:bluetooth_connector",
        "//cuttlefish/host/commands/run_cvd/launch:casimir",
        "//cuttlefish/host/commands/run_cvd/launch:casimir_control_server",
        "//cuttlefish/host/commands/run_cvd/launch:console_forwarder",
        "//cuttlefish/host/commands/run_cvd/launch:control_env_proxy_server",
        "//cuttlefish/host/commands/run_cvd/launch:cvdalloc",
        "//cuttlefish/host/commands/run_cvd/launch:echo_server",
        "//cuttlefish/host/commands/run_cvd/launch:gnss_grpc_proxy",
        "//cuttlefish/host/commands/run_cvd/launch:kernel_log_monitor",
        "//cuttlefish/host/commands/run_cvd/launch:logcat_receiver",
        "//cuttlefish/host/commands/run_cvd/launch:mcu",
        "//cuttlefish/host/commands/run_cvd/launch:metrics",
        "//cuttlefish/host/commands/run_cvd/launch:modem",
        "//cuttlefish/host/commands/run_cvd/launch:netsim_server",
        "//cuttlefish/host/commands/run_cvd/launch:nfc_connector",
        "//cuttlefish/host/commands/run_cvd/launch:open_wrt",
        "//cuttlefish/host/commands/run_cvd/launch:openwrt_control_server",
        "//cuttlefish/host/commands/run_cvd/launch:pica",
        "//cuttlefish/host/commands/run_cvd/launch:root_canal",
        "//cuttlefish/host/commands/run_cvd/launch:screen_recording_server",
        "//cuttlefish/host/commands/run_cvd/launch:secure_env",
        "//cuttlefish/host/commands/run_cvd/launch:sensors_simulator",
        "//cuttlefish/host/commands/run_cvd/launch:sensors_socket_pair",
        "//cuttlefish/host/commands/run_cvd/launch:snapshot_control_files",
        "//cuttlefish/host/commands/run_cvd/launch:streamer",
        "//cuttlefish/host/commands/run_cvd/launch:ti50_emulator",
        "//cuttlefish/host/commands/run_cvd/launch:tombstone_receiver",
        "//cuttlefish/host/commands/run_cvd/launch:uwb_connector",
        "//cuttlefish/host/commands/run_cvd/launch:vhal_proxy_server",
        "//cuttlefish/host/commands/run_cvd/launch:vhost_device_vsock",
        "//cuttlefish/host/commands/run_cvd/launch:vhost_input_devices",
        "//cuttlefish/host/commands/run_cvd/launch:vhost_user_media_devices",
        "//cuttlefish/host/commands/run_cvd/launch:webrtc_controller",
        "//cuttlefish/host/commands/run_cvd/launch:wmediumd_server",
        "//cuttlefish/host/libs/config:config_flag",
        "//cuttlefish/host/libs/config:config_fragment",
        "//cuttlefish/host/libs/config:custom_actions",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//cuttlefish/host/libs/config:vmm_mode",
        "//cuttlefish/host/libs/config/adb",
        "//cuttlefish/host/libs/config/fastboot",
        "//cuttlefish/host/libs/feature",
        "//cuttlefish/host/libs/feature:inject",
        "//cuttlefish/host/libs/log_names",
        "//cuttlefish/host/libs/metrics",
        "//cuttlefish/host/libs/version",
        "//cuttlefish/host/libs/vm_manager",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@fruit",
        "@gflags",
    ],
)

cf_cc_library(
    name = "server_loop",
    srcs = [
        "server_loop.cpp",
        "server_loop_impl.cpp",
        "server_loop_impl.h",
        "server_loop_impl_snapshot.cpp",
        "server_loop_impl_webrtc.cpp",
    ],
    hdrs = ["server_loop.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/utils:contains",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/host/commands/run_cvd/launch:snapshot_control_files",
        "//cuttlefish/host/commands/run_cvd/launch:webrtc_controller",
        "//cuttlefish/host/libs/command_util",
        "//cuttlefish/host/libs/command_util:libcuttlefish_run_cvd_proto",
        "//cuttlefish/host/libs/config:ap_boot_flow",
        "//cuttlefish/host/libs/config:config_constants",
        "//cuttlefish/host/libs/config:config_instance_derived",
        "//cuttlefish/host/libs/config:config_utils",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//cuttlefish/host/libs/config:data_image",
        "//cuttlefish/host/libs/config:vmm_mode",
        "//cuttlefish/host/libs/feature",
        "//cuttlefish/host/libs/feature:inject",
        "//cuttlefish/host/libs/process_monitor",
        "//cuttlefish/host/libs/vm_manager",
        "//cuttlefish/posix:strerror",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/log:check",
        "@fruit",
        "@gflags",
        "@jsoncpp",
    ],
)

cf_cc_library(
    name = "validate",
    srcs = ["validate.cpp"],
    hdrs = ["validate.h"],
    clang_format_enabled = False,
    deps = [
        "//allocd:alloc_utils",
        "//cuttlefish/common/libs/utils:in_sandbox",
        "//cuttlefish/common/libs/utils:network",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//cuttlefish/host/libs/vm_manager",
        "//cuttlefish/posix:strerror",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/strings",
        "@fmt",
    ],
)
