mirror of
https://github.com/correl/rebar.git
synced 2024-11-23 19:19:54 +00:00
Do not use application:set_env
This commit is contained in:
parent
3c56fbab6f
commit
252757c753
18 changed files with 320 additions and 292 deletions
|
@ -50,9 +50,6 @@
|
||||||
%% Default log level
|
%% Default log level
|
||||||
{log_level, error},
|
{log_level, error},
|
||||||
|
|
||||||
%% Default parallel jobs
|
|
||||||
{jobs, 3},
|
|
||||||
|
|
||||||
%% any_dir processing modules
|
%% any_dir processing modules
|
||||||
{any_dir_modules, [
|
{any_dir_modules, [
|
||||||
rebar_require_vsn,
|
rebar_require_vsn,
|
||||||
|
|
193
src/rebar.erl
193
src/rebar.erl
|
@ -29,7 +29,8 @@
|
||||||
-export([main/1,
|
-export([main/1,
|
||||||
help/0,
|
help/0,
|
||||||
parse_args/1,
|
parse_args/1,
|
||||||
version/0]).
|
version/0,
|
||||||
|
get_jobs/1]).
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
|
||||||
|
@ -45,6 +46,8 @@
|
||||||
-define(OTP_INFO, "undefined").
|
-define(OTP_INFO, "undefined").
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
|
-define(DEFAULT_JOBS, 3).
|
||||||
|
|
||||||
%% ====================================================================
|
%% ====================================================================
|
||||||
%% Public API
|
%% Public API
|
||||||
%% ====================================================================
|
%% ====================================================================
|
||||||
|
@ -66,55 +69,39 @@ main(Args) ->
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%% ====================================================================
|
%% ====================================================================
|
||||||
|
|
||||||
|
run(["help"]) ->
|
||||||
|
help();
|
||||||
|
run(["version"]) ->
|
||||||
|
ok = load_rebar_app(),
|
||||||
|
%% Display vsn and build time info
|
||||||
|
version();
|
||||||
run(RawArgs) ->
|
run(RawArgs) ->
|
||||||
%% Pre-load the rebar app so that we get default configuration
|
ok = load_rebar_app(),
|
||||||
ok = application:load(rebar),
|
|
||||||
%% Parse out command line arguments -- what's left is a list of commands to
|
%% Parse out command line arguments -- what's left is a list of commands to
|
||||||
%% run -- and start running commands
|
%% run -- and start running commands
|
||||||
Args = parse_args(RawArgs),
|
Args = parse_args(RawArgs),
|
||||||
|
BaseConfig = init_config(Args),
|
||||||
|
{BaseConfig1, Cmds} = save_options(BaseConfig, Args),
|
||||||
|
|
||||||
case rebar_config:get_global(enable_profiling, false) of
|
case rebar_config:get_xconf(BaseConfig1, enable_profiling, false) of
|
||||||
true ->
|
true ->
|
||||||
io:format("Profiling!\n"),
|
io:format("Profiling!\n"),
|
||||||
try
|
try
|
||||||
fprof:apply(fun(A) -> run_aux(A) end, [Args])
|
fprof:apply(fun([C, A]) -> run_aux(C, A) end,
|
||||||
|
[BaseConfig1, Cmds])
|
||||||
after
|
after
|
||||||
fprof:profile(),
|
fprof:profile(),
|
||||||
fprof:analyse([{dest, "fprof.analysis"}])
|
fprof:analyse([{dest, "fprof.analysis"}])
|
||||||
end;
|
end;
|
||||||
_ ->
|
false ->
|
||||||
run_aux(Args)
|
run_aux(BaseConfig1, Cmds)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
run_aux(["help"]) ->
|
load_rebar_app() ->
|
||||||
help(),
|
%% Pre-load the rebar app so that we get default configuration
|
||||||
ok;
|
ok = application:load(rebar).
|
||||||
run_aux(["version"]) ->
|
|
||||||
%% Display vsn and build time info
|
|
||||||
version(),
|
|
||||||
ok;
|
|
||||||
run_aux(Commands) ->
|
|
||||||
%% Make sure crypto is running
|
|
||||||
case crypto:start() of
|
|
||||||
ok -> ok;
|
|
||||||
{error,{already_started,crypto}} -> ok
|
|
||||||
end,
|
|
||||||
|
|
||||||
%% Initialize logging system
|
|
||||||
rebar_log:init(),
|
|
||||||
|
|
||||||
%% Convert command strings to atoms
|
|
||||||
CommandAtoms = [list_to_atom(C) || C <- Commands],
|
|
||||||
|
|
||||||
%% Determine the location of the rebar executable; important for pulling
|
|
||||||
%% resources out of the escript
|
|
||||||
rebar_config:set_global(escript, filename:absname(escript:script_name())),
|
|
||||||
?DEBUG("Rebar location: ~p\n",
|
|
||||||
[rebar_config:get_global(escript, undefined)]),
|
|
||||||
|
|
||||||
%% Note the top-level directory for reference
|
|
||||||
rebar_config:set_global(base_dir, filename:absname(rebar_utils:get_cwd())),
|
|
||||||
|
|
||||||
|
init_config({Options, _NonOptArgs}) ->
|
||||||
%% If $HOME/.rebar/config exists load and use as global config
|
%% If $HOME/.rebar/config exists load and use as global config
|
||||||
GlobalConfigFile = filename:join([os:getenv("HOME"), ".rebar", "config"]),
|
GlobalConfigFile = filename:join([os:getenv("HOME"), ".rebar", "config"]),
|
||||||
GlobalConfig = case filelib:is_regular(GlobalConfigFile) of
|
GlobalConfig = case filelib:is_regular(GlobalConfigFile) of
|
||||||
|
@ -125,12 +112,45 @@ run_aux(Commands) ->
|
||||||
false ->
|
false ->
|
||||||
rebar_config:new()
|
rebar_config:new()
|
||||||
end,
|
end,
|
||||||
BaseConfig = rebar_config:base_config(GlobalConfig),
|
|
||||||
|
%% Set the rebar config to use
|
||||||
|
GlobalConfig1 = case proplists:get_value(config, Options) of
|
||||||
|
undefined ->
|
||||||
|
GlobalConfig;
|
||||||
|
Conf ->
|
||||||
|
rebar_config:set_global(GlobalConfig, config, Conf)
|
||||||
|
end,
|
||||||
|
|
||||||
|
GlobalConfig2 = set_log_level(GlobalConfig1, Options),
|
||||||
|
%% Initialize logging system
|
||||||
|
ok = rebar_log:init(GlobalConfig2),
|
||||||
|
|
||||||
|
BaseConfig = rebar_config:base_config(GlobalConfig2),
|
||||||
|
|
||||||
%% Keep track of how many operations we do, so we can detect bad commands
|
%% Keep track of how many operations we do, so we can detect bad commands
|
||||||
BaseConfig1 = rebar_config:set_xconf(BaseConfig, operations, 0),
|
BaseConfig1 = rebar_config:set_xconf(BaseConfig, operations, 0),
|
||||||
%% Initialize vsn cache
|
%% Initialize vsn cache
|
||||||
BaseConfig2 = rebar_config:set_xconf(BaseConfig1, vsn_cache, dict:new()),
|
rebar_config:set_xconf(BaseConfig1, vsn_cache, dict:new()).
|
||||||
|
|
||||||
|
run_aux(BaseConfig, Commands) ->
|
||||||
|
%% Make sure crypto is running
|
||||||
|
case crypto:start() of
|
||||||
|
ok -> ok;
|
||||||
|
{error,{already_started,crypto}} -> ok
|
||||||
|
end,
|
||||||
|
|
||||||
|
%% Convert command strings to atoms
|
||||||
|
CommandAtoms = [list_to_atom(C) || C <- Commands],
|
||||||
|
|
||||||
|
%% Determine the location of the rebar executable; important for pulling
|
||||||
|
%% resources out of the escript
|
||||||
|
ScriptName = filename:absname(escript:script_name()),
|
||||||
|
BaseConfig1 = rebar_config:set_xconf(BaseConfig, escript, ScriptName),
|
||||||
|
?DEBUG("Rebar location: ~p\n", [ScriptName]),
|
||||||
|
|
||||||
|
%% Note the top-level directory for reference
|
||||||
|
AbsCwd = filename:absname(rebar_utils:get_cwd()),
|
||||||
|
BaseConfig2 = rebar_config:set_xconf(BaseConfig1, base_dir, AbsCwd),
|
||||||
|
|
||||||
%% Process each command, resetting any state between each one
|
%% Process each command, resetting any state between each one
|
||||||
rebar_core:process_commands(CommandAtoms, BaseConfig2).
|
rebar_core:process_commands(CommandAtoms, BaseConfig2).
|
||||||
|
@ -149,63 +169,59 @@ help() ->
|
||||||
%% Parse command line arguments using getopt and also filtering out any
|
%% Parse command line arguments using getopt and also filtering out any
|
||||||
%% key=value pairs. What's left is the list of commands to run
|
%% key=value pairs. What's left is the list of commands to run
|
||||||
%%
|
%%
|
||||||
parse_args(Args) ->
|
parse_args(RawArgs) ->
|
||||||
%% Parse getopt options
|
%% Parse getopt options
|
||||||
OptSpecList = option_spec_list(),
|
OptSpecList = option_spec_list(),
|
||||||
case getopt:parse(OptSpecList, Args) of
|
case getopt:parse(OptSpecList, RawArgs) of
|
||||||
{ok, {Options, NonOptArgs}} ->
|
{ok, Args} ->
|
||||||
%% Check options and maybe halt execution
|
Args;
|
||||||
ok = show_info_maybe_halt(Options, NonOptArgs),
|
|
||||||
|
|
||||||
GlobalDefines = proplists:get_all_values(defines, Options),
|
|
||||||
rebar_config:set_global(defines, GlobalDefines),
|
|
||||||
|
|
||||||
%% Setup profiling flag
|
|
||||||
rebar_config:set_global(enable_profiling,
|
|
||||||
proplists:get_bool(profile, Options)),
|
|
||||||
|
|
||||||
%% Setup flag to keep running after a single command fails
|
|
||||||
rebar_config:set_global(keep_going,
|
|
||||||
proplists:get_bool(keep_going, Options)),
|
|
||||||
|
|
||||||
%% Set global variables based on getopt options
|
|
||||||
set_log_level(Options),
|
|
||||||
set_global_flag(Options, force),
|
|
||||||
DefJobs = rebar_config:get_jobs(),
|
|
||||||
case proplists:get_value(jobs, Options, DefJobs) of
|
|
||||||
DefJobs ->
|
|
||||||
ok;
|
|
||||||
Jobs ->
|
|
||||||
rebar_config:set_global(jobs, Jobs)
|
|
||||||
end,
|
|
||||||
|
|
||||||
%% Set the rebar config to use
|
|
||||||
case proplists:get_value(config, Options) of
|
|
||||||
undefined -> ok;
|
|
||||||
Conf -> rebar_config:set_global(config, Conf)
|
|
||||||
end,
|
|
||||||
|
|
||||||
%% Filter all the flags (i.e. strings of form key=value) from the
|
|
||||||
%% command line arguments. What's left will be the commands to run.
|
|
||||||
unabbreviate_command_names(filter_flags(NonOptArgs, []));
|
|
||||||
|
|
||||||
{error, {Reason, Data}} ->
|
{error, {Reason, Data}} ->
|
||||||
?ERROR("~s ~p~n~n", [Reason, Data]),
|
?ERROR("~s ~p~n~n", [Reason, Data]),
|
||||||
help(),
|
help(),
|
||||||
rebar_utils:delayed_halt(1)
|
rebar_utils:delayed_halt(1)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
save_options(Config, {Options, NonOptArgs}) ->
|
||||||
|
%% Check options and maybe halt execution
|
||||||
|
ok = show_info_maybe_halt(Options, NonOptArgs),
|
||||||
|
|
||||||
|
GlobalDefines = proplists:get_all_values(defines, Options),
|
||||||
|
|
||||||
|
Config1 = rebar_config:set_xconf(Config, defines, GlobalDefines),
|
||||||
|
|
||||||
|
%% Setup profiling flag
|
||||||
|
Config2 = rebar_config:set_xconf(Config1, enable_profiling,
|
||||||
|
proplists:get_bool(profile, Options)),
|
||||||
|
|
||||||
|
%% Setup flag to keep running after a single command fails
|
||||||
|
Config3 = rebar_config:set_xconf(Config2, keep_going,
|
||||||
|
proplists:get_bool(keep_going, Options)),
|
||||||
|
|
||||||
|
%% Set global variables based on getopt options
|
||||||
|
Config4 = set_global_flag(Config3, Options, force),
|
||||||
|
Config5 = case proplists:get_value(jobs, Options, ?DEFAULT_JOBS) of
|
||||||
|
?DEFAULT_JOBS ->
|
||||||
|
Config4;
|
||||||
|
Jobs ->
|
||||||
|
rebar_config:set_global(Config4, jobs, Jobs)
|
||||||
|
end,
|
||||||
|
|
||||||
|
%% Filter all the flags (i.e. strings of form key=value) from the
|
||||||
|
%% command line arguments. What's left will be the commands to run.
|
||||||
|
{Config6, RawCmds} = filter_flags(Config5, NonOptArgs, []),
|
||||||
|
{Config6, unabbreviate_command_names(RawCmds)}.
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% set log level based on getopt option
|
%% set log level based on getopt option
|
||||||
%%
|
%%
|
||||||
set_log_level(Options) ->
|
set_log_level(Config, Options) ->
|
||||||
LogLevel = case proplists:get_all_values(verbose, Options) of
|
LogLevel = case proplists:get_all_values(verbose, Options) of
|
||||||
[] ->
|
[] ->
|
||||||
rebar_log:default_level();
|
rebar_log:default_level();
|
||||||
Verbosities ->
|
Verbosities ->
|
||||||
lists:last(Verbosities)
|
lists:last(Verbosities)
|
||||||
end,
|
end,
|
||||||
rebar_config:set_global(verbose, LogLevel).
|
rebar_config:set_global(Config, verbose, LogLevel).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% show version information and halt
|
%% show version information and halt
|
||||||
|
@ -219,14 +235,14 @@ version() ->
|
||||||
%%
|
%%
|
||||||
%% set global flag based on getopt option boolean value
|
%% set global flag based on getopt option boolean value
|
||||||
%%
|
%%
|
||||||
set_global_flag(Options, Flag) ->
|
set_global_flag(Config, Options, Flag) ->
|
||||||
Value = case proplists:get_bool(Flag, Options) of
|
Value = case proplists:get_bool(Flag, Options) of
|
||||||
true ->
|
true ->
|
||||||
"1";
|
"1";
|
||||||
false ->
|
false ->
|
||||||
"0"
|
"0"
|
||||||
end,
|
end,
|
||||||
rebar_config:set_global(Flag, Value).
|
rebar_config:set_global(Config, Flag, Value).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% show info and maybe halt execution
|
%% show info and maybe halt execution
|
||||||
|
@ -291,11 +307,14 @@ version Show version information
|
||||||
">>,
|
">>,
|
||||||
io:put_chars(S).
|
io:put_chars(S).
|
||||||
|
|
||||||
|
get_jobs(Config) ->
|
||||||
|
rebar_config:get_global(Config, jobs, ?DEFAULT_JOBS).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% options accepted via getopt
|
%% options accepted via getopt
|
||||||
%%
|
%%
|
||||||
option_spec_list() ->
|
option_spec_list() ->
|
||||||
Jobs = rebar_config:get_jobs(),
|
Jobs = ?DEFAULT_JOBS,
|
||||||
JobsHelp = io_lib:format(
|
JobsHelp = io_lib:format(
|
||||||
"Number of concurrent workers a command may use. Default: ~B",
|
"Number of concurrent workers a command may use. Default: ~B",
|
||||||
[Jobs]),
|
[Jobs]),
|
||||||
|
@ -319,12 +338,12 @@ option_spec_list() ->
|
||||||
%% Seperate all commands (single-words) from flags (key=value) and store
|
%% Seperate all commands (single-words) from flags (key=value) and store
|
||||||
%% values into the rebar_config global storage.
|
%% values into the rebar_config global storage.
|
||||||
%%
|
%%
|
||||||
filter_flags([], Commands) ->
|
filter_flags(Config, [], Commands) ->
|
||||||
lists:reverse(Commands);
|
{Config, lists:reverse(Commands)};
|
||||||
filter_flags([Item | Rest], Commands) ->
|
filter_flags(Config, [Item | Rest], Commands) ->
|
||||||
case string:tokens(Item, "=") of
|
case string:tokens(Item, "=") of
|
||||||
[Command] ->
|
[Command] ->
|
||||||
filter_flags(Rest, [Command | Commands]);
|
filter_flags(Config, Rest, [Command | Commands]);
|
||||||
[KeyStr, RawValue] ->
|
[KeyStr, RawValue] ->
|
||||||
Key = list_to_atom(KeyStr),
|
Key = list_to_atom(KeyStr),
|
||||||
Value = case Key of
|
Value = case Key of
|
||||||
|
@ -333,11 +352,11 @@ filter_flags([Item | Rest], Commands) ->
|
||||||
_ ->
|
_ ->
|
||||||
RawValue
|
RawValue
|
||||||
end,
|
end,
|
||||||
rebar_config:set_global(Key, Value),
|
Config1 = rebar_config:set_global(Config, Key, Value),
|
||||||
filter_flags(Rest, Commands);
|
filter_flags(Config1, Rest, Commands);
|
||||||
Other ->
|
Other ->
|
||||||
?CONSOLE("Ignoring command line argument: ~p\n", [Other]),
|
?CONSOLE("Ignoring command line argument: ~p\n", [Other]),
|
||||||
filter_flags(Rest, Commands)
|
filter_flags(Config, Rest, Commands)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
command_names() ->
|
command_names() ->
|
||||||
|
|
|
@ -111,10 +111,10 @@ is_skipped_app(Config, AppFile) ->
|
||||||
%% Check for apps global parameter; this is a comma-delimited list
|
%% Check for apps global parameter; this is a comma-delimited list
|
||||||
%% of apps on which we want to run commands
|
%% of apps on which we want to run commands
|
||||||
Skipped =
|
Skipped =
|
||||||
case get_apps() of
|
case get_apps(Config) of
|
||||||
undefined ->
|
undefined ->
|
||||||
%% No apps parameter specified, check the skip_apps list..
|
%% No apps parameter specified, check the skip_apps list..
|
||||||
case get_skip_apps() of
|
case get_skip_apps(Config) of
|
||||||
undefined ->
|
undefined ->
|
||||||
%% No skip_apps list, run everything..
|
%% No skip_apps list, run everything..
|
||||||
false;
|
false;
|
||||||
|
@ -136,8 +136,8 @@ is_skipped_app(Config, AppFile) ->
|
||||||
|
|
||||||
load_app_file(Config, Filename) ->
|
load_app_file(Config, Filename) ->
|
||||||
AppFile = {app_file, Filename},
|
AppFile = {app_file, Filename},
|
||||||
case rebar_config:get_xconf(Config, {appfile, AppFile}) of
|
case rebar_config:get_xconf(Config, {appfile, AppFile}, undefined) of
|
||||||
error ->
|
undefined ->
|
||||||
case file:consult(Filename) of
|
case file:consult(Filename) of
|
||||||
{ok, [{application, AppName, AppData}]} ->
|
{ok, [{application, AppName, AppData}]} ->
|
||||||
Config1 = rebar_config:set_xconf(Config,
|
Config1 = rebar_config:set_xconf(Config,
|
||||||
|
@ -149,7 +149,7 @@ load_app_file(Config, Filename) ->
|
||||||
Other ->
|
Other ->
|
||||||
{error, {unexpected_terms, Other}}
|
{error, {unexpected_terms, Other}}
|
||||||
end;
|
end;
|
||||||
{ok, {AppName, AppData}} ->
|
{AppName, AppData} ->
|
||||||
{ok, Config, AppName, AppData}
|
{ok, Config, AppName, AppData}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -179,8 +179,8 @@ is_skipped(ThisApp, TargetApps) ->
|
||||||
{true, ThisApp}
|
{true, ThisApp}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_apps() ->
|
get_apps(Config) ->
|
||||||
rebar_utils:get_deprecated_global(app, apps, "soon").
|
rebar_utils:get_deprecated_global(Config, app, apps, "soon").
|
||||||
|
|
||||||
get_skip_apps() ->
|
get_skip_apps(Config) ->
|
||||||
rebar_utils:get_deprecated_global(skip_app, skip_apps, "soon").
|
rebar_utils:get_deprecated_global(Config, skip_app, skip_apps, "soon").
|
||||||
|
|
|
@ -41,10 +41,11 @@
|
||||||
'generate-appups'(Config, ReltoolFile) ->
|
'generate-appups'(Config, ReltoolFile) ->
|
||||||
%% Get the old release path
|
%% Get the old release path
|
||||||
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
|
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
|
||||||
TargetParentDir = rebar_rel_utils:get_target_parent_dir(ReltoolConfig),
|
TargetParentDir = rebar_rel_utils:get_target_parent_dir(Config,
|
||||||
|
ReltoolConfig),
|
||||||
|
|
||||||
OldVerPath = filename:join([TargetParentDir,
|
PrevRelPath = rebar_rel_utils:get_previous_release_path(Config),
|
||||||
rebar_rel_utils:get_previous_release_path()]),
|
OldVerPath = filename:join([TargetParentDir, PrevRelPath]),
|
||||||
|
|
||||||
%% Get the new and old release name and versions
|
%% Get the new and old release name and versions
|
||||||
{Name, _Ver} = rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
|
{Name, _Ver} = rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
|
||||||
|
|
|
@ -47,7 +47,7 @@ run(Config, FirstFiles, RestFiles, CompileFn) ->
|
||||||
_ ->
|
_ ->
|
||||||
Self = self(),
|
Self = self(),
|
||||||
F = fun() -> compile_worker(Self, Config, CompileFn) end,
|
F = fun() -> compile_worker(Self, Config, CompileFn) end,
|
||||||
Jobs = rebar_config:get_jobs(),
|
Jobs = rebar:get_jobs(Config),
|
||||||
?DEBUG("Starting ~B compile worker(s)~n", [Jobs]),
|
?DEBUG("Starting ~B compile worker(s)~n", [Jobs]),
|
||||||
Pids = [spawn_monitor(F) || _I <- lists:seq(1,Jobs)],
|
Pids = [spawn_monitor(F) || _I <- lists:seq(1,Jobs)],
|
||||||
compile_queue(Pids, RestFiles)
|
compile_queue(Pids, RestFiles)
|
||||||
|
|
|
@ -30,17 +30,18 @@
|
||||||
get/3, get_local/3, get_list/3,
|
get/3, get_local/3, get_list/3,
|
||||||
get_all/2,
|
get_all/2,
|
||||||
set/3,
|
set/3,
|
||||||
set_global/2, get_global/2,
|
set_global/3, get_global/3,
|
||||||
is_verbose/0, get_jobs/0,
|
is_verbose/1,
|
||||||
set_env/3, get_env/2, reset_env/1,
|
set_env/3, get_env/2, reset_env/1,
|
||||||
set_skip_dir/2, is_skip_dir/2, reset_skip_dirs/1,
|
set_skip_dir/2, is_skip_dir/2, reset_skip_dirs/1,
|
||||||
clean_config/2,
|
clean_config/2,
|
||||||
set_xconf/3, get_xconf/2, erase_xconf/2, reset_xconf/1]).
|
set_xconf/3, get_xconf/2, get_xconf/3, erase_xconf/2]).
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
|
||||||
-record(config, { dir :: file:filename(),
|
-record(config, { dir :: file:filename(),
|
||||||
opts = [] :: list(),
|
opts = [] :: list(),
|
||||||
|
globals = new_globals() :: dict(),
|
||||||
%% TODO: consider storing envs in xconf
|
%% TODO: consider storing envs in xconf
|
||||||
envs = new_env() :: dict(),
|
envs = new_env() :: dict(),
|
||||||
%% cross-directory config
|
%% cross-directory config
|
||||||
|
@ -60,7 +61,7 @@
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
base_config(GlobalConfig) ->
|
base_config(GlobalConfig) ->
|
||||||
ConfName = rebar_config:get_global(config, ?DEFAULT_NAME),
|
ConfName = rebar_config:get_global(GlobalConfig, config, ?DEFAULT_NAME),
|
||||||
new(GlobalConfig, ConfName).
|
new(GlobalConfig, ConfName).
|
||||||
|
|
||||||
new() ->
|
new() ->
|
||||||
|
@ -74,8 +75,10 @@ new(ConfigFile) when is_list(ConfigFile) ->
|
||||||
Other ->
|
Other ->
|
||||||
?ABORT("Failed to load ~s: ~p~n", [ConfigFile, Other])
|
?ABORT("Failed to load ~s: ~p~n", [ConfigFile, Other])
|
||||||
end;
|
end;
|
||||||
new(_ParentConfig=#config{opts=Opts0, skip_dirs=SkipDirs, xconf=Xconf})->
|
new(_ParentConfig=#config{opts=Opts0, globals=Globals, skip_dirs=SkipDirs,
|
||||||
new(#config{opts=Opts0, skip_dirs=SkipDirs, xconf=Xconf}, ?DEFAULT_NAME).
|
xconf=Xconf}) ->
|
||||||
|
new(#config{opts=Opts0, globals=Globals, skip_dirs=SkipDirs, xconf=Xconf},
|
||||||
|
?DEFAULT_NAME).
|
||||||
|
|
||||||
get(Config, Key, Default) ->
|
get(Config, Key, Default) ->
|
||||||
proplists:get_value(Key, Config#config.opts, Default).
|
proplists:get_value(Key, Config#config.opts, Default).
|
||||||
|
@ -93,27 +96,26 @@ set(Config, Key, Value) ->
|
||||||
Opts = proplists:delete(Key, Config#config.opts),
|
Opts = proplists:delete(Key, Config#config.opts),
|
||||||
Config#config { opts = [{Key, Value} | Opts] }.
|
Config#config { opts = [{Key, Value} | Opts] }.
|
||||||
|
|
||||||
set_global(jobs=Key, Value) when is_list(Value) ->
|
set_global(Config, jobs=Key, Value) when is_list(Value) ->
|
||||||
set_global(Key, list_to_integer(Value));
|
set_global(Config, Key, list_to_integer(Value));
|
||||||
set_global(jobs=Key, Value) when is_integer(Value) ->
|
set_global(Config, jobs=Key, Value) when is_integer(Value) ->
|
||||||
application:set_env(rebar_global, Key, erlang:max(1, Value));
|
NewGlobals = dict:store(Key, erlang:max(1, Value), Config#config.globals),
|
||||||
set_global(Key, Value) ->
|
Config#config{globals = NewGlobals};
|
||||||
application:set_env(rebar_global, Key, Value).
|
set_global(Config, Key, Value) ->
|
||||||
|
NewGlobals = dict:store(Key, Value, Config#config.globals),
|
||||||
|
Config#config{globals = NewGlobals}.
|
||||||
|
|
||||||
get_global(Key, Default) ->
|
get_global(Config, Key, Default) ->
|
||||||
case application:get_env(rebar_global, Key) of
|
case dict:find(Key, Config#config.globals) of
|
||||||
undefined ->
|
error ->
|
||||||
Default;
|
Default;
|
||||||
{ok, Value} ->
|
{ok, Value} ->
|
||||||
Value
|
Value
|
||||||
end.
|
end.
|
||||||
|
|
||||||
is_verbose() ->
|
is_verbose(Config) ->
|
||||||
DefaulLevel = rebar_log:default_level(),
|
DefaulLevel = rebar_log:default_level(),
|
||||||
get_global(verbose, DefaulLevel) > DefaulLevel.
|
get_global(Config, verbose, DefaulLevel) > DefaulLevel.
|
||||||
|
|
||||||
get_jobs() ->
|
|
||||||
get_global(jobs, 3).
|
|
||||||
|
|
||||||
consult_file(File) ->
|
consult_file(File) ->
|
||||||
case filename:extension(File) of
|
case filename:extension(File) of
|
||||||
|
@ -162,15 +164,21 @@ set_xconf(Config, Key, Value) ->
|
||||||
Config#config{xconf=NewXconf}.
|
Config#config{xconf=NewXconf}.
|
||||||
|
|
||||||
get_xconf(Config, Key) ->
|
get_xconf(Config, Key) ->
|
||||||
dict:find(Key, Config#config.xconf).
|
{ok, Value} = dict:find(Key, Config#config.xconf),
|
||||||
|
Value.
|
||||||
|
|
||||||
|
get_xconf(Config, Key, Default) ->
|
||||||
|
case dict:find(Key, Config#config.xconf) of
|
||||||
|
error ->
|
||||||
|
Default;
|
||||||
|
{ok, Value} ->
|
||||||
|
Value
|
||||||
|
end.
|
||||||
|
|
||||||
erase_xconf(Config, Key) ->
|
erase_xconf(Config, Key) ->
|
||||||
NewXconf = dict:erase(Key, Config#config.xconf),
|
NewXconf = dict:erase(Key, Config#config.xconf),
|
||||||
Config#config{xconf = NewXconf}.
|
Config#config{xconf = NewXconf}.
|
||||||
|
|
||||||
reset_xconf(Config) ->
|
|
||||||
Config#config{xconf = new_xconf()}.
|
|
||||||
|
|
||||||
%% TODO: reconsider after config inheritance removal/redesign
|
%% TODO: reconsider after config inheritance removal/redesign
|
||||||
clean_config(Old, New) ->
|
clean_config(Old, New) ->
|
||||||
New#config{opts=Old#config.opts}.
|
New#config{opts=Old#config.opts}.
|
||||||
|
@ -208,7 +216,6 @@ consult_and_eval(File, Script) ->
|
||||||
ConfigData = try_consult(File),
|
ConfigData = try_consult(File),
|
||||||
file:script(Script, bs([{'CONFIG', ConfigData}, {'SCRIPT', Script}])).
|
file:script(Script, bs([{'CONFIG', ConfigData}, {'SCRIPT', Script}])).
|
||||||
|
|
||||||
|
|
||||||
remove_script_ext(F) ->
|
remove_script_ext(F) ->
|
||||||
"tpircs." ++ Rev = lists:reverse(F),
|
"tpircs." ++ Rev = lists:reverse(F),
|
||||||
lists:reverse(Rev).
|
lists:reverse(Rev).
|
||||||
|
@ -236,6 +243,8 @@ local_opts([local | _Rest], Acc) ->
|
||||||
local_opts([Item | Rest], Acc) ->
|
local_opts([Item | Rest], Acc) ->
|
||||||
local_opts(Rest, [Item | Acc]).
|
local_opts(Rest, [Item | Acc]).
|
||||||
|
|
||||||
|
new_globals() -> dict:new().
|
||||||
|
|
||||||
new_env() -> dict:new().
|
new_env() -> dict:new().
|
||||||
|
|
||||||
new_skip_dirs() -> dict:new().
|
new_skip_dirs() -> dict:new().
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
process_commands([], ParentConfig) ->
|
process_commands([], ParentConfig) ->
|
||||||
AbortTrapped = rebar_config:get_global(abort_trapped, false),
|
AbortTrapped = rebar_config:get_xconf(ParentConfig, abort_trapped, false),
|
||||||
case {get_operations(ParentConfig), AbortTrapped} of
|
case {get_operations(ParentConfig), AbortTrapped} of
|
||||||
{0, _} ->
|
{0, _} ->
|
||||||
%% None of the commands had any effect
|
%% None of the commands had any effect
|
||||||
|
@ -49,7 +49,7 @@ process_commands([], ParentConfig) ->
|
||||||
process_commands([Command | Rest], ParentConfig) ->
|
process_commands([Command | Rest], ParentConfig) ->
|
||||||
%% Reset skip dirs
|
%% Reset skip dirs
|
||||||
ParentConfig1 = rebar_config:reset_skip_dirs(ParentConfig),
|
ParentConfig1 = rebar_config:reset_skip_dirs(ParentConfig),
|
||||||
Operations = rebar_config:get_xconf(ParentConfig1, operations),
|
Operations = get_operations(ParentConfig1),
|
||||||
|
|
||||||
ParentConfig4 =
|
ParentConfig4 =
|
||||||
try
|
try
|
||||||
|
@ -75,13 +75,13 @@ process_commands([Command | Rest], ParentConfig) ->
|
||||||
rebar_config:set_xconf(ParentConfig3, vsn_cache, dict:new())
|
rebar_config:set_xconf(ParentConfig3, vsn_cache, dict:new())
|
||||||
catch
|
catch
|
||||||
throw:rebar_abort ->
|
throw:rebar_abort ->
|
||||||
case rebar_config:get_global(keep_going, false) of
|
case rebar_config:get_xconf(ParentConfig1, keep_going, false) of
|
||||||
false ->
|
false ->
|
||||||
?ABORT;
|
?ABORT;
|
||||||
true ->
|
true ->
|
||||||
?WARN("Continuing on after abort: ~p\n", [Rest]),
|
?WARN("Continuing on after abort: ~p\n", [Rest]),
|
||||||
rebar_config:set_global(abort_trapped, true),
|
rebar_config:set_xconf(ParentConfig1,
|
||||||
ParentConfig1
|
abort_trapped, true)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
process_commands(Rest, ParentConfig4).
|
process_commands(Rest, ParentConfig4).
|
||||||
|
@ -242,15 +242,15 @@ remember_cwd_subdir(Cwd, Subdirs) ->
|
||||||
maybe_load_local_config(Dir, ParentConfig) ->
|
maybe_load_local_config(Dir, ParentConfig) ->
|
||||||
%% We need to ensure we don't overwrite custom
|
%% We need to ensure we don't overwrite custom
|
||||||
%% config when we are dealing with base_dir.
|
%% config when we are dealing with base_dir.
|
||||||
case processing_base_dir(Dir) of
|
case processing_base_dir(ParentConfig, Dir) of
|
||||||
true ->
|
true ->
|
||||||
ParentConfig;
|
ParentConfig;
|
||||||
false ->
|
false ->
|
||||||
rebar_config:new(ParentConfig)
|
rebar_config:new(ParentConfig)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
processing_base_dir(Dir) ->
|
processing_base_dir(Config, Dir) ->
|
||||||
Dir == rebar_config:get_global(base_dir, undefined).
|
Dir == rebar_config:get_xconf(Config, base_dir).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% Given a list of directories and a set of previously processed directories,
|
%% Given a list of directories and a set of previously processed directories,
|
||||||
|
@ -357,8 +357,7 @@ increment_operations(Config) ->
|
||||||
rebar_config:set_xconf(Config, operations, Operations + 1).
|
rebar_config:set_xconf(Config, operations, Operations + 1).
|
||||||
|
|
||||||
get_operations(Config) ->
|
get_operations(Config) ->
|
||||||
{ok, Operations} = rebar_config:get_xconf(Config, operations),
|
rebar_config:get_xconf(Config, operations).
|
||||||
Operations.
|
|
||||||
|
|
||||||
update_code_path(Config) ->
|
update_code_path(Config) ->
|
||||||
case rebar_config:get_local(Config, lib_dirs, []) of
|
case rebar_config:get_local(Config, lib_dirs, []) of
|
||||||
|
|
|
@ -64,7 +64,7 @@ run_test_if_present(TestDir, Config, File) ->
|
||||||
run_test(TestDir, Config, _File) ->
|
run_test(TestDir, Config, _File) ->
|
||||||
{Cmd, RawLog} = make_cmd(TestDir, Config),
|
{Cmd, RawLog} = make_cmd(TestDir, Config),
|
||||||
clear_log(RawLog),
|
clear_log(RawLog),
|
||||||
case rebar_config:is_verbose() of
|
case rebar_config:is_verbose(Config) of
|
||||||
false ->
|
false ->
|
||||||
Output = " >> " ++ RawLog ++ " 2>&1";
|
Output = " >> " ++ RawLog ++ " 2>&1";
|
||||||
true ->
|
true ->
|
||||||
|
@ -72,7 +72,7 @@ run_test(TestDir, Config, _File) ->
|
||||||
end,
|
end,
|
||||||
|
|
||||||
rebar_utils:sh(Cmd ++ Output, [{env,[{"TESTDIR", TestDir}]}]),
|
rebar_utils:sh(Cmd ++ Output, [{env,[{"TESTDIR", TestDir}]}]),
|
||||||
check_log(RawLog).
|
check_log(Config, RawLog).
|
||||||
|
|
||||||
|
|
||||||
clear_log(RawLog) ->
|
clear_log(RawLog) ->
|
||||||
|
@ -88,7 +88,7 @@ clear_log(RawLog) ->
|
||||||
|
|
||||||
%% calling ct with erl does not return non-zero on failure - have to check
|
%% calling ct with erl does not return non-zero on failure - have to check
|
||||||
%% log results
|
%% log results
|
||||||
check_log(RawLog) ->
|
check_log(Config, RawLog) ->
|
||||||
{ok, Msg} =
|
{ok, Msg} =
|
||||||
rebar_utils:sh("grep -e 'TEST COMPLETE' -e '{error,make_failed}' "
|
rebar_utils:sh("grep -e 'TEST COMPLETE' -e '{error,make_failed}' "
|
||||||
++ RawLog, [{use_stdout, false}]),
|
++ RawLog, [{use_stdout, false}]),
|
||||||
|
@ -96,12 +96,12 @@ check_log(RawLog) ->
|
||||||
RunFailed = string:str(Msg, ", 0 failed") =:= 0,
|
RunFailed = string:str(Msg, ", 0 failed") =:= 0,
|
||||||
if
|
if
|
||||||
MakeFailed ->
|
MakeFailed ->
|
||||||
show_log(RawLog),
|
show_log(Config, RawLog),
|
||||||
?ERROR("Building tests failed\n",[]),
|
?ERROR("Building tests failed\n",[]),
|
||||||
?ABORT;
|
?ABORT;
|
||||||
|
|
||||||
RunFailed ->
|
RunFailed ->
|
||||||
show_log(RawLog),
|
show_log(Config, RawLog),
|
||||||
?ERROR("One or more tests failed\n",[]),
|
?ERROR("One or more tests failed\n",[]),
|
||||||
?ABORT;
|
?ABORT;
|
||||||
|
|
||||||
|
@ -110,9 +110,9 @@ check_log(RawLog) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% Show the log if it hasn't already been shown because verbose was on
|
%% Show the log if it hasn't already been shown because verbose was on
|
||||||
show_log(RawLog) ->
|
show_log(Config, RawLog) ->
|
||||||
?CONSOLE("Showing log\n", []),
|
?CONSOLE("Showing log\n", []),
|
||||||
case rebar_config:is_verbose() of
|
case rebar_config:is_verbose(Config) of
|
||||||
false ->
|
false ->
|
||||||
{ok, Contents} = file:read_file(RawLog),
|
{ok, Contents} = file:read_file(RawLog),
|
||||||
?CONSOLE("~s", [Contents]);
|
?CONSOLE("~s", [Contents]);
|
||||||
|
@ -159,8 +159,8 @@ make_cmd(TestDir, Config) ->
|
||||||
get_cover_config(Config, Cwd) ++
|
get_cover_config(Config, Cwd) ++
|
||||||
get_ct_config_file(TestDir) ++
|
get_ct_config_file(TestDir) ++
|
||||||
get_config_file(TestDir) ++
|
get_config_file(TestDir) ++
|
||||||
get_suites(TestDir) ++
|
get_suites(Config, TestDir) ++
|
||||||
get_case();
|
get_case(Config);
|
||||||
SpecFlags ->
|
SpecFlags ->
|
||||||
?FMT("erl " % should we expand ERL_PATH?
|
?FMT("erl " % should we expand ERL_PATH?
|
||||||
" -noshell -pa ~s ~s"
|
" -noshell -pa ~s ~s"
|
||||||
|
@ -248,8 +248,8 @@ get_config_file(TestDir) ->
|
||||||
" -config " ++ Config
|
" -config " ++ Config
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_suites(TestDir) ->
|
get_suites(Config, TestDir) ->
|
||||||
case rebar_utils:get_deprecated_global(suite, suites, "soon") of
|
case rebar_utils:get_deprecated_global(Config, suite, suites, "soon") of
|
||||||
undefined ->
|
undefined ->
|
||||||
" -dir " ++ TestDir;
|
" -dir " ++ TestDir;
|
||||||
Suites ->
|
Suites ->
|
||||||
|
@ -268,8 +268,8 @@ find_suite_path(Suite, TestDir) ->
|
||||||
Path
|
Path
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_case() ->
|
get_case(Config) ->
|
||||||
case rebar_config:get_global('case', undefined) of
|
case rebar_config:get_global(Config, 'case', undefined) of
|
||||||
undefined ->
|
undefined ->
|
||||||
"";
|
"";
|
||||||
Case ->
|
Case ->
|
||||||
|
|
|
@ -52,40 +52,41 @@ preprocess(Config, _) ->
|
||||||
%% Side effect to set deps_dir globally for all dependencies from
|
%% Side effect to set deps_dir globally for all dependencies from
|
||||||
%% top level down. Means the root deps_dir is honoured or the default
|
%% top level down. Means the root deps_dir is honoured or the default
|
||||||
%% used globally since it will be set on the first time through here
|
%% used globally since it will be set on the first time through here
|
||||||
set_global_deps_dir(Config, rebar_config:get_global(deps_dir, [])),
|
DepsDir = rebar_config:get_global(Config, deps_dir, []),
|
||||||
|
Config1 = set_global_deps_dir(Config, DepsDir),
|
||||||
|
|
||||||
%% Get the list of deps for the current working directory and identify those
|
%% Get the list of deps for the current working directory and identify those
|
||||||
%% deps that are available/present.
|
%% deps that are available/present.
|
||||||
Deps = rebar_config:get_local(Config, deps, []),
|
Deps = rebar_config:get_local(Config1, deps, []),
|
||||||
{Config1, {AvailableDeps, MissingDeps}} = find_deps(Config, find, Deps),
|
{Config2, {AvailableDeps, MissingDeps}} = find_deps(Config1, find, Deps),
|
||||||
|
|
||||||
?DEBUG("Available deps: ~p\n", [AvailableDeps]),
|
?DEBUG("Available deps: ~p\n", [AvailableDeps]),
|
||||||
?DEBUG("Missing deps : ~p\n", [MissingDeps]),
|
?DEBUG("Missing deps : ~p\n", [MissingDeps]),
|
||||||
|
|
||||||
%% Add available deps to code path
|
%% Add available deps to code path
|
||||||
Config2 = update_deps_code_path(Config1, AvailableDeps),
|
Config3 = update_deps_code_path(Config2, AvailableDeps),
|
||||||
|
|
||||||
%% If skip_deps=true, mark each dep dir as a skip_dir w/ the core so that
|
%% If skip_deps=true, mark each dep dir as a skip_dir w/ the core so that
|
||||||
%% the current command doesn't run on the dep dir. However, pre/postprocess
|
%% the current command doesn't run on the dep dir. However, pre/postprocess
|
||||||
%% WILL run (and we want it to) for transitivity purposes.
|
%% WILL run (and we want it to) for transitivity purposes.
|
||||||
NewConfig = case rebar_config:get_global(skip_deps, false) of
|
NewConfig = case rebar_config:get_global(Config3, skip_deps, false) of
|
||||||
"true" ->
|
"true" ->
|
||||||
lists:foldl(
|
lists:foldl(
|
||||||
fun(#dep{dir = Dir}, C) ->
|
fun(#dep{dir = Dir}, C) ->
|
||||||
rebar_config:set_skip_dir(C, Dir)
|
rebar_config:set_skip_dir(C, Dir)
|
||||||
end, Config2, AvailableDeps);
|
end, Config3, AvailableDeps);
|
||||||
_ ->
|
_ ->
|
||||||
Config2
|
Config3
|
||||||
end,
|
end,
|
||||||
|
|
||||||
%% Return all the available dep directories for process
|
%% Return all the available dep directories for process
|
||||||
{ok, NewConfig, dep_dirs(AvailableDeps)}.
|
{ok, NewConfig, dep_dirs(AvailableDeps)}.
|
||||||
|
|
||||||
postprocess(Config, _) ->
|
postprocess(Config, _) ->
|
||||||
case rebar_config:get_xconf(Config, ?MODULE) of
|
case rebar_config:get_xconf(Config, ?MODULE, undefined) of
|
||||||
error ->
|
undefined ->
|
||||||
{ok, []};
|
{ok, []};
|
||||||
{ok, Dirs} ->
|
Dirs ->
|
||||||
NewConfig = rebar_config:erase_xconf(Config, ?MODULE),
|
NewConfig = rebar_config:erase_xconf(Config, ?MODULE),
|
||||||
{ok, NewConfig, Dirs}
|
{ok, NewConfig, Dirs}
|
||||||
end.
|
end.
|
||||||
|
@ -94,8 +95,8 @@ compile(Config, AppFile) ->
|
||||||
'check-deps'(Config, AppFile).
|
'check-deps'(Config, AppFile).
|
||||||
|
|
||||||
%% set REBAR_DEPS_DIR and ERL_LIBS environment variables
|
%% set REBAR_DEPS_DIR and ERL_LIBS environment variables
|
||||||
setup_env(_Config) ->
|
setup_env(Config) ->
|
||||||
{true, DepsDir} = get_deps_dir(),
|
{true, DepsDir} = get_deps_dir(Config),
|
||||||
%% include rebar's DepsDir in ERL_LIBS
|
%% include rebar's DepsDir in ERL_LIBS
|
||||||
Separator = case os:type() of
|
Separator = case os:type() of
|
||||||
{win32, nt} ->
|
{win32, nt} ->
|
||||||
|
@ -149,7 +150,8 @@ setup_env(_Config) ->
|
||||||
{Config1, Deps} = find_deps(Config, read, RawDeps),
|
{Config1, Deps} = find_deps(Config, read, RawDeps),
|
||||||
|
|
||||||
%% Update each dep
|
%% Update each dep
|
||||||
UpdatedDeps = [update_source(D) || D <- Deps, D#dep.source =/= undefined],
|
UpdatedDeps = [update_source(Config1, D)
|
||||||
|
|| D <- Deps, D#dep.source =/= undefined],
|
||||||
|
|
||||||
%% Add each updated dep to our list of dirs for post-processing. This yields
|
%% Add each updated dep to our list of dirs for post-processing. This yields
|
||||||
%% the necessary transitivity of the deps
|
%% the necessary transitivity of the deps
|
||||||
|
@ -157,7 +159,7 @@ setup_env(_Config) ->
|
||||||
|
|
||||||
'delete-deps'(Config, _) ->
|
'delete-deps'(Config, _) ->
|
||||||
%% Delete all the available deps in our deps/ directory, if any
|
%% Delete all the available deps in our deps/ directory, if any
|
||||||
{true, DepsDir} = get_deps_dir(),
|
{true, DepsDir} = get_deps_dir(Config),
|
||||||
Deps = rebar_config:get_local(Config, deps, []),
|
Deps = rebar_config:get_local(Config, deps, []),
|
||||||
{Config1, {AvailableDeps, _}} = find_deps(Config, find, Deps),
|
{Config1, {AvailableDeps, _}} = find_deps(Config, find, Deps),
|
||||||
_ = [delete_dep(D)
|
_ = [delete_dep(D)
|
||||||
|
@ -183,17 +185,17 @@ setup_env(_Config) ->
|
||||||
%% need all deps in same dir and should be the one set by the root rebar.config
|
%% need all deps in same dir and should be the one set by the root rebar.config
|
||||||
%% Sets a default if root config has no deps_dir set
|
%% Sets a default if root config has no deps_dir set
|
||||||
set_global_deps_dir(Config, []) ->
|
set_global_deps_dir(Config, []) ->
|
||||||
rebar_config:set_global(deps_dir,
|
rebar_config:set_global(Config, deps_dir,
|
||||||
rebar_config:get_local(Config, deps_dir, "deps"));
|
rebar_config:get_local(Config, deps_dir, "deps"));
|
||||||
set_global_deps_dir(_Config, _DepsDir) ->
|
set_global_deps_dir(Config, _DepsDir) ->
|
||||||
ok.
|
Config.
|
||||||
|
|
||||||
get_deps_dir() ->
|
get_deps_dir(Config) ->
|
||||||
get_deps_dir("").
|
get_deps_dir(Config, "").
|
||||||
|
|
||||||
get_deps_dir(App) ->
|
get_deps_dir(Config, App) ->
|
||||||
BaseDir = rebar_config:get_global(base_dir, []),
|
BaseDir = rebar_config:get_xconf(Config, base_dir, []),
|
||||||
DepsDir = rebar_config:get_global(deps_dir, "deps"),
|
DepsDir = rebar_config:get_global(Config, deps_dir, "deps"),
|
||||||
{true, filename:join([BaseDir, DepsDir, App])}.
|
{true, filename:join([BaseDir, DepsDir, App])}.
|
||||||
|
|
||||||
dep_dirs(Deps) ->
|
dep_dirs(Deps) ->
|
||||||
|
@ -262,7 +264,7 @@ find_dep(Config, Dep) ->
|
||||||
find_dep(Config, Dep, undefined) ->
|
find_dep(Config, Dep, undefined) ->
|
||||||
%% 'source' is undefined. If Dep is not satisfied locally,
|
%% 'source' is undefined. If Dep is not satisfied locally,
|
||||||
%% go ahead and find it amongst the lib_dir's.
|
%% go ahead and find it amongst the lib_dir's.
|
||||||
case find_dep_in_dir(Config, Dep, get_deps_dir(Dep#dep.app)) of
|
case find_dep_in_dir(Config, Dep, get_deps_dir(Config, Dep#dep.app)) of
|
||||||
{_Config1, {avail, _Dir}} = Avail ->
|
{_Config1, {avail, _Dir}} = Avail ->
|
||||||
Avail;
|
Avail;
|
||||||
{Config1, {missing, _}} ->
|
{Config1, {missing, _}} ->
|
||||||
|
@ -272,7 +274,7 @@ find_dep(Config, Dep, _Source) ->
|
||||||
%% _Source is defined. Regardless of what it is, we must find it
|
%% _Source is defined. Regardless of what it is, we must find it
|
||||||
%% locally satisfied or fetch it from the original source
|
%% locally satisfied or fetch it from the original source
|
||||||
%% into the project's deps
|
%% into the project's deps
|
||||||
find_dep_in_dir(Config, Dep, get_deps_dir(Dep#dep.app)).
|
find_dep_in_dir(Config, Dep, get_deps_dir(Config, Dep#dep.app)).
|
||||||
|
|
||||||
find_dep_in_dir(Config, _Dep, {false, Dir}) ->
|
find_dep_in_dir(Config, _Dep, {false, Dir}) ->
|
||||||
{Config, {missing, Dir}};
|
{Config, {missing, Dir}};
|
||||||
|
@ -365,7 +367,7 @@ use_source(Config, Dep, Count) ->
|
||||||
false ->
|
false ->
|
||||||
?CONSOLE("Pulling ~p from ~p\n", [Dep#dep.app, Dep#dep.source]),
|
?CONSOLE("Pulling ~p from ~p\n", [Dep#dep.app, Dep#dep.source]),
|
||||||
require_source_engine(Dep#dep.source),
|
require_source_engine(Dep#dep.source),
|
||||||
{true, TargetDir} = get_deps_dir(Dep#dep.app),
|
{true, TargetDir} = get_deps_dir(Config, Dep#dep.app),
|
||||||
download_source(TargetDir, Dep#dep.source),
|
download_source(TargetDir, Dep#dep.source),
|
||||||
use_source(Config, Dep#dep { dir = TargetDir }, Count-1)
|
use_source(Config, Dep#dep { dir = TargetDir }, Count-1)
|
||||||
end.
|
end.
|
||||||
|
@ -408,17 +410,17 @@ download_source(AppDir, {rsync, Url}) ->
|
||||||
ok = filelib:ensure_dir(AppDir),
|
ok = filelib:ensure_dir(AppDir),
|
||||||
rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s", [Url, AppDir]), []).
|
rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s", [Url, AppDir]), []).
|
||||||
|
|
||||||
update_source(Dep) ->
|
update_source(Config, Dep) ->
|
||||||
%% It's possible when updating a source, that a given dep does not have a
|
%% It's possible when updating a source, that a given dep does not have a
|
||||||
%% VCS directory, such as when a source archive is built of a project, with
|
%% VCS directory, such as when a source archive is built of a project, with
|
||||||
%% all deps already downloaded/included. So, verify that the necessary VCS
|
%% all deps already downloaded/included. So, verify that the necessary VCS
|
||||||
%% directory exists before attempting to do the update.
|
%% directory exists before attempting to do the update.
|
||||||
{true, AppDir} = get_deps_dir(Dep#dep.app),
|
{true, AppDir} = get_deps_dir(Config, Dep#dep.app),
|
||||||
case has_vcs_dir(element(1, Dep#dep.source), AppDir) of
|
case has_vcs_dir(element(1, Dep#dep.source), AppDir) of
|
||||||
true ->
|
true ->
|
||||||
?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]),
|
?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]),
|
||||||
require_source_engine(Dep#dep.source),
|
require_source_engine(Dep#dep.source),
|
||||||
update_source(AppDir, Dep#dep.source),
|
update_source1(AppDir, Dep#dep.source),
|
||||||
Dep;
|
Dep;
|
||||||
false ->
|
false ->
|
||||||
?WARN("Skipping update for ~p: "
|
?WARN("Skipping update for ~p: "
|
||||||
|
@ -426,29 +428,29 @@ update_source(Dep) ->
|
||||||
Dep
|
Dep
|
||||||
end.
|
end.
|
||||||
|
|
||||||
update_source(AppDir, {git, Url}) ->
|
update_source1(AppDir, {git, Url}) ->
|
||||||
update_source(AppDir, {git, Url, {branch, "HEAD"}});
|
update_source1(AppDir, {git, Url, {branch, "HEAD"}});
|
||||||
update_source(AppDir, {git, Url, ""}) ->
|
update_source1(AppDir, {git, Url, ""}) ->
|
||||||
update_source(AppDir, {git, Url, {branch, "HEAD"}});
|
update_source1(AppDir, {git, Url, {branch, "HEAD"}});
|
||||||
update_source(AppDir, {git, _Url, {branch, Branch}}) ->
|
update_source1(AppDir, {git, _Url, {branch, Branch}}) ->
|
||||||
ShOpts = [{cd, AppDir}],
|
ShOpts = [{cd, AppDir}],
|
||||||
rebar_utils:sh("git fetch origin", ShOpts),
|
rebar_utils:sh("git fetch origin", ShOpts),
|
||||||
rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), ShOpts);
|
rebar_utils:sh(?FMT("git checkout -q origin/~s", [Branch]), ShOpts);
|
||||||
update_source(AppDir, {git, _Url, {tag, Tag}}) ->
|
update_source1(AppDir, {git, _Url, {tag, Tag}}) ->
|
||||||
ShOpts = [{cd, AppDir}],
|
ShOpts = [{cd, AppDir}],
|
||||||
rebar_utils:sh("git fetch --tags origin", ShOpts),
|
rebar_utils:sh("git fetch --tags origin", ShOpts),
|
||||||
rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), ShOpts);
|
rebar_utils:sh(?FMT("git checkout -q ~s", [Tag]), ShOpts);
|
||||||
update_source(AppDir, {git, _Url, Refspec}) ->
|
update_source1(AppDir, {git, _Url, Refspec}) ->
|
||||||
ShOpts = [{cd, AppDir}],
|
ShOpts = [{cd, AppDir}],
|
||||||
rebar_utils:sh("git fetch origin", ShOpts),
|
rebar_utils:sh("git fetch origin", ShOpts),
|
||||||
rebar_utils:sh(?FMT("git checkout -q ~s", [Refspec]), ShOpts);
|
rebar_utils:sh(?FMT("git checkout -q ~s", [Refspec]), ShOpts);
|
||||||
update_source(AppDir, {svn, _Url, Rev}) ->
|
update_source1(AppDir, {svn, _Url, Rev}) ->
|
||||||
rebar_utils:sh(?FMT("svn up -r ~s", [Rev]), [{cd, AppDir}]);
|
rebar_utils:sh(?FMT("svn up -r ~s", [Rev]), [{cd, AppDir}]);
|
||||||
update_source(AppDir, {hg, _Url, Rev}) ->
|
update_source1(AppDir, {hg, _Url, Rev}) ->
|
||||||
rebar_utils:sh(?FMT("hg pull -u -r ~s", [Rev]), [{cd, AppDir}]);
|
rebar_utils:sh(?FMT("hg pull -u -r ~s", [Rev]), [{cd, AppDir}]);
|
||||||
update_source(AppDir, {bzr, _Url, Rev}) ->
|
update_source1(AppDir, {bzr, _Url, Rev}) ->
|
||||||
rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]);
|
rebar_utils:sh(?FMT("bzr update -r ~s", [Rev]), [{cd, AppDir}]);
|
||||||
update_source(AppDir, {rsync, Url}) ->
|
update_source1(AppDir, {rsync, Url}) ->
|
||||||
rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s",[Url,AppDir]),[]).
|
rebar_utils:sh(?FMT("rsync -az --delete ~s/ ~s",[Url,AppDir]),[]).
|
||||||
|
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
|
@ -139,7 +139,7 @@ eunit(Config, _AppFile) ->
|
||||||
ModuleBeamFiles = BeamFiles ++ OtherBeamFiles,
|
ModuleBeamFiles = BeamFiles ++ OtherBeamFiles,
|
||||||
Modules = [rebar_utils:beam_to_mod(?EUNIT_DIR, N) || N <- ModuleBeamFiles],
|
Modules = [rebar_utils:beam_to_mod(?EUNIT_DIR, N) || N <- ModuleBeamFiles],
|
||||||
SrcModules = [rebar_utils:erl_to_mod(M) || M <- SrcErls],
|
SrcModules = [rebar_utils:erl_to_mod(M) || M <- SrcErls],
|
||||||
FilteredModules = filter_modules(Modules),
|
FilteredModules = filter_modules(Config, Modules),
|
||||||
|
|
||||||
{ok, CoverLog} = cover_init(Config, ModuleBeamFiles),
|
{ok, CoverLog} = cover_init(Config, ModuleBeamFiles),
|
||||||
|
|
||||||
|
@ -181,14 +181,15 @@ eunit_dir() ->
|
||||||
ebin_dir() ->
|
ebin_dir() ->
|
||||||
filename:join(rebar_utils:get_cwd(), "ebin").
|
filename:join(rebar_utils:get_cwd(), "ebin").
|
||||||
|
|
||||||
filter_modules(Modules) ->
|
filter_modules(Config, Modules) ->
|
||||||
RawSuites = rebar_utils:get_deprecated_global(suite, suites, [], "soon"),
|
RawSuites = rebar_utils:get_deprecated_global(Config, suite, suites,
|
||||||
|
[], "soon"),
|
||||||
Suites = [list_to_atom(Suite) || Suite <- string:tokens(RawSuites, ",")],
|
Suites = [list_to_atom(Suite) || Suite <- string:tokens(RawSuites, ",")],
|
||||||
filter_modules(Modules, Suites).
|
filter_modules1(Modules, Suites).
|
||||||
|
|
||||||
filter_modules(Modules, []) ->
|
filter_modules1(Modules, []) ->
|
||||||
Modules;
|
Modules;
|
||||||
filter_modules(Modules, Suites) ->
|
filter_modules1(Modules, Suites) ->
|
||||||
[M || M <- Modules, lists:member(M, Suites)].
|
[M || M <- Modules, lists:member(M, Suites)].
|
||||||
|
|
||||||
perform_eunit(Config, FilteredModules) ->
|
perform_eunit(Config, FilteredModules) ->
|
||||||
|
@ -208,7 +209,7 @@ perform_eunit(Config, FilteredModules) ->
|
||||||
|
|
||||||
get_eunit_opts(Config) ->
|
get_eunit_opts(Config) ->
|
||||||
%% Enable verbose in eunit if so requested..
|
%% Enable verbose in eunit if so requested..
|
||||||
BaseOpts = case rebar_config:is_verbose() of
|
BaseOpts = case rebar_config:is_verbose(Config) of
|
||||||
true ->
|
true ->
|
||||||
[verbose];
|
[verbose];
|
||||||
false ->
|
false ->
|
||||||
|
@ -247,8 +248,8 @@ define_if(Def, true) -> [{d, Def}];
|
||||||
define_if(_Def, false) -> [].
|
define_if(_Def, false) -> [].
|
||||||
|
|
||||||
is_lib_avail(Config, DictKey, Mod, Hrl, Name) ->
|
is_lib_avail(Config, DictKey, Mod, Hrl, Name) ->
|
||||||
case rebar_config:get_xconf(Config, DictKey) of
|
case rebar_config:get_xconf(Config, DictKey, undefined) of
|
||||||
error ->
|
undefined ->
|
||||||
IsAvail = case code:lib_dir(Mod, include) of
|
IsAvail = case code:lib_dir(Mod, include) of
|
||||||
{error, bad_name} ->
|
{error, bad_name} ->
|
||||||
false;
|
false;
|
||||||
|
@ -258,7 +259,7 @@ is_lib_avail(Config, DictKey, Mod, Hrl, Name) ->
|
||||||
NewConfig = rebar_config:set_xconf(Config, DictKey, IsAvail),
|
NewConfig = rebar_config:set_xconf(Config, DictKey, IsAvail),
|
||||||
?DEBUG("~s availability: ~p\n", [Name, IsAvail]),
|
?DEBUG("~s availability: ~p\n", [Name, IsAvail]),
|
||||||
{NewConfig, IsAvail};
|
{NewConfig, IsAvail};
|
||||||
{ok, IsAvail} ->
|
IsAvail ->
|
||||||
{Config, IsAvail}
|
{Config, IsAvail}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -26,16 +26,17 @@
|
||||||
%% -------------------------------------------------------------------
|
%% -------------------------------------------------------------------
|
||||||
-module(rebar_log).
|
-module(rebar_log).
|
||||||
|
|
||||||
-export([init/0,
|
-export([init/1,
|
||||||
set_level/1, get_level/0, default_level/0,
|
set_level/1, default_level/0,
|
||||||
log/3]).
|
log/3]).
|
||||||
|
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
%% Public API
|
%% Public API
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
init() ->
|
init(Config) ->
|
||||||
case valid_level(rebar_config:get_global(verbose, error_level())) of
|
Verbosity = rebar_config:get_global(Config, verbose, default_level()),
|
||||||
|
case valid_level(Verbosity) of
|
||||||
0 -> set_level(error);
|
0 -> set_level(error);
|
||||||
1 -> set_level(warn);
|
1 -> set_level(warn);
|
||||||
2 -> set_level(info);
|
2 -> set_level(info);
|
||||||
|
@ -45,14 +46,6 @@ init() ->
|
||||||
set_level(Level) ->
|
set_level(Level) ->
|
||||||
ok = application:set_env(rebar, log_level, Level).
|
ok = application:set_env(rebar, log_level, Level).
|
||||||
|
|
||||||
get_level() ->
|
|
||||||
case application:get_env(rebar, log_level) of
|
|
||||||
undefined ->
|
|
||||||
error;
|
|
||||||
{ok, Value} ->
|
|
||||||
Value
|
|
||||||
end.
|
|
||||||
|
|
||||||
log(Level, Str, Args) ->
|
log(Level, Str, Args) ->
|
||||||
{ok, LogLevel} = application:get_env(rebar, log_level),
|
{ok, LogLevel} = application:get_env(rebar, log_level),
|
||||||
case should_log(LogLevel, Level) of
|
case should_log(LogLevel, Level) of
|
||||||
|
|
|
@ -179,12 +179,13 @@ setup_env(Config, ExtraEnv) ->
|
||||||
%% max flexibility for users.
|
%% max flexibility for users.
|
||||||
DefaultEnv = filter_env(default_env(), []),
|
DefaultEnv = filter_env(default_env(), []),
|
||||||
PortEnv = filter_env(port_env(Config), []),
|
PortEnv = filter_env(port_env(Config), []),
|
||||||
OverrideEnv = global_defines() ++ PortEnv ++ filter_env(ExtraEnv, []),
|
GlobalDefines = global_defines(Config),
|
||||||
|
OverrideEnv = GlobalDefines ++ PortEnv ++ filter_env(ExtraEnv, []),
|
||||||
RawEnv = apply_defaults(os_env(), DefaultEnv) ++ OverrideEnv,
|
RawEnv = apply_defaults(os_env(), DefaultEnv) ++ OverrideEnv,
|
||||||
expand_vars_loop(merge_each_var(RawEnv, [])).
|
expand_vars_loop(merge_each_var(RawEnv, [])).
|
||||||
|
|
||||||
global_defines() ->
|
global_defines(Config) ->
|
||||||
Defines = rebar_config:get_global(defines, []),
|
Defines = rebar_config:get_global(Config, defines, []),
|
||||||
Flags = string:join(["-D" ++ D || D <- Defines], " "),
|
Flags = string:join(["-D" ++ D || D <- Defines], " "),
|
||||||
[{"ERL_CFLAGS", "$ERL_CFLAGS " ++ Flags}].
|
[{"ERL_CFLAGS", "$ERL_CFLAGS " ++ Flags}].
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,13 @@
|
||||||
get_rel_release_info/2,
|
get_rel_release_info/2,
|
||||||
get_rel_apps/1,
|
get_rel_apps/1,
|
||||||
get_rel_apps/2,
|
get_rel_apps/2,
|
||||||
get_previous_release_path/0,
|
get_previous_release_path/1,
|
||||||
get_rel_file_path/2,
|
get_rel_file_path/2,
|
||||||
load_config/2,
|
load_config/2,
|
||||||
get_sys_tuple/1,
|
get_sys_tuple/1,
|
||||||
get_target_dir/1,
|
get_target_dir/2,
|
||||||
get_root_dir/1,
|
get_root_dir/2,
|
||||||
get_target_parent_dir/1]).
|
get_target_parent_dir/2]).
|
||||||
|
|
||||||
-include("rebar.hrl").
|
-include("rebar.hrl").
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ get_rel_file_path(Name, Path) ->
|
||||||
filename:join([binary_to_list(BinDir), Name ++ ".rel"]).
|
filename:join([binary_to_list(BinDir), Name ++ ".rel"]).
|
||||||
|
|
||||||
%% Get the previous release path from a global variable
|
%% Get the previous release path from a global variable
|
||||||
get_previous_release_path() ->
|
get_previous_release_path(Config) ->
|
||||||
case rebar_config:get_global(previous_release, false) of
|
case rebar_config:get_global(Config, previous_release, false) of
|
||||||
false ->
|
false ->
|
||||||
?ABORT("previous_release=PATH is required to "
|
?ABORT("previous_release=PATH is required to "
|
||||||
"create upgrade package~n", []);
|
"create upgrade package~n", []);
|
||||||
|
@ -148,8 +148,8 @@ get_sys_tuple(ReltoolConfig) ->
|
||||||
%% Look for {target_dir, TargetDir} in the reltool config file; if none is
|
%% Look for {target_dir, TargetDir} in the reltool config file; if none is
|
||||||
%% found, use the name of the release as the default target directory.
|
%% found, use the name of the release as the default target directory.
|
||||||
%%
|
%%
|
||||||
get_target_dir(ReltoolConfig) ->
|
get_target_dir(Config, ReltoolConfig) ->
|
||||||
case rebar_config:get_global(target_dir, undefined) of
|
case rebar_config:get_global(Config, target_dir, undefined) of
|
||||||
undefined ->
|
undefined ->
|
||||||
case lists:keyfind(target_dir, 1, ReltoolConfig) of
|
case lists:keyfind(target_dir, 1, ReltoolConfig) of
|
||||||
{target_dir, TargetDir} ->
|
{target_dir, TargetDir} ->
|
||||||
|
@ -167,8 +167,8 @@ get_target_dir(ReltoolConfig) ->
|
||||||
filename:absname(TargetDir)
|
filename:absname(TargetDir)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_target_parent_dir(ReltoolConfig) ->
|
get_target_parent_dir(Config, ReltoolConfig) ->
|
||||||
TargetDir = get_target_dir(ReltoolConfig),
|
TargetDir = get_target_dir(Config, ReltoolConfig),
|
||||||
case lists:reverse(tl(lists:reverse(filename:split(TargetDir)))) of
|
case lists:reverse(tl(lists:reverse(filename:split(TargetDir)))) of
|
||||||
[] -> ".";
|
[] -> ".";
|
||||||
Components -> filename:join(Components)
|
Components -> filename:join(Components)
|
||||||
|
@ -178,10 +178,10 @@ get_target_parent_dir(ReltoolConfig) ->
|
||||||
%% Look for root_dir in sys tuple and command line; fall back to
|
%% Look for root_dir in sys tuple and command line; fall back to
|
||||||
%% code:root_dir().
|
%% code:root_dir().
|
||||||
%%
|
%%
|
||||||
get_root_dir(ReltoolConfig) ->
|
get_root_dir(Config, ReltoolConfig) ->
|
||||||
{sys, SysInfo} = get_sys_tuple(ReltoolConfig),
|
{sys, SysInfo} = get_sys_tuple(ReltoolConfig),
|
||||||
SysRootDirTuple = lists:keyfind(root_dir, 1, SysInfo),
|
SysRootDirTuple = lists:keyfind(root_dir, 1, SysInfo),
|
||||||
CmdRootDir = rebar_config:get_global(root_dir, undefined),
|
CmdRootDir = rebar_config:get_global(Config, root_dir, undefined),
|
||||||
case {SysRootDirTuple, CmdRootDir} of
|
case {SysRootDirTuple, CmdRootDir} of
|
||||||
%% root_dir in sys typle and no root_dir on cmd-line
|
%% root_dir in sys typle and no root_dir on cmd-line
|
||||||
{{root_dir, SysRootDir}, undefined} ->
|
{{root_dir, SysRootDir}, undefined} ->
|
||||||
|
|
|
@ -67,11 +67,11 @@ generate(Config0, ReltoolFile) ->
|
||||||
overlay(Config, ReltoolFile) ->
|
overlay(Config, ReltoolFile) ->
|
||||||
%% Load the reltool configuration from the file
|
%% Load the reltool configuration from the file
|
||||||
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
|
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
|
||||||
{Config1, process_overlay(ReltoolConfig)}.
|
{Config1, process_overlay(Config, ReltoolConfig)}.
|
||||||
|
|
||||||
clean(Config, ReltoolFile) ->
|
clean(Config, ReltoolFile) ->
|
||||||
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
|
{Config1, ReltoolConfig} = rebar_rel_utils:load_config(Config, ReltoolFile),
|
||||||
TargetDir = rebar_rel_utils:get_target_dir(ReltoolConfig),
|
TargetDir = rebar_rel_utils:get_target_dir(Config, ReltoolConfig),
|
||||||
rebar_file_utils:rm_rf(TargetDir),
|
rebar_file_utils:rm_rf(TargetDir),
|
||||||
rebar_file_utils:delete_each(["reltool.spec"]),
|
rebar_file_utils:delete_each(["reltool.spec"]),
|
||||||
{ok, Config1}.
|
{ok, Config1}.
|
||||||
|
@ -98,8 +98,8 @@ check_vsn() ->
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
process_overlay(ReltoolConfig) ->
|
process_overlay(Config, ReltoolConfig) ->
|
||||||
TargetDir = rebar_rel_utils:get_target_dir(ReltoolConfig),
|
TargetDir = rebar_rel_utils:get_target_dir(Config, ReltoolConfig),
|
||||||
|
|
||||||
{_BootRelName, BootRelVsn} =
|
{_BootRelName, BootRelVsn} =
|
||||||
rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
|
rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
|
||||||
|
@ -112,7 +112,7 @@ process_overlay(ReltoolConfig) ->
|
||||||
{target_dir, TargetDir}]),
|
{target_dir, TargetDir}]),
|
||||||
|
|
||||||
%% Load up any variables specified by overlay_vars
|
%% Load up any variables specified by overlay_vars
|
||||||
OverlayVars1 = overlay_vars(OverlayVars0, ReltoolConfig),
|
OverlayVars1 = overlay_vars(Config, OverlayVars0, ReltoolConfig),
|
||||||
OverlayVars = rebar_templater:resolve_variables(dict:to_list(OverlayVars1),
|
OverlayVars = rebar_templater:resolve_variables(dict:to_list(OverlayVars1),
|
||||||
OverlayVars1),
|
OverlayVars1),
|
||||||
|
|
||||||
|
@ -135,9 +135,11 @@ process_overlay(ReltoolConfig) ->
|
||||||
%% variable in the file from reltool.config and then override that value by
|
%% variable in the file from reltool.config and then override that value by
|
||||||
%% providing an additional file on the command-line.
|
%% providing an additional file on the command-line.
|
||||||
%%
|
%%
|
||||||
overlay_vars(Vars0, ReltoolConfig) ->
|
overlay_vars(Config, Vars0, ReltoolConfig) ->
|
||||||
BaseVars = load_vars_file(proplists:get_value(overlay_vars, ReltoolConfig)),
|
BaseVars = load_vars_file(proplists:get_value(overlay_vars, ReltoolConfig)),
|
||||||
OverrideVars = load_vars_file(rebar_config:get_global(overlay_vars, undefined)),
|
OverrideVars = load_vars_file(rebar_config:get_global(Config,
|
||||||
|
overlay_vars,
|
||||||
|
undefined)),
|
||||||
M = fun(_Key, _Base, Override) -> Override end,
|
M = fun(_Key, _Base, Override) -> Override end,
|
||||||
dict:merge(M, dict:merge(M, Vars0, BaseVars), OverrideVars).
|
dict:merge(M, dict:merge(M, Vars0, BaseVars), OverrideVars).
|
||||||
|
|
||||||
|
@ -189,18 +191,18 @@ app_exists(AppTuple, Server) when is_tuple(AppTuple) ->
|
||||||
app_exists(element(1, AppTuple), Server).
|
app_exists(element(1, AppTuple), Server).
|
||||||
|
|
||||||
|
|
||||||
run_reltool(Server, _Config, ReltoolConfig) ->
|
run_reltool(Server, Config, ReltoolConfig) ->
|
||||||
case reltool:get_target_spec(Server) of
|
case reltool:get_target_spec(Server) of
|
||||||
{ok, Spec} ->
|
{ok, Spec} ->
|
||||||
%% Pull the target dir and make sure it exists
|
%% Pull the target dir and make sure it exists
|
||||||
TargetDir = rebar_rel_utils:get_target_dir(ReltoolConfig),
|
TargetDir = rebar_rel_utils:get_target_dir(Config, ReltoolConfig),
|
||||||
mk_target_dir(TargetDir),
|
mk_target_dir(Config, TargetDir),
|
||||||
|
|
||||||
%% Determine the otp root dir to use
|
%% Determine the otp root dir to use
|
||||||
RootDir = rebar_rel_utils:get_root_dir(ReltoolConfig),
|
RootDir = rebar_rel_utils:get_root_dir(Config, ReltoolConfig),
|
||||||
|
|
||||||
%% Dump the spec, if necessary
|
%% Dump the spec, if necessary
|
||||||
dump_spec(Spec),
|
dump_spec(Config, Spec),
|
||||||
|
|
||||||
%% Have reltool actually run
|
%% Have reltool actually run
|
||||||
case reltool:eval_target_spec(Spec, RootDir, TargetDir) of
|
case reltool:eval_target_spec(Spec, RootDir, TargetDir) of
|
||||||
|
@ -216,20 +218,20 @@ run_reltool(Server, _Config, ReltoolConfig) ->
|
||||||
|
|
||||||
ok = create_RELEASES(TargetDir, BootRelName, BootRelVsn),
|
ok = create_RELEASES(TargetDir, BootRelName, BootRelVsn),
|
||||||
|
|
||||||
process_overlay(ReltoolConfig);
|
process_overlay(Config, ReltoolConfig);
|
||||||
|
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?ABORT("Unable to generate spec: ~s\n", [Reason])
|
?ABORT("Unable to generate spec: ~s\n", [Reason])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
mk_target_dir(TargetDir) ->
|
mk_target_dir(Config, TargetDir) ->
|
||||||
case filelib:ensure_dir(filename:join(TargetDir, "dummy")) of
|
case filelib:ensure_dir(filename:join(TargetDir, "dummy")) of
|
||||||
ok ->
|
ok ->
|
||||||
ok;
|
ok;
|
||||||
{error, eexist} ->
|
{error, eexist} ->
|
||||||
%% Output directory already exists; if force=1, wipe it out
|
%% Output directory already exists; if force=1, wipe it out
|
||||||
case rebar_config:get_global(force, "0") of
|
case rebar_config:get_global(Config, force, "0") of
|
||||||
"1" ->
|
"1" ->
|
||||||
rebar_file_utils:rm_rf(TargetDir),
|
rebar_file_utils:rm_rf(TargetDir),
|
||||||
ok = file:make_dir(TargetDir);
|
ok = file:make_dir(TargetDir);
|
||||||
|
@ -245,8 +247,8 @@ mk_target_dir(TargetDir) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
dump_spec(Spec) ->
|
dump_spec(Config, Spec) ->
|
||||||
case rebar_config:get_global(dump_spec, "0") of
|
case rebar_config:get_global(Config, dump_spec, "0") of
|
||||||
"1" ->
|
"1" ->
|
||||||
SpecBin = list_to_binary(io_lib:print(Spec, 1, 120, -1)),
|
SpecBin = list_to_binary(io_lib:print(Spec, 1, 120, -1)),
|
||||||
ok = file:write_file("reltool.spec", SpecBin);
|
ok = file:write_file("reltool.spec", SpecBin);
|
||||||
|
|
|
@ -43,16 +43,16 @@
|
||||||
%% Public API
|
%% Public API
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
'create-app'(_Config, _File) ->
|
'create-app'(Config, _File) ->
|
||||||
%% Alias for create w/ template=simpleapp
|
%% Alias for create w/ template=simpleapp
|
||||||
create("simpleapp").
|
create1(Config, "simpleapp").
|
||||||
|
|
||||||
'create-node'(_Config, _File) ->
|
'create-node'(Config, _File) ->
|
||||||
%% Alias for create w/ template=simplenode
|
%% Alias for create w/ template=simplenode
|
||||||
create("simplenode").
|
create1(Config, "simplenode").
|
||||||
|
|
||||||
'list-templates'(_Config, _File) ->
|
'list-templates'(Config, _File) ->
|
||||||
{AvailTemplates, Files} = find_templates(),
|
{AvailTemplates, Files} = find_templates(Config),
|
||||||
?DEBUG("Available templates: ~p\n", [AvailTemplates]),
|
?DEBUG("Available templates: ~p\n", [AvailTemplates]),
|
||||||
|
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
|
@ -68,9 +68,9 @@
|
||||||
end, AvailTemplates),
|
end, AvailTemplates),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
create(_Config, _) ->
|
create(Config, _) ->
|
||||||
TemplateId = template_id(),
|
TemplateId = template_id(Config),
|
||||||
create(TemplateId).
|
create1(Config, TemplateId).
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% Given a list of key value pairs, for each string value attempt to
|
%% Given a list of key value pairs, for each string value attempt to
|
||||||
|
@ -98,8 +98,8 @@ render(Bin, Context) ->
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%% ===================================================================
|
%% ===================================================================
|
||||||
|
|
||||||
create(TemplateId) ->
|
create1(Config, TemplateId) ->
|
||||||
{AvailTemplates, Files} = find_templates(),
|
{AvailTemplates, Files} = find_templates(Config),
|
||||||
?DEBUG("Available templates: ~p\n", [AvailTemplates]),
|
?DEBUG("Available templates: ~p\n", [AvailTemplates]),
|
||||||
|
|
||||||
%% Using the specified template id, find the matching template file/type.
|
%% Using the specified template id, find the matching template file/type.
|
||||||
|
@ -130,7 +130,7 @@ create(TemplateId) ->
|
||||||
end,
|
end,
|
||||||
|
|
||||||
%% Load variables from disk file, if provided
|
%% Load variables from disk file, if provided
|
||||||
Context1 = case rebar_config:get_global(template_vars, undefined) of
|
Context1 = case rebar_config:get_global(Config, template_vars, undefined) of
|
||||||
undefined ->
|
undefined ->
|
||||||
Context0;
|
Context0;
|
||||||
File ->
|
File ->
|
||||||
|
@ -147,7 +147,7 @@ create(TemplateId) ->
|
||||||
|
|
||||||
%% For each variable, see if it's defined in global vars -- if it is,
|
%% For each variable, see if it's defined in global vars -- if it is,
|
||||||
%% prefer that value over the defaults
|
%% prefer that value over the defaults
|
||||||
Context2 = update_vars(dict:fetch_keys(Context1), Context1),
|
Context2 = update_vars(Config, dict:fetch_keys(Context1), Context1),
|
||||||
?DEBUG("Template ~p context: ~p\n", [TemplateId, dict:to_list(Context1)]),
|
?DEBUG("Template ~p context: ~p\n", [TemplateId, dict:to_list(Context1)]),
|
||||||
|
|
||||||
%% Handle variables that possibly include other variables in their
|
%% Handle variables that possibly include other variables in their
|
||||||
|
@ -163,33 +163,34 @@ create(TemplateId) ->
|
||||||
?DEBUG("Final template def ~p: ~p\n", [TemplateId, FinalTemplate]),
|
?DEBUG("Final template def ~p: ~p\n", [TemplateId, FinalTemplate]),
|
||||||
|
|
||||||
%% Execute the instructions in the finalized template
|
%% Execute the instructions in the finalized template
|
||||||
Force = rebar_config:get_global(force, "0"),
|
Force = rebar_config:get_global(Config, force, "0"),
|
||||||
execute_template(Files, FinalTemplate, Type, Template, Context, Force, []).
|
execute_template(Files, FinalTemplate, Type, Template, Context, Force, []).
|
||||||
|
|
||||||
find_templates() ->
|
find_templates(Config) ->
|
||||||
%% Load a list of all the files in the escript -- cache them since
|
%% Load a list of all the files in the escript -- cache them since
|
||||||
%% we'll potentially need to walk it several times over the course of
|
%% we'll potentially need to walk it several times over the course of
|
||||||
%% a run.
|
%% a run.
|
||||||
Files = cache_escript_files(),
|
Files = cache_escript_files(Config),
|
||||||
|
|
||||||
%% Build a list of available templates
|
%% Build a list of available templates
|
||||||
AvailTemplates = find_disk_templates() ++ find_escript_templates(Files),
|
AvailTemplates = find_disk_templates(Config)
|
||||||
|
++ find_escript_templates(Files),
|
||||||
|
|
||||||
{AvailTemplates, Files}.
|
{AvailTemplates, Files}.
|
||||||
|
|
||||||
%%
|
%%
|
||||||
%% Scan the current escript for available files
|
%% Scan the current escript for available files
|
||||||
%%
|
%%
|
||||||
cache_escript_files() ->
|
cache_escript_files(Config) ->
|
||||||
{ok, Files} = rebar_utils:escript_foldl(
|
{ok, Files} = rebar_utils:escript_foldl(
|
||||||
fun(Name, _, GetBin, Acc) ->
|
fun(Name, _, GetBin, Acc) ->
|
||||||
[{Name, GetBin()} | Acc]
|
[{Name, GetBin()} | Acc]
|
||||||
end,
|
end,
|
||||||
[], rebar_config:get_global(escript, undefined)),
|
[], rebar_config:get_xconf(Config, escript)),
|
||||||
Files.
|
Files.
|
||||||
|
|
||||||
template_id() ->
|
template_id(Config) ->
|
||||||
case rebar_config:get_global(template, undefined) of
|
case rebar_config:get_global(Config, template, undefined) of
|
||||||
undefined ->
|
undefined ->
|
||||||
?ABORT("No template specified.\n", []);
|
?ABORT("No template specified.\n", []);
|
||||||
TemplateId ->
|
TemplateId ->
|
||||||
|
@ -201,16 +202,16 @@ find_escript_templates(Files) ->
|
||||||
|| {Name, _Bin} <- Files,
|
|| {Name, _Bin} <- Files,
|
||||||
re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match].
|
re:run(Name, ?TEMPLATE_RE, [{capture, none}]) == match].
|
||||||
|
|
||||||
find_disk_templates() ->
|
find_disk_templates(Config) ->
|
||||||
OtherTemplates = find_other_templates(),
|
OtherTemplates = find_other_templates(Config),
|
||||||
HomeFiles = rebar_utils:find_files(filename:join([os:getenv("HOME"),
|
HomeFiles = rebar_utils:find_files(filename:join([os:getenv("HOME"),
|
||||||
".rebar", "templates"]),
|
".rebar", "templates"]),
|
||||||
?TEMPLATE_RE),
|
?TEMPLATE_RE),
|
||||||
LocalFiles = rebar_utils:find_files(".", ?TEMPLATE_RE),
|
LocalFiles = rebar_utils:find_files(".", ?TEMPLATE_RE),
|
||||||
[{file, F} || F <- OtherTemplates ++ HomeFiles ++ LocalFiles].
|
[{file, F} || F <- OtherTemplates ++ HomeFiles ++ LocalFiles].
|
||||||
|
|
||||||
find_other_templates() ->
|
find_other_templates(Config) ->
|
||||||
case rebar_config:get_global(template_dir, undefined) of
|
case rebar_config:get_global(Config, template_dir, undefined) of
|
||||||
undefined ->
|
undefined ->
|
||||||
[];
|
[];
|
||||||
TemplateDir ->
|
TemplateDir ->
|
||||||
|
@ -253,11 +254,11 @@ parse_vars(Other, _Dict) ->
|
||||||
%% Given a list of keys in Dict, see if there is a corresponding value defined
|
%% Given a list of keys in Dict, see if there is a corresponding value defined
|
||||||
%% in the global config; if there is, update the key in Dict with it
|
%% in the global config; if there is, update the key in Dict with it
|
||||||
%%
|
%%
|
||||||
update_vars([], Dict) ->
|
update_vars(_Config, [], Dict) ->
|
||||||
Dict;
|
Dict;
|
||||||
update_vars([Key | Rest], Dict) ->
|
update_vars(Config, [Key | Rest], Dict) ->
|
||||||
Value = rebar_config:get_global(Key, dict:fetch(Key, Dict)),
|
Value = rebar_config:get_global(Config, Key, dict:fetch(Key, Dict)),
|
||||||
update_vars(Rest, dict:store(Key, Value, Dict)).
|
update_vars(Config, Rest, dict:store(Key, Value, Dict)).
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
@ -324,8 +325,8 @@ execute_template(_Files, [], _TemplateType, _TemplateName,
|
||||||
_ ->
|
_ ->
|
||||||
Msg = lists:flatten([io_lib:format("\t* ~p~n", [F]) ||
|
Msg = lists:flatten([io_lib:format("\t* ~p~n", [F]) ||
|
||||||
F <- lists:reverse(ExistingFiles)]),
|
F <- lists:reverse(ExistingFiles)]),
|
||||||
Help =
|
Help = "To force overwriting, specify -f/--force/force=1"
|
||||||
"To force overwriting, specify force=1 on the command line.\n",
|
" on the command line.\n",
|
||||||
?ERROR("One or more files already exist on disk and "
|
?ERROR("One or more files already exist on disk and "
|
||||||
"were not generated:~n~s~s", [Msg , Help])
|
"were not generated:~n~s~s", [Msg , Help])
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -41,14 +41,16 @@
|
||||||
'generate-upgrade'(Config0, ReltoolFile) ->
|
'generate-upgrade'(Config0, ReltoolFile) ->
|
||||||
%% Get the old release path
|
%% Get the old release path
|
||||||
{Config, ReltoolConfig} = rebar_rel_utils:load_config(Config0, ReltoolFile),
|
{Config, ReltoolConfig} = rebar_rel_utils:load_config(Config0, ReltoolFile),
|
||||||
TargetParentDir = rebar_rel_utils:get_target_parent_dir(ReltoolConfig),
|
TargetParentDir = rebar_rel_utils:get_target_parent_dir(Config,
|
||||||
TargetDir = rebar_rel_utils:get_target_dir(ReltoolConfig),
|
ReltoolConfig),
|
||||||
|
TargetDir = rebar_rel_utils:get_target_dir(Config, ReltoolConfig),
|
||||||
|
|
||||||
OldVerPath = filename:join([TargetParentDir,
|
PrevRelPath = rebar_rel_utils:get_previous_release_path(Config),
|
||||||
rebar_rel_utils:get_previous_release_path()]),
|
OldVerPath = filename:join([TargetParentDir, PrevRelPath]),
|
||||||
|
|
||||||
%% Run checks to make sure that building a package is possible
|
%% Run checks to make sure that building a package is possible
|
||||||
{NewVerPath, NewName, NewVer} = run_checks(OldVerPath, ReltoolConfig),
|
{NewVerPath, NewName, NewVer} = run_checks(Config, OldVerPath,
|
||||||
|
ReltoolConfig),
|
||||||
NameVer = NewName ++ "_" ++ NewVer,
|
NameVer = NewName ++ "_" ++ NewVer,
|
||||||
|
|
||||||
%% Save the code path prior to doing anything
|
%% Save the code path prior to doing anything
|
||||||
|
@ -78,7 +80,7 @@
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
%% ==================================================================
|
%% ==================================================================
|
||||||
|
|
||||||
run_checks(OldVerPath, ReltoolConfig) ->
|
run_checks(Config, OldVerPath, ReltoolConfig) ->
|
||||||
true = rebar_utils:prop_check(filelib:is_dir(OldVerPath),
|
true = rebar_utils:prop_check(filelib:is_dir(OldVerPath),
|
||||||
"Release directory doesn't exist (~p)~n",
|
"Release directory doesn't exist (~p)~n",
|
||||||
[OldVerPath]),
|
[OldVerPath]),
|
||||||
|
@ -86,8 +88,9 @@ run_checks(OldVerPath, ReltoolConfig) ->
|
||||||
{Name, Ver} = rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
|
{Name, Ver} = rebar_rel_utils:get_reltool_release_info(ReltoolConfig),
|
||||||
|
|
||||||
NewVerPath =
|
NewVerPath =
|
||||||
filename:join([rebar_rel_utils:get_target_parent_dir(ReltoolConfig),
|
filename:join(
|
||||||
Name]),
|
[rebar_rel_utils:get_target_parent_dir(Config, ReltoolConfig),
|
||||||
|
Name]),
|
||||||
true = rebar_utils:prop_check(filelib:is_dir(NewVerPath),
|
true = rebar_utils:prop_check(filelib:is_dir(NewVerPath),
|
||||||
"Release directory doesn't exist (~p)~n",
|
"Release directory doesn't exist (~p)~n",
|
||||||
[NewVerPath]),
|
[NewVerPath]),
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
expand_env_variable/3,
|
expand_env_variable/3,
|
||||||
vcs_vsn/3,
|
vcs_vsn/3,
|
||||||
deprecated/3, deprecated/4,
|
deprecated/3, deprecated/4,
|
||||||
get_deprecated_global/3, get_deprecated_global/4,
|
get_deprecated_global/4, get_deprecated_global/5,
|
||||||
get_deprecated_list/4, get_deprecated_list/5,
|
get_deprecated_list/4, get_deprecated_list/5,
|
||||||
get_deprecated_local/4, get_deprecated_local/5,
|
get_deprecated_local/4, get_deprecated_local/5,
|
||||||
delayed_halt/1,
|
delayed_halt/1,
|
||||||
|
@ -200,7 +200,7 @@ expand_env_variable(InStr, VarName, RawVarValue) ->
|
||||||
|
|
||||||
vcs_vsn(Config, Vcs, Dir) ->
|
vcs_vsn(Config, Vcs, Dir) ->
|
||||||
Key = {Vcs, Dir},
|
Key = {Vcs, Dir},
|
||||||
{ok, Cache} = rebar_config:get_xconf(Config, vsn_cache),
|
Cache = rebar_config:get_xconf(Config, vsn_cache),
|
||||||
case dict:find(Key, Cache) of
|
case dict:find(Key, Cache) of
|
||||||
error ->
|
error ->
|
||||||
VsnString = vcs_vsn_1(Vcs, Dir),
|
VsnString = vcs_vsn_1(Vcs, Dir),
|
||||||
|
@ -211,13 +211,13 @@ vcs_vsn(Config, Vcs, Dir) ->
|
||||||
{Config, VsnString}
|
{Config, VsnString}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_deprecated_global(OldOpt, NewOpt, When) ->
|
get_deprecated_global(Config, OldOpt, NewOpt, When) ->
|
||||||
get_deprecated_global(OldOpt, NewOpt, undefined, When).
|
get_deprecated_global(Config, OldOpt, NewOpt, undefined, When).
|
||||||
|
|
||||||
get_deprecated_global(OldOpt, NewOpt, Default, When) ->
|
get_deprecated_global(Config, OldOpt, NewOpt, Default, When) ->
|
||||||
case rebar_config:get_global(NewOpt, Default) of
|
case rebar_config:get_global(Config, NewOpt, Default) of
|
||||||
Default ->
|
Default ->
|
||||||
case rebar_config:get_global(OldOpt, Default) of
|
case rebar_config:get_global(Config, OldOpt, Default) of
|
||||||
Default ->
|
Default ->
|
||||||
Default;
|
Default;
|
||||||
Old ->
|
Old ->
|
||||||
|
@ -291,7 +291,7 @@ delayed_halt(Code) ->
|
||||||
erl_opts(Config) ->
|
erl_opts(Config) ->
|
||||||
RawErlOpts = filter_defines(rebar_config:get(Config, erl_opts, []), []),
|
RawErlOpts = filter_defines(rebar_config:get(Config, erl_opts, []), []),
|
||||||
GlobalDefines = [{d, list_to_atom(D)} ||
|
GlobalDefines = [{d, list_to_atom(D)} ||
|
||||||
D <- rebar_config:get_global(defines, [])],
|
D <- rebar_config:get_global(Config, defines, [])],
|
||||||
Opts = GlobalDefines ++ RawErlOpts,
|
Opts = GlobalDefines ++ RawErlOpts,
|
||||||
case proplists:is_defined(no_debug_info, Opts) of
|
case proplists:is_defined(no_debug_info, Opts) of
|
||||||
true ->
|
true ->
|
||||||
|
|
|
@ -47,7 +47,7 @@ xref(Config, _) ->
|
||||||
|
|
||||||
xref:set_default(xref, [{warnings,
|
xref:set_default(xref, [{warnings,
|
||||||
rebar_config:get(Config, xref_warnings, false)},
|
rebar_config:get(Config, xref_warnings, false)},
|
||||||
{verbose, rebar_config:is_verbose()}]),
|
{verbose, rebar_config:is_verbose(Config)}]),
|
||||||
|
|
||||||
{ok, _} = xref:add_directory(xref, "ebin"),
|
{ok, _} = xref:add_directory(xref, "ebin"),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue