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 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
|
## This Source Code Form is subject to the terms of the Mozilla Public
## License, v. 2.0. If a copy of the MPL was not distributed with this
## file, You can obtain one at https://mozilla.org/MPL/2.0/.
##
## Copyright (c) 2007-2024 Broadcom. All Rights Reserved. The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. All rights reserved.
defmodule RabbitMQCtl.MixfileBase do
use Mix.Project
def project do
[
app: :rabbitmqctl,
version: "4.0.0-dev",
elixir: ">= 1.13.4 and < 1.19.0",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
escript: [
main_module: RabbitMQCtl,
emu_args: "-hidden",
path: "escript/rabbitmqctl"
],
prune_code_paths: false,
deps: deps(Mix.env()),
aliases: aliases(),
xref: [
exclude: [
CSV,
CSV.Encode,
JSON,
:mnesia,
:msacc,
:observer_cli,
:public_key,
:pubkey_cert,
:rabbit,
:rabbit_control_misc,
:rabbit_data_coercion,
:rabbit_db_cluster,
:rabbit_env,
:rabbit_event,
:rabbit_file,
:rabbit_net,
:rabbit_log,
:rabbit_misc,
:rabbit_mnesia,
:rabbit_nodes_common,
:rabbit_pbe,
:rabbit_plugins,
:rabbit_resource_monitor_misc,
:stdout_formatter
]
]
]
end
# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[
applications: [:logger],
env: [
scopes: [
"rabbitmq-plugins": :plugins,
rabbitmqctl: :ctl,
"rabbitmq-diagnostics": :diagnostics,
"rabbitmq-queues": :queues,
"rabbitmq-streams": :streams,
"rabbitmq-upgrade": :upgrade,
"vmware-rabbitmq": :vmware
]
]
]
|> add_modules(Mix.env())
end
defp add_modules(app, :test) do
# There are issues with building a package without this line ¯\_(ツ)_/¯
Mix.Project.get()
path = Mix.Project.compile_path()
mods = modules_from(Path.wildcard("#{path}/*.beam"))
test_modules = [
RabbitMQ.CLI.Ctl.Commands.DuckCommand,
RabbitMQ.CLI.Ctl.Commands.GrayGooseCommand,
RabbitMQ.CLI.Ctl.Commands.UglyDucklingCommand,
RabbitMQ.CLI.Plugins.Commands.StorkCommand,
RabbitMQ.CLI.Plugins.Commands.HeronCommand,
RabbitMQ.CLI.Custom.Commands.CrowCommand,
RabbitMQ.CLI.Custom.Commands.RavenCommand,
RabbitMQ.CLI.Seagull.Commands.SeagullCommand,
RabbitMQ.CLI.Seagull.Commands.PacificGullCommand,
RabbitMQ.CLI.Seagull.Commands.HerringGullCommand,
RabbitMQ.CLI.Seagull.Commands.HermannGullCommand,
RabbitMQ.CLI.Wolf.Commands.CanisLupusCommand,
RabbitMQ.CLI.Wolf.Commands.CanisLatransCommand,
RabbitMQ.CLI.Wolf.Commands.CanisAureusCommand
]
[{:modules, (mods ++ test_modules) |> Enum.sort()} | app]
end
defp add_modules(app, _) do
app
end
defp modules_from(beams) do
Enum.map(beams, &(&1 |> Path.basename() |> Path.rootname(".beam") |> String.to_atom()))
end
# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# Type "mix help deps" for more examples and options
#
# CAUTION: Dependencies which are shipped with RabbitMQ *MUST* com
# from Hex.pm! Therefore it's ok to fetch dependencies from Git if
# they are test dependencies or it is temporary while testing a patch.
# But that's about it. If in doubt, use Hex.pm!
#
# The reason is that we have some Makefile code to put dependencies
# from Hex.pm in RabbitMQ source archive (the source archive must be
# self-contained and RabbitMQ must be buildable offline). However, we
# don't have the equivalent for other methods.
defp deps(env) do
deps_dir = System.get_env("DEPS_DIR", "deps")
# Mix is confused by any `rebar.{config,lock}` we might have left in
# `rabbit_common` or `amqp_client`. So just remove those files to be
# safe, as they are generated when we publish to Hex.pm only.
for dir <- ["rabbit_common", "amqp_client"] do
for file <- ["rebar.config", "rebar.lock"] do
File.rm(Path.join([deps_dir, dir, file]))
end
end
make_cmd = System.get_env("MAKE", "make")
fake_cmd = "true"
is_bazel = System.get_env("IS_BAZEL") != nil
[
{
:json,
path: Path.join(deps_dir, "json")
},
{
:csv,
path: Path.join(deps_dir, "csv")
},
{
:stdout_formatter,
path: Path.join(deps_dir, "stdout_formatter"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd)
},
{
:observer_cli,
path: Path.join(deps_dir, "observer_cli"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd)
},
{
:rabbit_common,
path: Path.join(deps_dir, "rabbit_common"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
override: true
}
] ++
case env do
:test ->
[
{
:amqp,
path: Path.join(deps_dir, "amqp")
},
{
:rabbit,
path: Path.join(deps_dir, "rabbit"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
override: true
},
{
:temp,
path: Path.join(deps_dir, "temp")
},
{
:x509,
path: Path.join(deps_dir, "x509")
},
{
:amqp_client,
path: Path.join(deps_dir, "amqp_client"),
compile: if(is_bazel, do: fake_cmd, else: make_cmd),
override: true
}
]
_ ->
[]
end
end
defp aliases do
[
make_deps: [
"deps.get",
"deps.compile"
],
make_app: [
"compile",
"escript.build"
],
make_all: [
"deps.get",
"deps.compile",
"compile",
"escript.build"
],
make_all_in_src_archive: [
"deps.get --only prod",
"deps.compile",
"compile",
"escript.build"
]
]
end
end
|