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

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

exports_files([".clang-tidy"])

cf_cc_library(
    name = "archive",
    srcs = ["archive.cc"],
    hdrs = ["archive.h"],
    clang_format_enabled = False,
    features = ["-layering_check"],  # libzip
    linkopts = ["-llzma"],  # libzip
    linkstatic = True,  # libzip
    deps = [
        "//cuttlefish/host/libs/zip/libzip_cc:error",
        "//cuttlefish/host/libs/zip/libzip_cc:managed",
        "//cuttlefish/host/libs/zip/libzip_cc:readable_source",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/host/libs/zip/libzip_cc:stat",
        "//cuttlefish/host/libs/zip/libzip_cc:writable_source",
        "//cuttlefish/io",
        "//cuttlefish/io:filesystem",
        "//cuttlefish/result",
        "@libzip",
        "@zlib",
    ],
)

cf_cc_library(
    name = "error",
    srcs = ["error.cc"],
    hdrs = ["error.h"],
    features = ["-layering_check"],  # libzip
    linkopts = ["-llzma"],  # libzip
    linkstatic = True,  # libzip
    visibility = ["//visibility:private"],
    deps = [
        "//cuttlefish/host/libs/zip/libzip_cc:managed",
        "@libzip",
    ],
)

cf_cc_library(
    name = "managed",
    hdrs = ["managed.h"],
    features = ["-layering_check"],  # libzip
    linkopts = ["-llzma"],  # libzip
    linkstatic = True,  # libzip
    visibility = ["//visibility:private"],
    deps = ["@libzip"],
)

cf_cc_library(
    name = "readable_source",
    srcs = ["readable_source.cc"],
    hdrs = ["readable_source.h"],
    clang_format_enabled = False,
    features = ["-layering_check"],  # libzip
    linkopts = ["-llzma"],  # libzip
    linkstatic = True,  # libzip
    deps = [
        "//cuttlefish/host/libs/zip/libzip_cc:error",
        "//cuttlefish/host/libs/zip/libzip_cc:managed",
        "//cuttlefish/host/libs/zip/libzip_cc:source_callback",
        "//cuttlefish/host/libs/zip/libzip_cc:stat",
        "//cuttlefish/io",
        "//cuttlefish/result",
        "@libzip",
        "@zlib",
    ],
)

cf_cc_library(
    name = "seekable_source",
    srcs = ["seekable_source.cc"],
    hdrs = ["seekable_source.h"],
    clang_format_enabled = False,
    features = ["-layering_check"],  # libzip
    linkopts = ["-llzma"],  # libzip
    linkstatic = True,  # libzip
    deps = [
        "//cuttlefish/host/libs/zip/libzip_cc:error",
        "//cuttlefish/host/libs/zip/libzip_cc:managed",
        "//cuttlefish/host/libs/zip/libzip_cc:readable_source",
        "//cuttlefish/host/libs/zip/libzip_cc:source_callback",
        "//cuttlefish/io",
        "//cuttlefish/io:fake_pread_pwrite",
        "//cuttlefish/result",
        "@libzip",
        "@zlib",
    ],
)

cf_cc_library(
    name = "stat",
    hdrs = ["stat.h"],
)

cf_cc_library(
    name = "source_callback",
    hdrs = ["source_callback.h"],
)

cf_cc_library(
    name = "writable_source",
    srcs = ["writable_source.cc"],
    hdrs = ["writable_source.h"],
    features = ["-layering_check"],  # libzip
    linkopts = ["-llzma"],  # libzip
    linkstatic = True,  # libzip
    deps = [
        "//cuttlefish/host/libs/zip/libzip_cc:error",
        "//cuttlefish/host/libs/zip/libzip_cc:managed",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/result",
        "@libzip",
        "@zlib",
    ],
)
