Skip to content

Commit 9385af2

Browse files
committed
Add more details on priv artifacts
1 parent 5259a94 commit 9385af2

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/mix/tasks/compile.elixir_make.ex

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,21 @@ defmodule Mix.Tasks.Compile.ElixirMake do
109109
Generally speaking, compilation artifacts are written to the `priv`
110110
directory, as that the only directory, besides `ebin`, which are
111111
available to Erlang/OTP applications. Therefore, we recommend the
112-
Makefile top copy any artifact to `$MIX_APP_PATH/priv` or, even
113-
better, to `$MIX_APP_PATH/priv/$MIX_TARGET`.
112+
Makefile top copy any artifact to `$MIX_APP_PATH/priv` and to have
113+
no top-level `priv` directory.
114+
115+
In case you create a top-level `priv` directory, it gets symlinked
116+
to all build directories, in which case you should rather copy the
117+
artifacts to `$MIX_APP_PATH/priv/$MIX_TARGET`. This is relevant for
118+
projects like Nerves that build for several targets and may involve
119+
cross-compilation, so the user ends up with one _build subdirectory
120+
per target and we don't want artifacts in the symlinked `priv` to
121+
override each other. The downside of shared `priv` is that creating
122+
a release would copy all its contents, even with the artifacts not
123+
related to the given target. So, if your compilation is expensive
124+
it may be better to never create top-level `priv` and manage your
125+
own `cache` directory with per-target artifacts and copy them to
126+
`$MIX_APP_PATH/priv`.
114127
"""
115128

116129
use Mix.Task

0 commit comments

Comments
 (0)