2016-02-03 23:01:32 +08:00
|
|
|
## The contents of this file are subject to the Mozilla Public License
|
|
|
|
|
## Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
|
## compliance with the License. You may obtain a copy of the License
|
|
|
|
|
## at http://www.mozilla.org/MPL/
|
|
|
|
|
##
|
|
|
|
|
## Software distributed under the License is distributed on an "AS IS"
|
|
|
|
|
## basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
|
|
|
|
## the License for the specific language governing rights and
|
|
|
|
|
## limitations under the License.
|
|
|
|
|
##
|
|
|
|
|
## The Original Code is RabbitMQ.
|
|
|
|
|
##
|
|
|
|
|
## The Initial Developer of the Original Code is GoPivotal, Inc.
|
2017-01-10 22:42:40 +08:00
|
|
|
## Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved.
|
2016-02-03 23:01:32 +08:00
|
|
|
|
2016-06-16 23:29:06 +08:00
|
|
|
defmodule RabbitMQCtl.MixfileBase do
|
2016-02-03 02:54:36 +08:00
|
|
|
use Mix.Project
|
|
|
|
|
|
|
|
|
|
def project do
|
2016-03-05 01:42:43 +08:00
|
|
|
[
|
|
|
|
|
app: :rabbitmqctl,
|
2018-02-23 04:59:23 +08:00
|
|
|
version: "3.8.0-dev",
|
2018-04-04 16:15:05 +08:00
|
|
|
elixir: "~> 1.6.0",
|
2016-03-05 01:42:43 +08:00
|
|
|
build_embedded: Mix.env == :prod,
|
|
|
|
|
start_permanent: Mix.env == :prod,
|
2016-10-25 23:14:26 +08:00
|
|
|
escript: [main_module: RabbitMQCtl,
|
2018-01-29 21:56:18 +08:00
|
|
|
emu_args: "-hidden",
|
2016-10-25 23:14:26 +08:00
|
|
|
path: "escript/rabbitmqctl"],
|
2017-12-07 19:16:44 +08:00
|
|
|
deps: deps(),
|
2017-01-16 19:38:20 +08:00
|
|
|
aliases: aliases()
|
2016-03-05 01:42:43 +08:00
|
|
|
]
|
2016-02-03 02:54:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Configuration for the OTP application
|
|
|
|
|
#
|
|
|
|
|
# Type "mix help compile.app" for more information
|
|
|
|
|
def application do
|
2016-11-16 00:46:36 +08:00
|
|
|
[applications: [:logger],
|
2016-06-20 23:52:36 +08:00
|
|
|
env: [scopes: ['rabbitmq-plugins': :plugins,
|
2016-10-07 21:36:54 +08:00
|
|
|
rabbitmqctl: :ctl,
|
2016-10-28 20:29:30 +08:00
|
|
|
'rabbitmq-diagnostics': :diagnostics]]
|
2016-06-17 17:49:38 +08:00
|
|
|
]
|
2016-06-23 19:33:39 +08:00
|
|
|
|> add_modules(Mix.env)
|
|
|
|
|
end
|
|
|
|
|
|
2016-08-23 21:28:07 +08:00
|
|
|
|
2016-06-23 19:33:39 +08:00
|
|
|
defp add_modules(app, :test) do
|
2017-06-09 01:15:21 +08:00
|
|
|
# There are issues with building a package without this line ¯\_(ツ)_/¯
|
2016-11-03 20:02:04 +08:00
|
|
|
Mix.Project.get
|
2016-06-23 19:33:39 +08:00
|
|
|
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,
|
2016-11-23 01:40:45 +08:00
|
|
|
RabbitMQ.CLI.Seagull.Commands.SeagullCommand,
|
|
|
|
|
RabbitMQ.CLI.Seagull.Commands.PacificGullCommand,
|
2016-12-06 20:19:25 +08:00
|
|
|
RabbitMQ.CLI.Seagull.Commands.HerringGullCommand,
|
2017-01-17 01:56:17 +08:00
|
|
|
RabbitMQ.CLI.Seagull.Commands.HermannGullCommand,
|
|
|
|
|
RabbitMQ.CLI.Wolf.Commands.CanisLupusCommand,
|
|
|
|
|
RabbitMQ.CLI.Wolf.Commands.CanisLatransCommand,
|
|
|
|
|
RabbitMQ.CLI.Wolf.Commands.CanisAureusCommand
|
|
|
|
|
]
|
2016-06-23 19:33:39 +08:00
|
|
|
[{: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)
|
2016-02-03 02:54:36 +08:00
|
|
|
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
|
2017-12-07 19:16:44 +08:00
|
|
|
defp deps() do
|
|
|
|
|
elixir_deps = [
|
2016-12-06 02:59:58 +08:00
|
|
|
{:json, "~> 1.0.0"},
|
2017-06-26 18:59:46 +08:00
|
|
|
{:csv, "~> 2.0.0"},
|
2017-08-14 21:36:38 +08:00
|
|
|
{:simetric, "~> 0.2.0"},
|
2017-12-07 19:16:44 +08:00
|
|
|
|
|
|
|
|
{:amqp, "~> 0.2.2", only: :test},
|
|
|
|
|
{:dialyxir, "~> 0.5", only: :test, runtime: false},
|
|
|
|
|
{:temp, "~> 0.4", only: :test},
|
2016-03-03 23:08:47 +08:00
|
|
|
]
|
2017-12-07 19:16:44 +08:00
|
|
|
|
|
|
|
|
rabbitmq_deps = case System.get_env("DEPS_DIR") do
|
|
|
|
|
nil ->
|
|
|
|
|
# rabbitmq_cli is built as a standalone Elixir application.
|
|
|
|
|
[
|
|
|
|
|
{:rabbit_common, "~> 3.7.0"},
|
|
|
|
|
{:amqp_client, "~> 3.7.0", only: :test},
|
|
|
|
|
]
|
|
|
|
|
deps_dir ->
|
|
|
|
|
# rabbitmq_cli is built as part of RabbitMQ.
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
# We disable compilation for rabbit_common and amqp_client
|
|
|
|
|
# because Erlang.mk already built them.
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
:rabbit_common,
|
|
|
|
|
path: Path.join(deps_dir, "rabbit_common"),
|
|
|
|
|
compile: false,
|
|
|
|
|
override: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
:amqp_client,
|
|
|
|
|
path: Path.join(deps_dir, "amqp_client"),
|
|
|
|
|
compile: false,
|
|
|
|
|
override: true,
|
|
|
|
|
only: :test
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
elixir_deps ++ rabbitmq_deps
|
2016-02-03 02:54:36 +08:00
|
|
|
end
|
2016-03-04 00:34:13 +08:00
|
|
|
|
2016-12-30 00:42:21 +08:00
|
|
|
defp aliases do
|
|
|
|
|
[
|
|
|
|
|
make_deps: [
|
|
|
|
|
"deps.get",
|
|
|
|
|
"deps.compile",
|
|
|
|
|
],
|
2017-01-10 22:45:15 +08:00
|
|
|
make_app: [
|
|
|
|
|
"compile",
|
|
|
|
|
"escript.build",
|
|
|
|
|
],
|
2016-12-30 00:42:21 +08:00
|
|
|
make_all: [
|
2017-01-10 22:45:15 +08:00
|
|
|
"deps.get",
|
|
|
|
|
"deps.compile",
|
2016-12-30 00:42:21 +08:00
|
|
|
"compile",
|
|
|
|
|
"escript.build",
|
2017-01-10 22:45:15 +08:00
|
|
|
],
|
2016-06-06 18:06:46 +08:00
|
|
|
]
|
|
|
|
|
end
|
2016-02-03 02:54:36 +08:00
|
|
|
end
|