File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,9 @@ defmodule Mix do
234234 Mix responds to the following variables:
235235
236236 * `MIX_ARCHIVES` - specifies the directory into which the archives should be installed
237- * `MIX_BUILD_PATH` - sets the project `Mix.Project.build_path/0` config
237+ * `MIX_BUILD_PATH` - sets the project `Mix.Project.build_path/0` config. This option
238+ must always point to a subdirectory inside a temporary directory. For instance,
239+ never "/tmp" or "_build" but "_build/PROD" or "/tmp/PROD", as required by Mix
238240 * `MIX_DEPS_PATH` - sets the project `Mix.Project.deps_path/0` config
239241 * `MIX_DEBUG` - outputs debug information about each task before running it
240242 * `MIX_ENV` - specifies which environment should be used. See [Environments](#module-environments)
Original file line number Diff line number Diff line change @@ -499,11 +499,11 @@ defmodule Mix.Project do
499499 """
500500 @ spec build_path ( keyword ) :: Path . t ( )
501501 def build_path ( config \\ config ( ) ) do
502- config [ :env_path ] || env_path ( config )
502+ System . get_env ( "MIX_BUILD_PATH" ) || config [ :env_path ] || env_path ( config )
503503 end
504504
505505 defp env_path ( config ) do
506- dir = System . get_env ( "MIX_BUILD_PATH" ) || config [ :build_path ] || "_build"
506+ dir = config [ :build_path ] || "_build"
507507 subdir = build_target ( ) <> build_per_environment ( config )
508508 Path . expand ( dir <> "/" <> subdir )
509509 end
Original file line number Diff line number Diff line change @@ -30,9 +30,19 @@ defmodule Mix.ProjectTest do
3030 Path . join ( File . cwd! ( ) , "_build/shared" )
3131 end
3232
33+ test "considers the target" do
34+ Mix . target ( :rpi3 )
35+
36+ assert Mix.Project . build_path ( build_per_environment: true ) ==
37+ Path . join ( File . cwd! ( ) , "_build/rpi3_dev" )
38+
39+ assert Mix.Project . build_path ( build_per_environment: false ) ==
40+ Path . join ( File . cwd! ( ) , "_build/rpi3_shared" )
41+ end
42+
3343 test "considers MIX_BUILD_PATH" do
3444 System . put_env ( "MIX_BUILD_PATH" , "_build" )
35- assert Mix.Project . build_path ( ) == Path . join ( File . cwd! ( ) , "_build/dev" )
45+ assert Mix.Project . build_path ( ) == "_build"
3646 after
3747 System . delete_env ( "MIX_BUILD_PATH" )
3848 end
@@ -43,16 +53,6 @@ defmodule Mix.ProjectTest do
4353 after
4454 System . delete_env ( "MIX_DEPS_PATH" )
4555 end
46-
47- test "considers the target" do
48- Mix . target ( :rpi3 )
49-
50- assert Mix.Project . build_path ( build_per_environment: true ) ==
51- Path . join ( File . cwd! ( ) , "_build/rpi3_dev" )
52-
53- assert Mix.Project . build_path ( build_per_environment: false ) ==
54- Path . join ( File . cwd! ( ) , "_build/rpi3_shared" )
55- end
5656 end
5757
5858 test "push and pop projects" do
You can’t perform that action at this time.
0 commit comments