summaryrefslogtreecommitdiff
path: root/src/rebar_state.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-06-02 09:13:47 -0500
committerTristan Sloughter <t@crashfast.com>2015-06-02 09:13:47 -0500
commita3ce939ec5a1c88fe7433bf67503eec9ba614d63 (patch)
treece9a4699afee8e6da396583ce53b1ea8a81216cc /src/rebar_state.erl
parentea07a7c65c194ff4e6f3a03dde424a8b1b035d8c (diff)
add config option artifacts
Diffstat (limited to 'src/rebar_state.erl')
-rw-r--r--src/rebar_state.erl19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 96daf39..5b59eeb 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -3,6 +3,8 @@
-export([new/0, new/1, new/2, new/3,
get/2, get/3, set/3,
+ has_all_artifacts/1,
+
code_paths/2, code_paths/3, update_code_paths/3,
opts/1, opts/2,
@@ -149,6 +151,23 @@ default(#state_t{default=Opts}) ->
default(State, Opts) ->
State#state_t{default=Opts}.
+-spec has_all_artifacts(rebar_app_info:t()) -> true | providers:error().
+has_all_artifacts(State) ->
+ Artifacts = rebar_state:get(State, artifacts, []),
+ Dir = rebar_dir:base_dir(State),
+ all(Dir, Artifacts).
+
+all(_, []) ->
+ true;
+all(Dir, [File|Artifacts]) ->
+ case filelib:is_regular(filename:join(Dir, File)) of
+ false ->
+ ?DEBUG("Missing artifact ~s", [filename:join(Dir, File)]),
+ {false, File};
+ true ->
+ all(Dir, Artifacts)
+ end.
+
code_paths(#state_t{code_paths=CodePaths}, Key) ->
case dict:find(Key, CodePaths) of
{ok, CodePath} ->