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

go_library(
    name = "redpanda",
    srcs = [
        "check.go",
        "config.go",
        "mode.go",
        "package.go",
        "redpanda.go",
        "redpanda_darwin.go",
        "start.go",
        "stop.go",
    ],
    importpath = "github.com/redpanda-data/redpanda/src/go/rpk/pkg/cli/redpanda",
    visibility = ["//visibility:public"],
    deps = select({
        "@rules_go//go/platform:android": [
            "//src/go/rpk/pkg/cli/redpanda/admin",
            "//src/go/rpk/pkg/cli/redpanda/tune",
            "//src/go/rpk/pkg/cloud",
            "//src/go/rpk/pkg/cobraext",
            "//src/go/rpk/pkg/config",
            "//src/go/rpk/pkg/net",
            "//src/go/rpk/pkg/os",
            "//src/go/rpk/pkg/out",
            "//src/go/rpk/pkg/redpanda",
            "//src/go/rpk/pkg/tuners",
            "//src/go/rpk/pkg/tuners/factory",
            "//src/go/rpk/pkg/tuners/hwloc",
            "//src/go/rpk/pkg/tuners/iotune",
            "//src/go/rpk/pkg/utils",
            "@com_github_fatih_color//:color",
            "@com_github_spf13_afero//:afero",
            "@com_github_spf13_cobra//:cobra",
            "@com_github_spf13_pflag//:pflag",
            "@org_uber_go_zap//:zap",
        ],
        "@rules_go//go/platform:darwin": [
            "//src/go/rpk/pkg/cli/redpanda/admin",
            "//src/go/rpk/pkg/config",
            "@com_github_spf13_afero//:afero",
            "@com_github_spf13_cobra//:cobra",
        ],
        "@rules_go//go/platform:ios": [
            "//src/go/rpk/pkg/cli/redpanda/admin",
            "//src/go/rpk/pkg/config",
            "@com_github_spf13_afero//:afero",
            "@com_github_spf13_cobra//:cobra",
        ],
        "@rules_go//go/platform:linux": [
            "//src/go/rpk/pkg/cli/redpanda/admin",
            "//src/go/rpk/pkg/cli/redpanda/tune",
            "//src/go/rpk/pkg/cloud",
            "//src/go/rpk/pkg/cobraext",
            "//src/go/rpk/pkg/config",
            "//src/go/rpk/pkg/net",
            "//src/go/rpk/pkg/os",
            "//src/go/rpk/pkg/out",
            "//src/go/rpk/pkg/redpanda",
            "//src/go/rpk/pkg/tuners",
            "//src/go/rpk/pkg/tuners/factory",
            "//src/go/rpk/pkg/tuners/hwloc",
            "//src/go/rpk/pkg/tuners/iotune",
            "//src/go/rpk/pkg/utils",
            "@com_github_fatih_color//:color",
            "@com_github_spf13_afero//:afero",
            "@com_github_spf13_cobra//:cobra",
            "@com_github_spf13_pflag//:pflag",
            "@org_uber_go_zap//:zap",
        ],
        "//conditions:default": [],
    }),
)

go_test(
    name = "redpanda_test",
    size = "small",
    srcs = [
        "config_test.go",
        "mode_test.go",
        "start_test.go",
        "stop_test.go",
    ],
    embed = [":redpanda"],
    deps = select({
        "@rules_go//go/platform:android": [
            "//src/go/rpk/pkg/config",
            "//src/go/rpk/pkg/os",
            "//src/go/rpk/pkg/redpanda",
            "//src/go/rpk/pkg/tuners/iotune",
            "//src/go/rpk/pkg/utils",
            "@com_github_spf13_afero//:afero",
            "@com_github_spf13_pflag//:pflag",
            "@com_github_stretchr_testify//require",
            "@in_gopkg_yaml_v3//:yaml_v3",
        ],
        "@rules_go//go/platform:linux": [
            "//src/go/rpk/pkg/config",
            "//src/go/rpk/pkg/os",
            "//src/go/rpk/pkg/redpanda",
            "//src/go/rpk/pkg/tuners/iotune",
            "//src/go/rpk/pkg/utils",
            "@com_github_spf13_afero//:afero",
            "@com_github_spf13_pflag//:pflag",
            "@com_github_stretchr_testify//require",
            "@in_gopkg_yaml_v3//:yaml_v3",
        ],
        "//conditions:default": [],
    }),
)
