Skip to content

Commit 719ffce

Browse files
committed
Clarify use of environment variables
1 parent 050f9e2 commit 719ffce

File tree

2 files changed

+17
-20
lines changed

2 files changed

+17
-20
lines changed

lib/mix/lib/mix.ex

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -331,20 +331,20 @@ defmodule Mix do
331331
* `MIX_ARCHIVES` - specifies the directory into which the archives should be installed
332332
(default: `~/.mix/archives`)
333333
334-
* `MIX_BUILD_PATH` - sets the project `Mix.Project.build_path/0` config.
335-
This option must always point to a subdirectory inside a temporary directory.
336-
For instance, never "/tmp" or "_build" but "_build/PROD" or "/tmp/PROD", as
337-
required by Mix. This environment variable is used mostly by external build
338-
tools. For your CI servers, you likely want to use `MIX_BUILD_ROOT` below.
334+
* `MIX_BUILD_PATH` - sets the project `Mix.Project.build_path/0`, including the
335+
current environment, such as "/path/to/project/_build/dev". This environment
336+
variable is used mostly by external build tools who need enforce a build
337+
directory independent of `MIX_ENV` and `MIX_TARGET`. For your CI servers,
338+
you likely want to use `MIX_BUILD_ROOT` below.
339339
340340
* `MIX_BUILD_ROOT` - sets the root directory where build artifacts should be
341-
written to. For example, "_build". If `MIX_BUILD_PATH` is set, this option
342-
is ignored.
341+
written to. For example, "/path/to/_build". If `MIX_BUILD_PATH` is set,
342+
this option is ignored.
343343
344344
* `MIX_DEBUG` - outputs debug information about each task before running it
345345
346346
* `MIX_DEPS_PATH` - sets the project `Mix.Project.deps_path/0` config for the
347-
current project (default: `deps`)
347+
current project, as an absolute path, such as `/path/to/project/deps`
348348
349349
* `MIX_ENV` - specifies which environment should be used. See [Environments](#module-environments)
350350

lib/mix/lib/mix/project.ex

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -656,26 +656,23 @@ defmodule Mix.Project do
656656
(which defaults to `"_build"`) and a subdirectory. The subdirectory
657657
is built based on two factors:
658658
659-
* If `:build_per_environment` is set, the subdirectory is the value
660-
of `Mix.env/0` (which can be set via `MIX_ENV`). Otherwise it is
661-
set to "shared".
659+
* If `:build_per_environment` is set (the default), the subdirectory
660+
is the value of `Mix.env/0` (which can be set via `MIX_ENV`).
661+
Otherwise it is set to "shared".
662662
663663
* If `Mix.target/0` is set (often via the `MIX_TARGET` environment
664664
variable), it will be used as a prefix to the subdirectory.
665665
666-
Finally, the environment variables `MIX_BUILD_ROOT` and `MIX_BUILD_PATH`
667-
can be used to change the result of this function. `MIX_BUILD_ROOT`
668-
overwrites only the root `"_build"` directory while keeping the
669-
subdirectory as is. It may be useful to change it for caching reasons,
670-
typically during Continuous Integration (CI). `MIX_BUILD_PATH` overrides
671-
the build path altogether and it typically used by other build tools
672-
that invoke the `mix` CLI.
666+
The behaviour of this function can be modified by two environment
667+
variables, `MIX_BUILD_ROOT` and `MIX_BUILD_PATH`, see [the Mix
668+
documentation for more information](Mix.html#environment-variables).
673669
674670
> #### Naming differences {: .info}
675671
>
676672
> Ideally the configuration option `:build_path` would be called
677-
> `:build_root`, as it would fully mirror the environment variable.
678-
> However, its name is preserved for backwards compatibility.
673+
> `:build_root`, as it only sets the root component of the build
674+
> path but not the subdirectory. However, its name is preserved
675+
> for backwards compatibility.
679676
680677
## Examples
681678

0 commit comments

Comments
 (0)