Skip to content

Commit 9937923

Browse files
Merge pull request #7891 from rabbitmq/mergify/bp/v3.11.x/pr-7888
2 parents 6479a06 + d77e6d9 commit 9937923

File tree

9 files changed

+61
-39
lines changed

9 files changed

+61
-39
lines changed

MODULE.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,3 +475,13 @@ use_repo(
475475
secondary_umbrella,
476476
"rabbitmq-server-generic-unix-3.10",
477477
)
478+
479+
hex = use_extension(
480+
"//bazel/bzlmod:extensions.bzl",
481+
"hex",
482+
)
483+
484+
use_repo(
485+
hex,
486+
"hex",
487+
)

WORKSPACE

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,3 @@ git_repository(
206206
branch = "linux-rbe",
207207
remote = "https://github.com/rabbitmq/rbe-erlang-platform.git",
208208
)
209-
210-
http_archive(
211-
name = "hex",
212-
strip_prefix = "hex-2.0.5",
213-
urls = ["https://github.com/hexpm/hex/archive/refs/tags/v2.0.5.zip"],
214-
build_file = "@rabbitmq-server//bazel:BUILD.hex",
215-
)

bazel/BUILD.hex

Lines changed: 0 additions & 15 deletions
This file was deleted.

bazel/bzlmod/extensions.bzl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
12
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
23
load(
34
":secondary_umbrella.bzl",
@@ -137,3 +138,32 @@ def _secondary_umbrella(ctx):
137138
secondary_umbrella = module_extension(
138139
implementation = _secondary_umbrella,
139140
)
141+
142+
def _hex(ctx):
143+
http_archive(
144+
name = "hex",
145+
sha256 = "0e3e3290d0fcbdc6bb0526b73ca174d68dcff4d53ee86015c49ad0493e39ee65",
146+
strip_prefix = "hex-2.0.5",
147+
urls = ["https://github.com/hexpm/hex/archive/refs/tags/v2.0.5.zip"],
148+
build_file_content = """\
149+
load(
150+
"@rabbitmq-server//bazel/elixir:mix_archive_build.bzl",
151+
"mix_archive_build",
152+
)
153+
154+
mix_archive_build(
155+
name = "archive",
156+
srcs = [
157+
"mix.exs",
158+
] + glob([
159+
"lib/**/*",
160+
]),
161+
out = "hex.ez",
162+
visibility = ["//visibility:public"],
163+
)
164+
""",
165+
)
166+
167+
hex = module_extension(
168+
implementation = _hex,
169+
)

bazel/elixir/mix_archive_build.bzl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ def _impl(ctx):
2929
for src in ctx.files.srcs:
3030
dest = additional_file_dest_relative_path(ctx.label, src)
3131
copy_srcs_commands.extend([
32-
"mkdir -p $(dirname ${{MIX_INVOCATION_DIR}}/{dest})".format(
32+
'mkdir -p "$(dirname ${{MIX_INVOCATION_DIR}}/{dest})"'.format(
3333
dest = dest,
3434
),
35-
"cp {flags}{src} ${{MIX_INVOCATION_DIR}}/{dest}".format(
35+
'cp {flags}"{src}" "${{MIX_INVOCATION_DIR}}/{dest}"'.format(
3636
flags = "-r " if src.is_directory else "",
3737
src = src.path,
3838
dest = dest,
@@ -49,7 +49,7 @@ else
4949
ABS_ELIXIR_HOME=$PWD/{elixir_home}
5050
fi
5151
52-
ABS_OUT_PATH=$PWD/{out}
52+
ABS_OUT_PATH="$PWD/{out}"
5353
5454
export PATH="$ABS_ELIXIR_HOME"/bin:"{erlang_home}"/bin:${{PATH}}
5555
@@ -60,11 +60,11 @@ MIX_INVOCATION_DIR="{mix_invocation_dir}"
6060
6161
{copy_srcs_commands}
6262
63-
cd ${{MIX_INVOCATION_DIR}}
64-
export HOME=${{PWD}}
63+
cd "${{MIX_INVOCATION_DIR}}"
64+
export HOME="${{PWD}}"
6565
export MIX_ENV=prod
6666
export ERL_COMPILER_OPTIONS=deterministic
67-
"${{ABS_ELIXIR_HOME}}"/bin/mix archive.build -o ${{ABS_OUT_PATH}}
67+
"${{ABS_ELIXIR_HOME}}"/bin/mix archive.build -o "${{ABS_OUT_PATH}}"
6868
6969
# remove symlinks from the _build directory since it
7070
# is an unused output, and bazel does not allow them

deps/rabbitmq_cli/BUILD.bazel

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@bazel_skylib//rules:select_file.bzl", "select_file")
21
load("@rules_erlang//:dialyze.bzl", "dialyze", "plt")
32
load(":rabbitmqctl.bzl", "rabbitmqctl")
43
load(":rabbitmqctl_check_formatted.bzl", "rabbitmqctl_check_formatted_test")
@@ -33,13 +32,6 @@ rabbitmqctl(
3332
},
3433
)
3534

36-
select_file(
37-
name = "fetched_srcs",
38-
srcs = ":rabbitmqctl",
39-
subpath = "deps.tar",
40-
visibility = ["//visibility:public"],
41-
)
42-
4335
rabbitmq_home(
4436
name = "broker-for-cli-tests-home",
4537
testonly = True,

deps/rabbitmq_cli/rabbitmqctl.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@bazel_skylib//lib:shell.bzl", "shell")
12
load(
23
"@rules_erlang//:erlang_app_info.bzl",
34
"ErlangAppInfo",
@@ -148,7 +149,7 @@ find . -type l -delete
148149
escript_path = escript.path,
149150
ebin_dir = ebin.path,
150151
consolidated_dir = consolidated.path,
151-
archives = "".join([a.path for a in ctx.files.archives]),
152+
archives = "".join([shell.quote(a.path) for a in ctx.files.archives]),
152153
precompiled_deps = " ".join([
153154
dep[ErlangAppInfo].app_name
154155
for dep in ctx.attr.deps

deps/rabbitmq_cli/rabbitmqctl_test.bzl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@bazel_skylib//lib:shell.bzl", "shell")
12
load(
23
"@rules_erlang//:erlang_app_info.bzl",
34
"ErlangAppInfo",
@@ -138,7 +139,7 @@ set -x
138139
elixir_home = elixir_home,
139140
package_dir = package_dir,
140141
deps_dir = deps_dir,
141-
archives = "".join([a.short_path for a in ctx.files.archives]),
142+
archives = "".join([shell.quote(a.short_path) for a in ctx.files.archives]),
142143
precompiled_deps = precompiled_deps,
143144
rabbitmq_run_cmd = ctx.attr.rabbitmq_run[DefaultInfo].files_to_run.executable.short_path,
144145
)
@@ -195,7 +196,7 @@ exit /b 1
195196
elixir_home = windows_path(elixir_home),
196197
package_dir = windows_path(ctx.label.package),
197198
deps_dir = deps_dir,
198-
archives = "".join([a.short_path for a in ctx.files.archives]),
199+
archives = "".join([shell.quote(a.short_path) for a in ctx.files.archives]),
199200
precompiled_deps = precompiled_deps,
200201
rabbitmq_run_cmd = ctx.attr.rabbitmq_run[DefaultInfo].files_to_run.executable.short_path,
201202
)

dist.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,23 @@ def source_archive(
344344
prefix = "deps/csv",
345345
)
346346

347+
pkg_files(
348+
name = "parallel_stream-files",
349+
srcs = [
350+
"@parallel_stream//:sources",
351+
],
352+
strip_prefix = "",
353+
prefix = "deps/parallel_stream",
354+
)
355+
347356
pkg_tar(
348357
name = name,
349358
extension = "tar.xz",
350359
srcs = [
351360
":deps-files",
352361
":json-files",
353362
":csv-files",
363+
":parallel_stream-files",
354364
Label("@rabbitmq-server//:root-licenses"),
355365
],
356366
visibility = ["//visibility:public"],

0 commit comments

Comments
 (0)