load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("//:build_variables.bzl", "COPTS")

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

cc_binary(
    name = "fastboot",
    srcs = [
        "bootimg_utils.cpp",
        "bootimg_utils.h",
        "constants.h",
        "diagnose_usb/diagnose_usb.cpp",
        "diagnose_usb/include/diagnose_usb.h",
        "fastboot.cpp",
        "fastboot.h",
        "fastboot_driver.cpp",
        "fastboot_driver.h",
        "fastboot_driver_interface.h",
        "filesystem.cpp",
        "filesystem.h",
        "fs.cpp",
        "fs.h",
        "libstorage_literals/storage_literals/storage_literals.h",
        "main.cpp",
        "result.h",
        "socket.cpp",
        "socket.h",
        "storage.cpp",
        "storage.h",
        "super_flash_helper.cpp",
        "super_flash_helper.h",
        "task.cpp",
        "task.h",
        "tcp.cpp",
        "tcp.h",
        "transport.h",
        "udp.cpp",
        "udp.h",
        "usb.h",
        "usb_linux.cpp",
        "util.cpp",
        "util.h",
        "vendor_boot_img_utils.cpp",
        "vendor_boot_img_utils.h",
        "version/build/version.h",
        "version/platform_tools_version.h",
    ],
    copts = COPTS + [
        "-Wno-inconsistent-missing-override",
        "-Wno-module-import-in-extern-c",
    ],
    features = ["-layering_check"],  # Incompatible with libzip cmake build
    includes = [
        "diagnose_usb/include",
        "libstorage_literals",
        "version",
    ],
    linkopts = ["-llzma"],
    local_defines = [
        "ANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
    ],
    deps = [
        "//libbase",
        "@android_system_core//:libcutils",
        "@android_system_core//:liblp",
        "@android_system_core//:libsparse",
        "@avb//:libavb",
        "@googletest//:gtest",
        "@libzip",
        "@mkbootimg//:bootimg_header",
        "@zlib",
    ],
)
