diff --git a/deps/rabbitmq_cli/mix.exs b/deps/rabbitmq_cli/mix.exs index 28710d2cd3..2186205c7e 100644 --- a/deps/rabbitmq_cli/mix.exs +++ b/deps/rabbitmq_cli/mix.exs @@ -175,6 +175,12 @@ defmodule RabbitMQCtl.MixfileBase do :dialyxir, path: Path.join(deps_dir, "dialyxir"), runtime: false }, + { + :rabbit, + path: Path.join(deps_dir, "rabbit"), + compile: if(is_bazel, do: fake_cmd, else: make_cmd), + override: true + }, { :temp, path: Path.join(deps_dir, "temp") diff --git a/deps/rabbitmq_cli/rabbitmqctl.bzl b/deps/rabbitmq_cli/rabbitmqctl.bzl index 2eebe4dee1..2fc4d97908 100644 --- a/deps/rabbitmq_cli/rabbitmqctl.bzl +++ b/deps/rabbitmq_cli/rabbitmqctl.bzl @@ -38,19 +38,35 @@ def deps_dir_contents(ctx, deps, dir): files = [] for dep in deps: lib_info = dep[ErlangAppInfo] - for src in lib_info.include + lib_info.beam + lib_info.srcs: + files_by_path = {} + for src in lib_info.include + lib_info.srcs: if not src.is_directory: rp = additional_file_dest_relative_path(dep.label, src) + files_by_path[rp] = src + else: + fail("unexpected directory in", lib_info) + for rp, src in files_by_path.items(): + f = ctx.actions.declare_file(path_join( + dir, + lib_info.app_name, + rp, + )) + ctx.actions.symlink( + output = f, + target_file = src, + ) + files.extend([f, src]) + for beam in lib_info.beam: + if not beam.is_directory: f = ctx.actions.declare_file(path_join( - dir, - lib_info.app_name, - rp, - )) + dir, lib_info.app_name, "ebin", beam.basename)) ctx.actions.symlink( output = f, - target_file = src, + target_file = beam, ) - files.extend([src, f]) + files.extend([f, beam]) + else: + fail("unexpected directory in", lib_info) return files def _impl(ctx): diff --git a/deps/rabbitmq_cli/rabbitmqctl_test.bzl b/deps/rabbitmq_cli/rabbitmqctl_test.bzl index 3ba076f2f9..a4f05a0dea 100644 --- a/deps/rabbitmq_cli/rabbitmqctl_test.bzl +++ b/deps/rabbitmq_cli/rabbitmqctl_test.bzl @@ -100,19 +100,9 @@ export ERL_COMPILER_OPTIONS=deterministic for archive in {archives}; do "${{ABS_ELIXIR_HOME}}"/bin/mix archive.install --force $INITIAL_DIR/$archive done -for d in {precompiled_deps}; do - mkdir -p _build/${{MIX_ENV}}/lib/$d - ln -s ${{DEPS_DIR}}/$d/ebin _build/${{MIX_ENV}}/lib/$d - ln -s ${{DEPS_DIR}}/$d/include _build/${{MIX_ENV}}/lib/$d -done "${{ABS_ELIXIR_HOME}}"/bin/mix deps.compile "${{ABS_ELIXIR_HOME}}"/bin/mix compile -# due to https://github.com/elixir-lang/elixir/issues/7699 we -# "run" the tests, but skip them all, in order to trigger -# compilation of all *_test.exs files before we actually run them -"${{ABS_ELIXIR_HOME}}"/bin/mix test --exclude test - export TEST_TMPDIR=${{TEST_UNDECLARED_OUTPUTS_DIR}} # we need a running broker with certain plugins for this to pass @@ -174,11 +164,6 @@ for %%a in ({archives}) do ( set ARCH=%ARCH:/=\\% "{elixir_home}\\bin\\mix" archive.install --force %ARCH% || goto :error ) -for %%d in ({precompiled_deps}) do ( - mkdir _build\\%MIX_ENV%\\lib\\%%d - robocopy %DEPS_DIR%\\%%d\\ebin _build\\%MIX_ENV%\\lib\\%%d /E /NFL /NDL /NJH /NJS /nc /ns /np - robocopy %DEPS_DIR%\\%%d\\include _build\\%MIX_ENV%\\lib\\%%d /E /NFL /NDL /NJH /NJS /nc /ns /np -) "{elixir_home}\\bin\\mix" deps.compile || goto :error "{elixir_home}\\bin\\mix" compile || goto :error diff --git a/deps/rabbitmq_cli/test/test_helper.exs b/deps/rabbitmq_cli/test/test_helper.exs index 93e84cc264..fe4ecf150c 100644 --- a/deps/rabbitmq_cli/test/test_helper.exs +++ b/deps/rabbitmq_cli/test/test_helper.exs @@ -4,16 +4,33 @@ ## ## Copyright (c) 2007-2023 VMware, Inc. or its affiliates. All rights reserved. -four_hours = 240 * 60 * 1000 +ten_minutes = 10 * 60 * 1000 ExUnit.configure( exclude: [disabled: true], - module_load_timeout: four_hours, - timeout: four_hours + module_load_timeout: ten_minutes, + timeout: ten_minutes ) ExUnit.start() +# Elixir 1.15 compiler optimizations seem to require that we explicitly add to the code path +true = Code.append_path(Path.join([System.get_env("DEPS_DIR"), "rabbit_common", "ebin"])) +true = Code.append_path(Path.join([System.get_env("DEPS_DIR"), "rabbit", "ebin"])) + +true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "amqp", "ebin"])) +true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "json", "ebin"])) +true = Code.append_path(Path.join(["_build", Atom.to_string(Mix.env()), "lib", "x509", "ebin"])) + +if function_exported?(Mix, :ensure_application!, 1) do + Mix.ensure_application!(:mnesia) + Mix.ensure_application!(:os_mon) + Mix.ensure_application!(:public_key) + Mix.ensure_application!(:runtime_tools) + Mix.ensure_application!(:sasl) + Mix.ensure_application!(:xmerl) +end + defmodule TestHelper do import ExUnit.Assertions alias RabbitMQ.CLI.Plugins.Helpers, as: PluginHelpers