From a3ce939ec5a1c88fe7433bf67503eec9ba614d63 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Tue, 2 Jun 2015 09:13:47 -0500 Subject: add config option artifacts --- src/rebar_prv_compile.erl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/rebar_prv_compile.erl') 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 -- cgit v1.1