load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "build_event_handler",
    srcs = ["build_event_handler.go"],
    importpath = "github.com/buildbuddy-io/buildbuddy/server/build_event_protocol/build_event_handler",
    visibility = ["//visibility:public"],
    deps = [
        "//proto:build_event_stream_go_proto",
        "//proto:build_events_go_proto",
        "//proto:cache_go_proto",
        "//proto:invocation_go_proto",
        "//proto:publish_build_event_go_proto",
        "//proto:user_id_go_proto",
        "//server/build_event_protocol/accumulator",
        "//server/build_event_protocol/build_status_reporter",
        "//server/build_event_protocol/event_parser",
        "//server/build_event_protocol/invocation_format",
        "//server/build_event_protocol/target_tracker",
        "//server/environment",
        "//server/eventlog",
        "//server/interfaces",
        "//server/metrics",
        "//server/remote_cache/hit_tracker",
        "//server/tables",
        "//server/terminal",
        "//server/util/alert",
        "//server/util/background",
        "//server/util/git",
        "//server/util/log",
        "//server/util/perms",
        "//server/util/protofile",
        "//server/util/redact",
        "//server/util/status",
        "//server/util/uuid",
        "@com_github_golang_protobuf//proto:go_default_library",
        "@com_github_golang_protobuf//ptypes:go_default_library_gen",
        "@com_github_google_shlex//:shlex",
        "@com_github_prometheus_client_golang//prometheus",
        "@org_golang_google_grpc//status",
        "@org_golang_x_sync//errgroup",
    ],
)

go_test(
    name = "build_event_handler_test",
    srcs = ["build_event_handler_test.go"],
    deps = [
        ":build_event_handler",
        "//proto:build_event_stream_go_proto",
        "//proto:build_events_go_proto",
        "//proto:command_line_go_proto",
        "//proto:invocation_go_proto",
        "//proto:publish_build_event_go_proto",
        "//server/backends/chunkstore",
        "//server/eventlog",
        "//server/tables",
        "//server/testutil/testauth",
        "//server/testutil/testclock",
        "//server/testutil/testenv",
        "//server/util/protofile",
        "//server/util/testing/flags",
        "@com_github_golang_protobuf//proto:go_default_library",
        "@com_github_google_uuid//:uuid",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@io_bazel_rules_go//proto/wkt:any_go_proto",
    ],
)
