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

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

exports_files([".clang-tidy"])

cf_cc_library(
    name = "android_build",
    srcs = ["android_build.cc"],
    hdrs = ["android_build.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/pretty",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
    ],
)

cf_cc_library(
    name = "android_builds",
    srcs = ["android_builds.cc"],
    hdrs = ["android_builds.h"],
    deps = [
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:identify_build",
        "//cuttlefish/pretty",
        "//cuttlefish/pretty:map",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/pretty:unique_ptr",
        "//cuttlefish/pretty:vector",
        "//cuttlefish/result",
        "@abseil-cpp//absl/log:check",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "android_dist_build",
    srcs = ["android_dist_build.cc"],
    hdrs = ["android_dist_build.h"],
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:android_product_dir",
        "//cuttlefish/host/commands/assemble_cvd/android_build:combined_android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:img_zip",
        "//cuttlefish/host/commands/assemble_cvd/android_build:target_files",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "android_product_dir",
    srcs = ["android_product_dir.cc"],
    hdrs = ["android_product_dir.h"],
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:str_format",
    ],
)

cf_cc_library(
    name = "combined_android_build",
    srcs = ["combined_android_build.cc"],
    hdrs = ["combined_android_build.h"],
    deps = [
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/pretty:unique_ptr",
        "//cuttlefish/pretty:vector",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_test(
    name = "combined_android_build_test",
    srcs = ["combined_android_build_test.cc"],
    deps = [
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:combined_android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:fake_android_build",
        "//cuttlefish/result",
        "//cuttlefish/result:result_matchers",
    ],
)

cf_cc_library(
    name = "fake_android_build",
    testonly = True,
    srcs = ["fake_android_build.cc"],
    hdrs = ["fake_android_build.h"],
    deps = [
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/pretty:map",
        "//cuttlefish/pretty:optional",
        "//cuttlefish/pretty:pair",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "fetched_android_build",
    srcs = ["fetched_android_build.cc"],
    hdrs = ["fetched_android_build.h"],
    deps = [
        "//cuttlefish/common/libs/key_equals_value",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:combined_android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:img_zip",
        "//cuttlefish/host/commands/assemble_cvd/android_build:target_files",
        "//cuttlefish/host/libs/config:fetcher_config",
        "//cuttlefish/host/libs/config:file_source",
        "//cuttlefish/result",
        "//libbase",
    ],
)

cf_cc_library(
    name = "find_build_archive",
    srcs = ["find_build_archive.cc"],
    hdrs = ["find_build_archive.h"],
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/host/libs/config:build_archive",
        "//cuttlefish/host/libs/config:fetcher_config",
        "//cuttlefish/host/libs/config:file_source",
        "//cuttlefish/host/libs/zip:zip_file",
        "//cuttlefish/host/libs/zip/libzip_cc:archive",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "identify_build",
    srcs = ["identify_build.cc"],
    hdrs = ["identify_build.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:android_dist_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:android_product_dir",
        "//cuttlefish/host/commands/assemble_cvd/android_build:combined_android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:fetched_android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:physical_partitions",
        "//cuttlefish/host/commands/assemble_cvd/android_build:super_image",
        "//cuttlefish/host/libs/config:fetcher_config",
        "//cuttlefish/host/libs/config:file_source",
        "//cuttlefish/pretty",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "img_zip",
    srcs = ["img_zip.cc"],
    hdrs = ["img_zip.h"],
    deps = [
        "//cuttlefish/common/libs/key_equals_value",
        "//cuttlefish/host/commands/assemble_cvd:guest_config_cc_proto",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:find_build_archive",
        "//cuttlefish/host/libs/config:build_archive",
        "//cuttlefish/host/libs/config:fetcher_config",
        "//cuttlefish/host/libs/config:file_source",
        "//cuttlefish/pretty:map",
        "//cuttlefish/pretty:optional",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
        "@protobuf",
    ],
)

cf_cc_library(
    name = "misc_info_metadata",
    srcs = ["misc_info_metadata.cc"],
    hdrs = ["misc_info_metadata.h"],
    deps = [
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/pretty:map",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "physical_partitions",
    srcs = ["physical_partitions.cc"],
    hdrs = ["physical_partitions.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
    ],
)

cf_cc_library(
    name = "super_image",
    srcs = ["super_image.cc"],
    hdrs = ["super_image.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/pretty",
        "//cuttlefish/pretty:map",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/pretty:unique_ptr",
        "//cuttlefish/pretty/liblp",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
        "@android_system_core//:liblp",
    ],
)

cf_cc_library(
    name = "target_files",
    srcs = ["target_files.cc"],
    hdrs = ["target_files.h"],
    deps = [
        "//cuttlefish/common/libs/key_equals_value",
        "//cuttlefish/host/commands/assemble_cvd/android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:combined_android_build",
        "//cuttlefish/host/commands/assemble_cvd/android_build:find_build_archive",
        "//cuttlefish/host/commands/assemble_cvd/android_build:misc_info_metadata",
        "//cuttlefish/host/libs/config:build_archive",
        "//cuttlefish/host/libs/config:fetcher_config",
        "//cuttlefish/host/libs/config:file_source",
        "//cuttlefish/pretty:map",
        "//cuttlefish/pretty:optional",
        "//cuttlefish/pretty:result",
        "//cuttlefish/pretty:set",
        "//cuttlefish/pretty:struct",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
        "@abseil-cpp//absl/strings:str_format",
    ],
)
