From ddc3e3fbda1de0456b8efec332ef7a3bcfaf3632 Mon Sep 17 00:00:00 2001 From: Bryan Paxton Date: Wed, 6 May 2020 00:19:46 -0500 Subject: [PATCH 1/3] Add support for new rebar3 output dir option rebar3 as of 3.13.2 now supports a --output directory option which allows mix going forward to use said option and put build artifacts in _build which should result and less rebuilding of artifacts and/or better caching of artifacts. Details here: https://github.com/erlang/rebar3/pull/2237 In order to make use of said feature we must put a variable in the system's environment that shall hold the desired output path. rebar3 will recognize said environment variable going forward starting at version 3.14 (yet to be released). - Updated Mix.Tasks.Deps.Compile to put REBAR_BARE_COMPILER_OUTPUT_DIR in system env with the dependency path as the value for use by rebar3. --- lib/mix/lib/mix/tasks/deps.compile.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/mix/lib/mix/tasks/deps.compile.ex b/lib/mix/lib/mix/tasks/deps.compile.ex index eb8cf525a62..086fe2aa40a 100644 --- a/lib/mix/lib/mix/tasks/deps.compile.ex +++ b/lib/mix/lib/mix/tasks/deps.compile.ex @@ -189,7 +189,10 @@ defmodule Mix.Tasks.Deps.Compile do lib_path = Path.join(config[:env_path], "lib/*/ebin") env = [{"REBAR_CONFIG", config_path}, {"TERM", "dumb"}] - cmd = "#{rebar_cmd(dep)} bare compile --paths=#{inspect(lib_path)}" + + # n.b., This enviroment variable is only honored by rebar3 >= 3.14 + System.put_env("REBAR_BARE_COMPILER_OUTPUT_DIR", dep_path) + cmd = "#{rebar_cmd(dep)} bare compile --paths #{lib_path}" File.mkdir_p!(dep_path) File.write!(config_path, rebar_config(dep)) From 9b078fa41028b032618f3a74bc2f93a678cd61d5 Mon Sep 17 00:00:00 2001 From: Bryan Paxton Date: Tue, 12 May 2020 11:18:47 -0500 Subject: [PATCH 2/3] address feedback --- lib/mix/lib/mix/tasks/deps.compile.ex | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/mix/lib/mix/tasks/deps.compile.ex b/lib/mix/lib/mix/tasks/deps.compile.ex index 086fe2aa40a..c3116e39695 100644 --- a/lib/mix/lib/mix/tasks/deps.compile.ex +++ b/lib/mix/lib/mix/tasks/deps.compile.ex @@ -188,10 +188,13 @@ defmodule Mix.Tasks.Deps.Compile do config_path = Path.join(dep_path, "mix.rebar.config") lib_path = Path.join(config[:env_path], "lib/*/ebin") - env = [{"REBAR_CONFIG", config_path}, {"TERM", "dumb"}] + # n.b., REBAR_BARE_COMPILER_OUTPUT_DIR is only honored by rebar3 >= 3.14 + env = [ + {"REBAR_CONFIG", config_path}, + {"TERM", "dumb"}, + {"REBAR_BARE_COMPILER_OUTPUT_DIR", dep_path} + ] - # n.b., This enviroment variable is only honored by rebar3 >= 3.14 - System.put_env("REBAR_BARE_COMPILER_OUTPUT_DIR", dep_path) cmd = "#{rebar_cmd(dep)} bare compile --paths #{lib_path}" File.mkdir_p!(dep_path) From a3d748cfbb8597a4daecc5709b0306cb107fe871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 14 May 2020 01:03:59 +0200 Subject: [PATCH 3/3] Update lib/mix/lib/mix/tasks/deps.compile.ex --- lib/mix/lib/mix/tasks/deps.compile.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mix/lib/mix/tasks/deps.compile.ex b/lib/mix/lib/mix/tasks/deps.compile.ex index c3116e39695..94001b2e66a 100644 --- a/lib/mix/lib/mix/tasks/deps.compile.ex +++ b/lib/mix/lib/mix/tasks/deps.compile.ex @@ -188,7 +188,7 @@ defmodule Mix.Tasks.Deps.Compile do config_path = Path.join(dep_path, "mix.rebar.config") lib_path = Path.join(config[:env_path], "lib/*/ebin") - # n.b., REBAR_BARE_COMPILER_OUTPUT_DIR is only honored by rebar3 >= 3.14 + # REBAR_BARE_COMPILER_OUTPUT_DIR is only honored by rebar3 >= 3.14 env = [ {"REBAR_CONFIG", config_path}, {"TERM", "dumb"},