load("@//:rabbitmq_package_generic_unix.bzl", "rabbitmq_package_generic_unix")
load("@//:rabbitmq_run.bzl", "rabbitmq_run", "rabbitmq_run_command")
load("@//:rabbitmqctl.bzl", "rabbitmqctl")

rabbitmq_package_generic_unix(
    name = "broker-home",
    additional_files =
        glob(
            [
                "sbin/*",
                "escript/*",
            ],
            exclude = ["sbin/rabbitmqctl"],
        ) + [
            "//plugins:standard_plugins",
            "//plugins:inet_tcp_proxy_ez",
        ],
    rabbitmqctl = "sbin/rabbitmqctl",
)

rabbitmq_run(
    name = "rabbitmq-run",
    home = ":broker-home",
    visibility = ["//visibility:public"],
)

rabbitmq_run_command(
    name = "broker",
    rabbitmq_run = ":rabbitmq-run",
    subcommand = "run-broker",
)

rabbitmqctl(
    name = "rabbitmqctl",
    home = ":broker-home",
)

rabbitmqctl(
    name = "rabbitmq-diagnostics",
    home = ":broker-home",
)

rabbitmqctl(
    name = "rabbitmq-plugins",
    home = ":broker-home",
)
