Fetch github.com/hexpm/hex via bzlmod

This fixes a visibility issue when a bazel module depends on
rabbitmq-server

(cherry picked from commit 12153ed823)
This commit is contained in:
Rin Kuryloski 2023-04-12 17:40:38 +02:00 committed by Mergify
parent 1f1873e6e3
commit be5c7ddedf
6 changed files with 50 additions and 30 deletions

View File

@ -467,3 +467,13 @@ use_repo(
secondary_umbrella,
"rabbitmq-server-generic-unix-3.11",
)
hex = use_extension(
"//bazel/bzlmod:extensions.bzl",
"hex",
)
use_repo(
hex,
"hex",
)

View File

@ -206,10 +206,3 @@ git_repository(
branch = "linux-rbe",
remote = "https://github.com/rabbitmq/rbe-erlang-platform.git",
)
http_archive(
name = "hex",
strip_prefix = "hex-2.0.5",
urls = ["https://github.com/hexpm/hex/archive/refs/tags/v2.0.5.zip"],
build_file = "@rabbitmq-server//bazel:BUILD.hex",
)

View File

@ -1,15 +0,0 @@
load(
"@rabbitmq-server//bazel/elixir:mix_archive_build.bzl",
"mix_archive_build",
)
mix_archive_build(
name = "archive",
srcs = [
"mix.exs",
] + glob([
"lib/**/*",
]),
out = "hex.ez",
visibility = ["//visibility:public"],
)

View File

@ -1,3 +1,4 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load(
":secondary_umbrella.bzl",
@ -137,3 +138,32 @@ def _secondary_umbrella(ctx):
secondary_umbrella = module_extension(
implementation = _secondary_umbrella,
)
def _hex(ctx):
http_archive(
name = "hex",
sha256 = "0e3e3290d0fcbdc6bb0526b73ca174d68dcff4d53ee86015c49ad0493e39ee65",
strip_prefix = "hex-2.0.5",
urls = ["https://github.com/hexpm/hex/archive/refs/tags/v2.0.5.zip"],
build_file_content = """\
load(
"@rabbitmq-server//bazel/elixir:mix_archive_build.bzl",
"mix_archive_build",
)
mix_archive_build(
name = "archive",
srcs = [
"mix.exs",
] + glob([
"lib/**/*",
]),
out = "hex.ez",
visibility = ["//visibility:public"],
)
""",
)
hex = module_extension(
implementation = _hex,
)

View File

@ -1,4 +1,3 @@
load("@bazel_skylib//rules:select_file.bzl", "select_file")
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
load(":rabbitmqctl.bzl", "rabbitmqctl")
load(":rabbitmqctl_check_formatted.bzl", "rabbitmqctl_check_formatted_test")
@ -33,13 +32,6 @@ rabbitmqctl(
},
)
select_file(
name = "fetched_srcs",
srcs = ":rabbitmqctl",
subpath = "deps.tar",
visibility = ["//visibility:public"],
)
rabbitmq_home(
name = "broker-for-cli-tests-home",
testonly = True,

View File

@ -344,6 +344,15 @@ def source_archive(
prefix = "deps/csv",
)
pkg_files(
name = "parallel_stream-files",
srcs = [
"@parallel_stream//:sources",
],
strip_prefix = "",
prefix = "deps/parallel_stream",
)
pkg_tar(
name = name,
extension = "tar.xz",
@ -351,6 +360,7 @@ def source_archive(
":deps-files",
":json-files",
":csv-files",
":parallel_stream-files",
Label("@rabbitmq-server//:root-licenses"),
],
visibility = ["//visibility:public"],