Fetch cli prod deps via bazel or erlang.mk instead of mix
In preparation for offline bazel builds
This commit is contained in:
parent
bb78f77aa4
commit
eba1d531c9
16
MODULE.bazel
16
MODULE.bazel
|
@ -168,6 +168,13 @@ erlang_package.hex_package(
|
|||
version = "3.2.0",
|
||||
)
|
||||
|
||||
erlang_package.hex_package(
|
||||
name = "csv",
|
||||
build_file = "@rabbitmq-server//bazel:BUILD.csv",
|
||||
sha256 = "54508938ac67e27966b10ef49606e3ad5995d665d7fc2688efb3eab1307c9079",
|
||||
version = "2.4.1",
|
||||
)
|
||||
|
||||
erlang_package.hex_package(
|
||||
name = "cuttlefish",
|
||||
build_file = "@rabbitmq-server//bazel:BUILD.cuttlefish",
|
||||
|
@ -217,6 +224,13 @@ erlang_package.git_package(
|
|||
repository = "michaelklishin/erlang-jose",
|
||||
)
|
||||
|
||||
erlang_package.hex_package(
|
||||
name = "json",
|
||||
build_file = "@rabbitmq-server//bazel:BUILD.json",
|
||||
sha256 = "9abf218dbe4ea4fcb875e087d5f904ef263d012ee5ed21d46e9dbca63f053d16",
|
||||
version = "1.4.1",
|
||||
)
|
||||
|
||||
erlang_package.hex_package(
|
||||
name = "thoas",
|
||||
build_file = "@rabbitmq-server//bazel:BUILD.thoas",
|
||||
|
@ -319,12 +333,14 @@ use_repo(
|
|||
"cowboy",
|
||||
"cowlib",
|
||||
"credentials_obfuscation",
|
||||
"csv",
|
||||
"cuttlefish",
|
||||
"eetcd",
|
||||
"gen_batch_server",
|
||||
"getopt",
|
||||
"gun",
|
||||
"jose",
|
||||
"json",
|
||||
"observer_cli",
|
||||
"osiris",
|
||||
"prometheus",
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
filegroup(
|
||||
name = "sources",
|
||||
srcs = [
|
||||
"mix.exs",
|
||||
] + glob([
|
||||
"LICENSE*",
|
||||
"lib/**/*",
|
||||
]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
Can't render this file because it contains an unexpected character in line 2 and column 12.
|
|
@ -0,0 +1,10 @@
|
|||
filegroup(
|
||||
name = "sources",
|
||||
srcs = [
|
||||
"mix.exs",
|
||||
] + glob([
|
||||
"LICENSE*",
|
||||
"lib/**/*",
|
||||
]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
|
@ -23,6 +23,10 @@ rabbitmqctl(
|
|||
"@observer_cli//:erlang_app",
|
||||
"@stdout_formatter//:erlang_app",
|
||||
],
|
||||
source_deps = {
|
||||
"@csv//:sources": "csv",
|
||||
"@json//:sources": "json",
|
||||
},
|
||||
)
|
||||
|
||||
select_file(
|
||||
|
@ -124,6 +128,10 @@ rabbitmqctl_test(
|
|||
"@observer_cli//:erlang_app",
|
||||
"@stdout_formatter//:erlang_app",
|
||||
],
|
||||
source_deps = {
|
||||
"@csv//:sources": "csv",
|
||||
"@json//:sources": "json",
|
||||
},
|
||||
)
|
||||
|
||||
test_suite(
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
PROJECT = rabbitmq_cli
|
||||
|
||||
BUILD_DEPS = rabbit_common
|
||||
DEPS = observer_cli stdout_formatter
|
||||
DEPS = csv json observer_cli stdout_formatter
|
||||
TEST_DEPS = amqp_client rabbit
|
||||
|
||||
dep_csv = hex 2.4.1
|
||||
dep_json = hex 1.4.1
|
||||
|
||||
DEP_EARLY_PLUGINS = rabbit_common/mk/rabbitmq-early-plugin.mk
|
||||
DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk
|
||||
|
||||
|
|
|
@ -138,8 +138,14 @@ defmodule RabbitMQCtl.MixfileBase do
|
|||
is_bazel = System.get_env("IS_BAZEL") != nil
|
||||
|
||||
[
|
||||
{:json, "1.4.1"},
|
||||
{:csv, "2.4.1"},
|
||||
{
|
||||
:json,
|
||||
path: Path.join(deps_dir, "json")
|
||||
},
|
||||
{
|
||||
:csv,
|
||||
path: Path.join(deps_dir, "csv")
|
||||
},
|
||||
{
|
||||
:stdout_formatter,
|
||||
path: Path.join(deps_dir, "stdout_formatter"),
|
||||
|
|
|
@ -68,6 +68,21 @@ def _impl(ctx):
|
|||
|
||||
deps_dir_files = deps_dir_contents(ctx, deps, deps_dir)
|
||||
|
||||
for dep, app_name in ctx.attr.source_deps.items():
|
||||
for src in dep.files.to_list():
|
||||
if not src.is_directory:
|
||||
rp = additional_file_dest_relative_path(dep.label, src)
|
||||
f = ctx.actions.declare_file(path_join(
|
||||
deps_dir,
|
||||
app_name,
|
||||
rp,
|
||||
))
|
||||
ctx.actions.symlink(
|
||||
output = f,
|
||||
target_file = src,
|
||||
)
|
||||
deps_dir_files.append(f)
|
||||
|
||||
package_dir = path_join(
|
||||
ctx.label.workspace_root,
|
||||
ctx.label.package,
|
||||
|
@ -203,6 +218,7 @@ rabbitmqctl_private = rule(
|
|||
"deps": attr.label_list(
|
||||
providers = [ErlangAppInfo],
|
||||
),
|
||||
"source_deps": attr.label_keyed_string_dict(),
|
||||
},
|
||||
toolchains = [
|
||||
"//bazel/elixir:toolchain_type",
|
||||
|
|
|
@ -7,6 +7,10 @@ load(
|
|||
"path_join",
|
||||
"windows_path",
|
||||
)
|
||||
load(
|
||||
"@rules_erlang//private:util.bzl",
|
||||
"additional_file_dest_relative_path",
|
||||
)
|
||||
load(
|
||||
"//bazel/elixir:elixir_toolchain.bzl",
|
||||
"elixir_dirs",
|
||||
|
@ -30,6 +34,21 @@ def _impl(ctx):
|
|||
deps_dir,
|
||||
)
|
||||
|
||||
for dep, app_name in ctx.attr.source_deps.items():
|
||||
for src in dep.files.to_list():
|
||||
if not src.is_directory:
|
||||
rp = additional_file_dest_relative_path(dep.label, src)
|
||||
f = ctx.actions.declare_file(path_join(
|
||||
deps_dir,
|
||||
app_name,
|
||||
rp,
|
||||
))
|
||||
ctx.actions.symlink(
|
||||
output = f,
|
||||
target_file = src,
|
||||
)
|
||||
deps_dir_files.append(f)
|
||||
|
||||
package_dir = path_join(
|
||||
ctx.label.workspace_root,
|
||||
ctx.label.package,
|
||||
|
@ -189,6 +208,7 @@ rabbitmqctl_private_test = rule(
|
|||
"srcs": attr.label_list(allow_files = [".ex", ".exs"]),
|
||||
"data": attr.label_list(allow_files = True),
|
||||
"deps": attr.label_list(providers = [ErlangAppInfo]),
|
||||
"source_deps": attr.label_keyed_string_dict(),
|
||||
"rabbitmq_run": attr.label(
|
||||
executable = True,
|
||||
cfg = "target",
|
||||
|
|
Loading…
Reference in New Issue