diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_app_discover.erl | 27 | ||||
-rw-r--r-- | src/rebar_app_info.erl | 9 | ||||
-rw-r--r-- | src/rebar_prv_clean.erl | 9 | ||||
-rw-r--r-- | src/rebar_prv_compile.erl | 10 | ||||
-rw-r--r-- | src/rebar_prv_eunit.erl | 9 | ||||
-rw-r--r-- | src/rebar_prv_tar.erl | 2 |
6 files changed, 33 insertions, 33 deletions
diff --git a/src/rebar_app_discover.erl b/src/rebar_app_discover.erl index e2ef179..332efb0 100644 --- a/src/rebar_app_discover.erl +++ b/src/rebar_app_discover.erl @@ -20,13 +20,19 @@ do(State, LibDirs) -> %% Sort apps so we get the same merged deps config everytime SortedApps = rebar_utils:sort_deps(Apps), lists:foldl(fun(AppInfo, StateAcc) -> - {AppInfo1, StateAcc1} = merge_deps(AppInfo, StateAcc), - Name = rebar_app_info:name(AppInfo), - OutDir = filename:join(DepsDir, Name), - AppInfo2 = rebar_app_info:out_dir(AppInfo1, OutDir), - ProjectDeps1 = lists:delete(Name, ProjectDeps), - rebar_state:project_apps(StateAcc1 - ,rebar_app_info:deps(AppInfo2, ProjectDeps1)) + Name = rebar_app_info:name(AppInfo), + case enable(State, AppInfo) of + true -> + {AppInfo1, StateAcc1} = merge_deps(AppInfo, StateAcc), + OutDir = filename:join(DepsDir, Name), + AppInfo2 = rebar_app_info:out_dir(AppInfo1, OutDir), + ProjectDeps1 = lists:delete(Name, ProjectDeps), + rebar_state:project_apps(StateAcc1 + ,rebar_app_info:deps(AppInfo2, ProjectDeps1)); + false -> + ?INFO("Ignoring ~s", [Name]), + StateAcc + end end, State, SortedApps). format_error({module_list, File}) -> @@ -211,3 +217,10 @@ try_handle_app_src_file(_, AppDir, [File], Validate) when Validate =:= invalid end; try_handle_app_src_file(_, _AppDir, Other, _Validate) -> throw({error, {multiple_app_files, Other}}). + +enable(State, AppInfo) -> + not lists:member(to_atom(rebar_app_info:name(AppInfo)), + rebar_state:get(State, excluded_apps, [])). + +to_atom(Bin) -> + list_to_atom(binary_to_list(Bin)). diff --git a/src/rebar_app_info.erl b/src/rebar_app_info.erl index 1b87e0b..9db20e7 100644 --- a/src/rebar_app_info.erl +++ b/src/rebar_app_info.erl @@ -34,6 +34,7 @@ source/2, state/1, state/2, + state_or_new/2, is_lock/1, is_lock/2, is_checkout/1, @@ -260,6 +261,14 @@ state(AppInfo=#app_info_t{}, State) -> state(#app_info_t{state=State}) -> State. +-spec state_or_new(rebar_state:t(), t()) -> rebar_state:t(). +state_or_new(State, AppInfo=#app_info_t{state=undefined}) -> + AppDir = dir(AppInfo), + C = rebar_config:consult(AppDir), + rebar_state:new(State, C, AppDir); +state_or_new(_State, #app_info_t{state=State}) -> + State. + -spec is_lock(t(), boolean()) -> t(). is_lock(AppInfo=#app_info_t{}, IsLock) -> AppInfo#app_info_t{is_lock=IsLock}. diff --git a/src/rebar_prv_clean.erl b/src/rebar_prv_clean.erl index 272ac26..666ae13 100644 --- a/src/rebar_prv_clean.erl +++ b/src/rebar_prv_clean.erl @@ -67,16 +67,9 @@ format_error(Reason) -> clean_apps(State, Providers, Apps) -> lists:foreach(fun(AppInfo) -> AppDir = rebar_app_info:dir(AppInfo), - S = case rebar_app_info:state(AppInfo) of - undefined -> - C = rebar_config:consult(AppDir), - rebar_state:new(State, C, AppDir); - AppState -> - AppState - end, + S = rebar_app_info:state_or_new(State, AppInfo), ?INFO("Cleaning out ~s...", [rebar_app_info:name(AppInfo)]), - %% Legacy hook support rebar_hooks:run_all_hooks(AppDir, pre, ?PROVIDER, Providers, S), rebar_erlc_compiler:clean(State, rebar_app_info:out_dir(AppInfo)), rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, S) diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index 5a2e379..4a0fea8 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -71,17 +71,9 @@ build_apps(State, Providers, Apps) -> build_app(State, Providers, AppInfo) -> AppDir = rebar_app_info:dir(AppInfo), OutDir = rebar_app_info:out_dir(AppInfo), - copy_app_dirs(State, AppDir, OutDir), - S = case rebar_app_info:state(AppInfo) of - undefined -> - C = rebar_config:consult(AppDir), - rebar_state:new(State, C, AppDir); - AppState -> - AppState - end, - + S = rebar_app_info:state_or_new(State, AppInfo), compile(S, Providers, AppInfo). compile(State, Providers, AppInfo) -> diff --git a/src/rebar_prv_eunit.erl b/src/rebar_prv_eunit.erl index 3ad593d..ff871c8 100644 --- a/src/rebar_prv_eunit.erl +++ b/src/rebar_prv_eunit.erl @@ -134,14 +134,7 @@ resolve_suites(State, Apps, RawOpts) -> compile_tests(State, TestApps, Suites, RawOpts) -> F = fun(AppInfo) -> - AppDir = rebar_app_info:dir(AppInfo), - S = case rebar_app_info:state(AppInfo) of - undefined -> - C = rebar_config:consult(AppDir), - rebar_state:new(State, C, AppDir); - AppState -> - AppState - end, + S = rebar_app_info:state_or_new(State, AppInfo), ok = rebar_erlc_compiler:compile(replace_src_dirs(S), ec_cnv:to_list(rebar_app_info:out_dir(AppInfo))) end, diff --git a/src/rebar_prv_tar.erl b/src/rebar_prv_tar.erl index f7557bd..78c2b0f 100644 --- a/src/rebar_prv_tar.erl +++ b/src/rebar_prv_tar.erl @@ -47,7 +47,7 @@ do(State) -> ,{caller, Caller}], AllOptions); Config -> relx:main([{lib_dirs, LibDirs} - ,{config, Config} + ,{config, lists:reverse(Config)} ,{output_dir, OutputDir} ,{caller, Caller}], AllOptions) end, |