Synchronize mixed versions approach with v3.8.x
This commit is contained in:
parent
d01b01663b
commit
8cc9806f07
|
@ -4,12 +4,18 @@ load("@//:rabbitmqctl.bzl", "rabbitmqctl")
|
||||||
|
|
||||||
rabbitmq_package_generic_unix(
|
rabbitmq_package_generic_unix(
|
||||||
name = "broker-home",
|
name = "broker-home",
|
||||||
sbin = glob(["sbin/*"]),
|
additional_files =
|
||||||
escript = glob(["escript/*"]),
|
glob(
|
||||||
plugins = [
|
[
|
||||||
"//plugins:standard_plugins",
|
"sbin/*",
|
||||||
"//plugins:inet_tcp_proxy_ez",
|
"escript/*",
|
||||||
],
|
],
|
||||||
|
exclude = ["sbin/rabbitmqctl"],
|
||||||
|
) + [
|
||||||
|
"//plugins:standard_plugins",
|
||||||
|
"//plugins:inet_tcp_proxy_ez",
|
||||||
|
],
|
||||||
|
rabbitmqctl = "sbin/rabbitmqctl",
|
||||||
)
|
)
|
||||||
|
|
||||||
rabbitmq_run(
|
rabbitmq_run(
|
||||||
|
@ -27,7 +33,6 @@ rabbitmq_run_command(
|
||||||
rabbitmqctl(
|
rabbitmqctl(
|
||||||
name = "rabbitmqctl",
|
name = "rabbitmqctl",
|
||||||
home = ":broker-home",
|
home = ":broker-home",
|
||||||
# visibility = ["//visibility:public"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
rabbitmqctl(
|
rabbitmqctl(
|
||||||
|
|
|
@ -3,9 +3,7 @@ load("@bazel-erlang//:bazel_erlang_lib.bzl", "ErlangLibInfo", "flat_deps", "path
|
||||||
RabbitmqHomeInfo = provider(
|
RabbitmqHomeInfo = provider(
|
||||||
doc = "An assembled RABBITMQ_HOME dir",
|
doc = "An assembled RABBITMQ_HOME dir",
|
||||||
fields = {
|
fields = {
|
||||||
"sbin": "Files making up the sbin dir",
|
"rabbitmqctl": "rabbitmqctl script from the sbin directory",
|
||||||
"escript": "Files making up the escript dir",
|
|
||||||
"plugins": "Files making up the plugins dir",
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -112,11 +110,16 @@ def _impl(ctx):
|
||||||
|
|
||||||
plugins = _flatten([_plugins_dir_links(ctx, plugin) for plugin in plugins])
|
plugins = _flatten([_plugins_dir_links(ctx, plugin) for plugin in plugins])
|
||||||
|
|
||||||
|
rabbitmqctl = None
|
||||||
|
for script in scripts:
|
||||||
|
if script.basename == "rabbitmqctl":
|
||||||
|
rabbitmqctl = script
|
||||||
|
if rabbitmqctl == None:
|
||||||
|
fail("could not find rabbitmqct among", scripts)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
RabbitmqHomeInfo(
|
RabbitmqHomeInfo(
|
||||||
sbin = scripts,
|
rabbitmqctl = rabbitmqctl,
|
||||||
escript = escripts,
|
|
||||||
plugins = plugins,
|
|
||||||
),
|
),
|
||||||
DefaultInfo(
|
DefaultInfo(
|
||||||
files = depset(scripts + escripts + plugins),
|
files = depset(scripts + escripts + plugins),
|
||||||
|
@ -147,7 +150,7 @@ def _dirname(p):
|
||||||
return p.rpartition("/")[0]
|
return p.rpartition("/")[0]
|
||||||
|
|
||||||
def rabbitmq_home_short_path(rabbitmq_home):
|
def rabbitmq_home_short_path(rabbitmq_home):
|
||||||
short_path = rabbitmq_home[RabbitmqHomeInfo].sbin[0].short_path
|
short_path = rabbitmq_home[RabbitmqHomeInfo].rabbitmqctl.short_path
|
||||||
if rabbitmq_home.label.workspace_root != "":
|
if rabbitmq_home.label.workspace_root != "":
|
||||||
short_path = path_join(rabbitmq_home.label.workspace_root, short_path)
|
short_path = path_join(rabbitmq_home.label.workspace_root, short_path)
|
||||||
return _dirname(_dirname(short_path))
|
return _dirname(_dirname(short_path))
|
||||||
|
|
|
@ -1,26 +1,19 @@
|
||||||
load("@//:rabbitmq_home.bzl", "RabbitmqHomeInfo")
|
load("@//:rabbitmq_home.bzl", "RabbitmqHomeInfo")
|
||||||
|
|
||||||
def _impl(ctx):
|
def _impl(ctx):
|
||||||
scripts = ctx.files.sbin
|
|
||||||
escripts = ctx.files.escript
|
|
||||||
plugins = ctx.files.plugins
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
RabbitmqHomeInfo(
|
RabbitmqHomeInfo(
|
||||||
sbin = scripts,
|
rabbitmqctl = ctx.file.rabbitmqctl,
|
||||||
escript = escripts,
|
|
||||||
plugins = plugins,
|
|
||||||
),
|
),
|
||||||
DefaultInfo(
|
DefaultInfo(
|
||||||
files = depset(scripts + escripts + plugins),
|
files = depset(ctx.files.rabbitmqctl + ctx.files.additional_files),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
rabbitmq_package_generic_unix = rule(
|
rabbitmq_package_generic_unix = rule(
|
||||||
implementation = _impl,
|
implementation = _impl,
|
||||||
attrs = {
|
attrs = {
|
||||||
"sbin": attr.label_list(allow_files = True),
|
"rabbitmqctl": attr.label(allow_single_file = True),
|
||||||
"escript": attr.label_list(allow_files = True),
|
"additional_files": attr.label_list(allow_files = True),
|
||||||
"plugins": attr.label_list(allow_files = True),
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,6 +6,7 @@ load(":rabbitmq_home.bzl", "RabbitmqHomeInfo", "rabbitmq_home_short_path")
|
||||||
def _impl(ctx):
|
def _impl(ctx):
|
||||||
rabbitmq_home_path = rabbitmq_home_short_path(ctx.attr.home)
|
rabbitmq_home_path = rabbitmq_home_short_path(ctx.attr.home)
|
||||||
|
|
||||||
|
# the rabbitmq-run.sh template only allows a single erl_libs currently
|
||||||
erl_libs = [path_join(rabbitmq_home_path, "plugins")]
|
erl_libs = [path_join(rabbitmq_home_path, "plugins")]
|
||||||
|
|
||||||
ctx.actions.expand_template(
|
ctx.actions.expand_template(
|
||||||
|
|
|
@ -1,6 +1,18 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
rmq_realpath() {
|
||||||
|
local path=$1
|
||||||
|
|
||||||
|
if [ -d "$path" ]; then
|
||||||
|
cd "$path" && pwd
|
||||||
|
elif [ -f "$path" ]; then
|
||||||
|
cd "$(dirname "$path")" && echo $(pwd)/$(basename "$path")
|
||||||
|
else
|
||||||
|
echo "$path"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [ -z ${TEST_SRCDIR+x} ]; then
|
if [ -z ${TEST_SRCDIR+x} ]; then
|
||||||
BASE_DIR=$PWD
|
BASE_DIR=$PWD
|
||||||
else
|
else
|
||||||
|
@ -41,7 +53,7 @@ if [ ! -z ${EXTRA_PLUGINS_DIR+x} ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TEST_TMPDIR=${TEST_TMPDIR:=${TMPDIR}/rabbitmq-test-instances}
|
TEST_TMPDIR=${TEST_TMPDIR:=${TMPDIR}/rabbitmq-test-instances}
|
||||||
RABBITMQ_SCRIPTS_DIR=${BASE_DIR}/{RABBITMQ_HOME}/sbin
|
RABBITMQ_SCRIPTS_DIR="$(rmq_realpath ${BASE_DIR}/{RABBITMQ_HOME}/sbin)"
|
||||||
RABBITMQ_PLUGINS=${RABBITMQ_SCRIPTS_DIR}/rabbitmq-plugins
|
RABBITMQ_PLUGINS=${RABBITMQ_SCRIPTS_DIR}/rabbitmq-plugins
|
||||||
RABBITMQ_SERVER=${RABBITMQ_SCRIPTS_DIR}/rabbitmq-server
|
RABBITMQ_SERVER=${RABBITMQ_SCRIPTS_DIR}/rabbitmq-server
|
||||||
RABBITMQCTL=${RABBITMQ_SCRIPTS_DIR}/rabbitmqctl
|
RABBITMQCTL=${RABBITMQ_SCRIPTS_DIR}/rabbitmqctl
|
||||||
|
|
Loading…
Reference in New Issue