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"],
    deps = [
        "//cuttlefish/common/libs/utils:environment",
        "//libbase",
        "@abseil-cpp//absl/strings",
    ],
)

cf_cc_library(
    name = "android_build_api",
    srcs = ["android_build_api.cpp"],
    hdrs = ["android_build_api.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/utils:contains",
        "//cuttlefish/common/libs/utils:environment",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/host/libs/web:android_build",
        "//cuttlefish/host/libs/web:android_build_api_key",
        "//cuttlefish/host/libs/web:android_build_string",
        "//cuttlefish/host/libs/web:android_build_url",
        "//cuttlefish/host/libs/web:build_api",
        "//cuttlefish/host/libs/web:credential_source",
        "//cuttlefish/host/libs/web:parse_time",
        "//cuttlefish/host/libs/web/cas:cas_downloader",
        "//cuttlefish/host/libs/web/http_client",
        "//cuttlefish/host/libs/web/http_client:http_file",
        "//cuttlefish/host/libs/web/http_client:http_json",
        "//cuttlefish/host/libs/zip:remote_zip",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/host/libs/zip/libzip_cc:writable_source",
        "//cuttlefish/posix:symlink",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/log:check",
        "@jsoncpp",
    ],
)

cf_cc_library(
    name = "android_build_api_key",
    srcs = [
        "android_build_api_key.cc",
    ],
    hdrs = [
        "android_build_api_key.h",
    ],
)

cf_cc_library(
    name = "android_build_string",
    srcs = ["android_build_string.cpp"],
    hdrs = ["android_build_string.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/flag_parser",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
        "@fmt",
    ],
)

cf_cc_test(
    name = "android_build_string_test",
    srcs = ["android_build_string_tests.cpp"],
    deps = [
        "//cuttlefish/flag_parser",
        "//cuttlefish/host/libs/web:android_build_string",
        "//cuttlefish/result",
        "//cuttlefish/result:result_matchers",
    ],
)

cf_cc_test(
    name = "android_build_api_test",
    srcs = ["android_build_api_test.cpp"],
    deps = [
        "//cuttlefish/host/libs/web:android_build",
        "//cuttlefish/host/libs/web:android_build_api",
        "//cuttlefish/host/libs/web:android_build_url",
        "//cuttlefish/host/libs/web/http_client",
        "//cuttlefish/host/libs/web/http_client:fake_http_client",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/result",
        "//cuttlefish/result:result_matchers",
    ],
)

cf_cc_library(
    name = "android_build_url",
    srcs = ["android_build_url.cpp"],
    hdrs = ["android_build_url.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/host/libs/web/http_client:url_escape",
        "//cuttlefish/result",
        "@fmt",
    ],
)

cf_cc_library(
    name = "build_api",
    hdrs = ["build_api.h"],
    deps = [
        "//cuttlefish/host/libs/web:android_build",
        "//cuttlefish/host/libs/web:android_build_string",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/result",
    ],
)

cf_cc_library(
    name = "build_api_zip",
    srcs = ["build_api_zip.cc"],
    hdrs = ["build_api_zip.h"],
    deps = [
        "//cuttlefish/host/libs/web:android_build",
        "//cuttlefish/host/libs/web:build_api",
        "//cuttlefish/host/libs/zip:buffered_zip_source",
        "//cuttlefish/host/libs/zip/libzip_cc:archive",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/result",
    ],
)

cf_cc_library(
    name = "caching_build_api",
    srcs = ["caching_build_api.cpp"],
    hdrs = ["caching_build_api.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/host/libs/web:android_build",
        "//cuttlefish/host/libs/web:android_build_api",
        "//cuttlefish/host/libs/web:android_build_string",
        "//cuttlefish/host/libs/web:build_api",
        "//cuttlefish/host/libs/web:credential_source",
        "//cuttlefish/host/libs/web/cas:cas_downloader",
        "//cuttlefish/host/libs/web/http_client",
        "//cuttlefish/host/libs/zip:cached_zip_source",
        "//cuttlefish/host/libs/zip/libzip_cc:seekable_source",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/log",
        "@abseil-cpp//absl/strings",
        "@fmt",
    ],
)

cf_cc_library(
    name = "chrome_os_build_string",
    srcs = ["chrome_os_build_string.cpp"],
    hdrs = ["chrome_os_build_string.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/flag_parser",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
        "@fmt",
    ],
)

cf_cc_library(
    name = "credential_source",
    srcs = ["credential_source.cc"],
    hdrs = ["credential_source.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/utils:base64",
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/host/libs/web/http_client",
        "//cuttlefish/host/libs/web/http_client:http_json",
        "//cuttlefish/host/libs/web/http_client:url_escape",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
        "@boringssl//:crypto",
        "@jsoncpp",
    ],
)

cf_cc_library(
    name = "luci_build_api",
    srcs = ["luci_build_api.cpp"],
    hdrs = ["luci_build_api.h"],
    clang_format_enabled = False,
    deps = [
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/host/libs/web:chrome_os_build_string",
        "//cuttlefish/host/libs/web:credential_source",
        "//cuttlefish/host/libs/web/http_client",
        "//cuttlefish/host/libs/web/http_client:http_file",
        "//cuttlefish/host/libs/web/http_client:http_string",
        "//cuttlefish/host/libs/web/http_client:url_escape",
        "//cuttlefish/result",
        "//libbase",
        "@abseil-cpp//absl/strings",
        "@fmt",
        "@jsoncpp",
    ],
)

cf_cc_library(
    name = "oauth2_consent",
    srcs = ["oauth2_consent.cpp"],
    hdrs = ["oauth2_consent.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/libs/directories",
        "//cuttlefish/host/libs/web:credential_source",
        "//cuttlefish/host/libs/web/http_client",
        "//cuttlefish/host/libs/web/http_client:http_json",
        "//cuttlefish/host/libs/web/http_client:url_escape",
        "//cuttlefish/result",
        "@abseil-cpp//absl/strings",
        "@fmt",
        "@jsoncpp",
        "@zlib",
    ],
)

cf_cc_library(
    name = "parse_time",
    srcs = ["parse_time.cc"],
    hdrs = ["parse_time.h"],
    deps = [
        "//cuttlefish/result:expect",
        "//cuttlefish/result:result_type",
    ],
)

cf_cc_test(
    name = "parse_time_test",
    srcs = ["parse_time_test.cc"],
    deps = [
        "//cuttlefish/host/libs/web:parse_time",
        "//cuttlefish/result:result_matchers",
    ],
)
