Export $REBAR_DEPS_DIR and $ERL_LIBS variables

Export two extra environment variables when executing shell commands.
These variables are useful for rebar hooks that rely on Erlang
applications installed as rebar dependencies.

$REBAR_DEPS_DIR contains a fully-qualified name of the directory where
rebar stores dependencies.

$ERL_LIBS is set to $REBAR_DEPS_DIR or to "$REBAR_DEPS_DIR:$ERL_LIBS",
if $ERL_LIBS was defined before.
This commit is contained in:
Anton Lavrik 2011-05-08 23:46:44 -05:00 committed by Tuncer Ayaz
parent ed94237dde
commit 7b90cc4707

View file

@ -31,6 +31,7 @@
-export([preprocess/2, -export([preprocess/2,
postprocess/2, postprocess/2,
compile/2, compile/2,
setup_env/1,
'check-deps'/2, 'check-deps'/2,
'get-deps'/2, 'get-deps'/2,
'update-deps'/2, 'update-deps'/2,
@ -92,6 +93,18 @@ postprocess(_Config, _) ->
compile(Config, AppFile) -> compile(Config, AppFile) ->
'check-deps'(Config, AppFile). 'check-deps'(Config, AppFile).
%% set REBAR_DEPS_DIR and ERL_LIBS environment variables
setup_env(_Config) ->
{true, DepsDir} = get_deps_dir(),
%% include rebar's DepsDir in ERL_LIBS
ERL_LIBS = case os:getenv("ERL_LIBS") of
false ->
{"ERL_LIBS", DepsDir};
PrevValue ->
{"ERL_LIBS", DepsDir ++ ":" ++ PrevValue}
end,
[{"REBAR_DEPS_DIR", DepsDir}, ERL_LIBS].
'check-deps'(Config, _) -> 'check-deps'(Config, _) ->
%% Get the list of immediate (i.e. non-transitive) deps that are missing %% Get the list of immediate (i.e. non-transitive) deps that are missing
Deps = rebar_config:get_local(Config, deps, []), Deps = rebar_config:get_local(Config, deps, []),