diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rcl_cmd_args.erl | 9 | ||||
-rw-r--r-- | src/rcl_prv_discover.erl | 29 | ||||
-rw-r--r-- | src/rcl_state.erl | 4 | ||||
-rw-r--r-- | src/relcool.erl | 6 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/rcl_cmd_args.erl b/src/rcl_cmd_args.erl index 9d829d3..6340201 100644 --- a/src/rcl_cmd_args.erl +++ b/src/rcl_cmd_args.erl @@ -170,11 +170,16 @@ create_root_dir(Opts, Acc) -> case Dir of undefined -> {ok, Cwd} = file:get_cwd(), - {ok, [{root_dir, Cwd} | Acc]}; + create_disable_default_libs(Opts, [{root_dir, Cwd} | Acc]); _ -> - {ok, [{root_dir, Dir} | Acc]} + create_disable_default_libs(Opts, [{root_dir, Dir} | Acc]) end. +-spec create_disable_default_libs([getopt:option()], rcl_state:cmd_args()) -> + {ok, rcl_state:cmd_args()} | relcool:error(). +create_disable_default_libs(Opts, Acc) -> + Def = proplists:get_value(disable_default_libs, Opts, false), + {ok, [{disable_default_libs, Def} | Acc]}. -spec check_lib_dirs([string()]) -> ok | relcool:error(). check_lib_dirs([]) -> diff --git a/src/rcl_prv_discover.erl b/src/rcl_prv_discover.erl index 6ff50ed..4e7ce72 100644 --- a/src/rcl_prv_discover.erl +++ b/src/rcl_prv_discover.erl @@ -112,29 +112,20 @@ setup_overrides(State, AppMetas0) -> get_lib_dirs(State) -> LibDirs0 = rcl_state:lib_dirs(State), - add_rebar_deps_dir(State, LibDirs0). - --spec add_rebar_deps_dir(rcl_state:t(), [file:name()]) -> [file:name()]. -add_rebar_deps_dir(State, LibDirs) -> - ExcludeRebar = rcl_state:get(State, discover_exclude_rebar, false), - case ExcludeRebar of + case rcl_state:get(State, disable_default_libs, false) of true -> - add_system_lib_dir(State, LibDirs); + LibDirs0; false -> - %% Check to see if there is a rebar.config. If so then look for a deps - %% dir. If both are there then we add that to the lib dirs. - Root = rcl_state:root_dir(State), - - RebarConfig = filename:join([Root, "rebar.config"]), - DepsDir = filename:join([Root, "deps"]), - case filelib:is_regular(RebarConfig) andalso filelib:is_dir(DepsDir) of - true -> - add_system_lib_dir(State, [filename:absname(Root) | LibDirs]); - false -> - add_system_lib_dir(State, LibDirs) - end + add_current_dir(State, LibDirs0) end. +-spec add_current_dir(rcl_state:t(), [file:name()]) -> [file:name()]. +add_current_dir(State, LibDirs) -> + %% Check to see if there is a rebar.config. If so then look for a deps + %% dir. If both are there then we add that to the lib dirs. + Root = rcl_state:root_dir(State), + add_system_lib_dir(State, [filename:absname(Root) | LibDirs]). + -spec add_system_lib_dir(rcl_state:t(), [file:name()]) -> [file:name()]. add_system_lib_dir(State, LibDirs) -> ExcludeSystem = rcl_state:get(State, discover_exclude_system, false), diff --git a/src/rcl_state.erl b/src/rcl_state.erl index 28effbd..842b635 100644 --- a/src/rcl_state.erl +++ b/src/rcl_state.erl @@ -108,7 +108,9 @@ new(PropList, Target) when erlang:is_list(PropList) -> root_dir = proplists:get_value(root_dir, PropList, Root), default_release={proplists:get_value(relname, PropList, undefined), proplists:get_value(relvsn, PropList, undefined)}}, - create_logic_providers(State0). + rcl_state:put(create_logic_providers(State0), + disable_default_libs, + proplists:get_value(disable_default_libs, PropList, false)). %% @doc the application overrides for the system -spec overrides(t()) -> [{AppName::atom(), Directory::file:filename()}]. diff --git a/src/relcool.erl b/src/relcool.erl index 9fb9240..a6b30a3 100644 --- a/src/relcool.erl +++ b/src/relcool.erl @@ -113,8 +113,7 @@ do(RootDir, RelName, RelVsn, Goals, LibDirs, LogLevel, OutputDir, Overrides, Con -spec opt_spec_list() -> [getopt:option_spec()]. opt_spec_list() -> - [ - {relname, $n, "relname", string, + [{relname, $n, "relname", string, "Specify the name for the release that will be generated"}, {relvsn, $v, "relvsn", string, "Specify the version for the release"}, {goals, $g, "goal", string, @@ -123,6 +122,9 @@ opt_spec_list() -> "The output directory for the release. This is `./` by default."}, {lib_dir, $l, "lib-dir", string, "Additional dirs that should be searched for OTP Apps"}, + {disable_default_libs, undefined, "disable-default-libs", + {boolean, false}, + "Disable the default system added lib dirs (means you must add them all manually"}, {log_level, $V, "verbose", {integer, 0}, "Verbosity level, maybe between 0 and 2"}, {root_dir, $r, "root", string, "The project root directory"}]. |