summaryrefslogtreecommitdiff
path: root/deps/rabbitmq_cli/BUILD.bazel
blob: b2dcc1c3e002796133492e1ce7d21228d4b55ed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load(":rabbitmqctl.bzl", "rabbitmqctl")
load(":rabbitmqctl_check_formatted.bzl", "rabbitmqctl_check_formatted_test")
load(":rabbitmqctl_test.bzl", "rabbitmqctl_test")
load("//:rabbitmq_home.bzl", "rabbitmq_home")
load("//:rabbitmq_run.bzl", "rabbitmq_run")
load("//:rabbitmq.bzl", "RABBITMQ_DIALYZER_OPTS", "STARTS_BACKGROUND_BROKER_TAG", "without")

# Note: All the various rabbitmq-* scripts are just copies of rabbitmqctl
rabbitmqctl(
    name = "rabbitmqctl",
    srcs = [
        "mix.exs",
        "config/config.exs",
    ] + glob([
        "lib/**/*.ex",
    ]),
    archives = [
        "@hex//:archive",
    ],
    license_files = glob(["LICENSE*"]),
    source_deps = {
        "@csv//:sources": "csv",
        "@json//:sources": "json",
        "@parallel_stream//:sources": "parallel_stream",  # transitive dep of csv 2.x
    },
    visibility = ["//visibility:public"],
    deps = [
        "//deps/rabbit_common:erlang_app",
        "@observer_cli//:erlang_app",
        "@stdout_formatter//:erlang_app",
    ],
)

rabbitmq_home(
    name = "broker-for-cli-tests-home",
    testonly = True,
    plugins = [
        "//deps/rabbit:erlang_app",
        "//deps/rabbitmq_federation:erlang_app",
        "//deps/rabbitmq_stomp:erlang_app",
        "//deps/rabbitmq_stream_management:erlang_app",
        "//deps/amqp_client:erlang_app",
    ],
)

rabbitmq_run(
    name = "rabbitmq-for-cli-tests-run",
    testonly = True,
    home = ":broker-for-cli-tests-home",
    visibility = ["//visibility:public"],
)

rabbitmqctl_check_formatted_test(
    name = "check_formatted",
    size = "small",
    srcs = [
        "mix.exs",
        "config/config.exs",
        ".formatter.exs",
    ] + glob([
        "lib/**/*.ex",
        "test/**/*.exs",
    ]),
    data = glob(["test/fixtures/**/*"]),
    target_compatible_with = select({
        "@platforms//os:macos": ["@platforms//os:macos"],
        "//conditions:default": ["@platforms//os:linux"],
    }),
)

test_suite(
    name = "rabbitmqctl_check_formatted",
    tests = ["check_formatted"],
)

plt(
    name = "deps_plt",
    apps = [
        "kernel",
        "stdlib",
        "erts",
        "mnesia",
        "public_key",
        "runtime_tools",
    ],
    ignore_warnings = True,
    libs = [":elixir"],
    deps = [
        ":elixir",
        "//deps/rabbit:erlang_app",
        "//deps/rabbit_common:erlang_app",
    ],
)

dialyze(
    dialyzer_opts = without(
        # Some Elixir.CSV, Elixir.JSON and Elixir.Logger functions are unknown
        "-Wunknown",
        RABBITMQ_DIALYZER_OPTS,
    ),
    libs = [":elixir"],
    plt = ":deps_plt",
)

rabbitmqctl_test(
    name = "tests",
    size = "large",
    srcs = [
        "mix.exs",
        "config/config.exs",
        ".formatter.exs",
    ] + glob([
        "lib/**/*.ex",
        "test/**/*.exs",
    ]),
    archives = [
        "@hex//:archive",
    ],
    data = glob(["test/fixtures/**/*"]),
    flaky = True,
    rabbitmq_run = ":rabbitmq-for-cli-tests-run",
    source_deps = {
        "@amqp//:sources": "amqp",
        "@csv//:sources": "csv",
        "@dialyxir//:sources": "dialyxir",
        "@json//:sources": "json",
        "@parallel_stream//:sources": "parallel_stream",  # transitive dep of csv 2.x
        "@temp//:sources": "temp",
        "@x509//:sources": "x509",
    },
    tags = [STARTS_BACKGROUND_BROKER_TAG],
    deps = [
        "//deps/amqp_client:erlang_app",
        "//deps/rabbit:erlang_app",
        "//deps/rabbit_common:erlang_app",
        "@observer_cli//:erlang_app",
        "@stdout_formatter//:erlang_app",
    ],
)

test_suite(
    name = "rabbitmqctl_tests",
    tests = ["tests"],
)