Skip to content

Commit

Permalink
Merge pull request #10338 from rabbitmq/bazel-7-fixes
Browse files Browse the repository at this point in the history
Bazel 7 fixes
  • Loading branch information
pjk25 committed Mar 20, 2024
2 parents a04b092 + 5e1983a commit 90ae3e9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .bazelversion
@@ -1 +1 @@
6.4.0
latest
2 changes: 1 addition & 1 deletion bazel/elixir/elixir_as_app.bzl
Expand Up @@ -21,7 +21,7 @@ def _impl(ctx):
outputs = [ebin],
command = """set -euo pipefail
cp -r "{elixir_home}"/lib/{app}/ebin/* {ebin}
cp -RL "{elixir_home}"/lib/{app}/ebin/* {ebin}
""".format(
elixir_home = elixir_home,
app = ctx.attr.app,
Expand Down
37 changes: 17 additions & 20 deletions deps/rabbitmq_cli/rabbitmqctl.bzl
Expand Up @@ -34,6 +34,19 @@ ElixirAppInfo = provider(
},
)

def _copy(ctx, src, dst):
ctx.actions.run_shell(
inputs = [src],
outputs = [dst],
command = """set -euo pipefail
cp -RL "{src}" "{dst}"
""".format(
src = src.path,
dst = dst.path,
),
)

def deps_dir_contents(ctx, deps, dir):
files = []
for dep in deps:
Expand All @@ -51,15 +64,7 @@ def deps_dir_contents(ctx, deps, dir):
lib_info.app_name,
rp,
))
args = ctx.actions.args()
args.add(src)
args.add(f)
ctx.actions.run(
inputs = [src],
outputs = [f],
executable = "cp",
arguments = [args],
)
_copy(ctx, src, f)
files.append(f)
for beam in lib_info.beam:
if not beam.is_directory:
Expand All @@ -69,15 +74,7 @@ def deps_dir_contents(ctx, deps, dir):
"ebin",
beam.basename,
))
args = ctx.actions.args()
args.add(beam)
args.add(f)
ctx.actions.run(
inputs = [beam],
outputs = [f],
executable = "cp",
arguments = [args],
)
_copy(ctx, beam, f)
files.append(f)
else:
fail("unexpected directory in", lib_info)
Expand Down Expand Up @@ -158,8 +155,8 @@ done
cp escript/rabbitmqctl ${{ABS_ESCRIPT_PATH}}
cp _build/${{MIX_ENV}}/lib/rabbitmqctl/ebin/* ${{ABS_EBIN_DIR}}
cp _build/${{MIX_ENV}}/lib/rabbitmqctl/consolidated/* ${{ABS_CONSOLIDATED_DIR}}
cp -RL _build/${{MIX_ENV}}/lib/rabbitmqctl/ebin/* ${{ABS_EBIN_DIR}}
cp -RL _build/${{MIX_ENV}}/lib/rabbitmqctl/consolidated/* ${{ABS_CONSOLIDATED_DIR}}
# remove symlinks from the _build directory since it
# is not used, and bazel does not allow them
Expand Down

0 comments on commit 90ae3e9

Please sign in to comment.