Skip to content

Commit

Permalink
Fetch github.com/hexpm/hex via bzlmod
Browse files Browse the repository at this point in the history
This fixes a visibility issue when a bazel module depends on
rabbitmq-server
  • Loading branch information
HoloRin committed Apr 13, 2023
1 parent f09b31e commit 12153ed
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 30 deletions.
10 changes: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
7 changes: 0 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
15 changes: 0 additions & 15 deletions bazel/BUILD.hex

This file was deleted.

30 changes: 30 additions & 0 deletions bazel/bzlmod/extensions.bzl
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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,
)
8 changes: 0 additions & 8 deletions deps/rabbitmq_cli/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 10 additions & 0 deletions dist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,23 @@ 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",
srcs = [
":deps-files",
":json-files",
":csv-files",
":parallel_stream-files",
Label("@rabbitmq-server//:root-licenses"),
],
visibility = ["//visibility:public"],
Expand Down

0 comments on commit 12153ed

Please sign in to comment.