diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-06-02 18:31:10 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-06-02 18:31:10 -0400 |
commit | 2c533d0f45e5b2f93999e5c17c55e90bb46a4ded (patch) | |
tree | 7b38b948e05a489633687d5185d1937efc0b7e02 /src/rebar_prv_compile.erl | |
parent | 94742c40ed93bc786f96418eced67a3b257b372d (diff) | |
parent | e4c300417baa15731e0a0239e610a2b87a91172d (diff) |
Merge pull request #500 from tsloughter/artifacts
add config option artifacts
Diffstat (limited to 'src/rebar_prv_compile.erl')
-rw-r--r-- | src/rebar_prv_compile.erl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/rebar_prv_compile.erl b/src/rebar_prv_compile.erl index 2737827..6eb8a4f 100644 --- a/src/rebar_prv_compile.erl +++ b/src/rebar_prv_compile.erl @@ -8,6 +8,7 @@ -export([compile/3]). +-include_lib("providers/include/providers.hrl"). -include("rebar.hrl"). -define(PROVIDER, compile). @@ -60,12 +61,15 @@ do(State) -> State3 = rebar_state:code_paths(State2, all_deps, DepsPaths ++ ProjAppsPaths), rebar_hooks:run_all_hooks(Cwd, post, ?PROVIDER, Providers, State2), + has_all_artifacts(State3), rebar_utils:cleanup_code_path(rebar_state:code_paths(State3, default)), {ok, State3}. -spec format_error(any()) -> iolist(). +format_error({missing_artifact, File}) -> + io_lib:format("Missing artifact ~s", [File]); format_error(Reason) -> io_lib:format("~p", [Reason]). @@ -90,6 +94,7 @@ compile(State, Providers, AppInfo) -> case rebar_otp_app:compile(State, AppInfo) of {ok, AppInfo1} -> rebar_hooks:run_all_hooks(AppDir, post, ?PROVIDER, Providers, State), + has_all_artifacts(State), AppInfo1; Error -> throw(Error) @@ -99,6 +104,14 @@ compile(State, Providers, AppInfo) -> %% Internal functions %% =================================================================== +has_all_artifacts(State) -> + case rebar_state:has_all_artifacts(State) of + {false, File} -> + throw(?PRV_ERROR({missing_artifact, File})); + true -> + true + end. + copy_app_dirs(State, OldAppDir, AppDir) -> case ec_cnv:to_binary(filename:absname(OldAppDir)) =/= ec_cnv:to_binary(filename:absname(AppDir)) of |