Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion private/mix_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _mix_library_impl(ctx):
# should instead return a Provider that can provide erlang...library info?
# TBD
# This also needs a better name
ebin = ctx.actions.declare_directory("ebin")
ebin = ctx.actions.declare_directory(ctx.label.name + "_ebin")

# Create individual priv file symlinks rather than a directory artifact.
# A directory artifact named "priv" causes path doubling (priv/priv/...)
Expand Down Expand Up @@ -210,9 +210,15 @@ cp _output/{mix_env}/lib/{app_name}/ebin/*.beam _output/{mix_env}/lib/{app_name}
mnemonic = "MIXCOMPILE",
)

dep_runfiles = [dep[DefaultInfo].default_runfiles for dep in ctx.attr.deps if DefaultInfo in dep]
lib_runfiles = ctx.runfiles(files = [ebin] + priv_files + ctx.files.data)
for dr in dep_runfiles:
lib_runfiles = lib_runfiles.merge(dr)

return [
DefaultInfo(
files = depset([ebin] + priv_files),
runfiles = lib_runfiles,
),
MixProjectInfo(
# app_name = ctx.attr.app_name,
Expand Down
3 changes: 2 additions & 1 deletion private/mix_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ DEPS_DIR="$(realpath {erl_libs_dir})"
# With --no-compile, Mix is read-only — symlinks avoid copying entirely.
# Mix manages app code paths from _build; no -pa flags needed for deps.
mkdir -p _build/test/lib/{app_name}
ln -s "$(realpath ebin)" _build/test/lib/{app_name}/ebin
ln -s "$(realpath {beam_dir})" _build/test/lib/{app_name}/ebin
{priv_symlink}

for app_dir in "$DEPS_DIR"/*; do
Expand Down Expand Up @@ -116,6 +116,7 @@ MIX_ENV=test \\
elixir_home = elixir_home,
package = package,
app_name = app_name,
beam_dir = lib_beam_dirs[0].basename,
erl_libs_dir = erl_libs_dir,
priv_symlink = priv_symlink,
env = env,
Expand Down
Loading