summaryrefslogtreecommitdiff
path: root/src/rebar_state.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-06-02 18:31:10 -0400
committerFred Hebert <mononcqc@ferd.ca>2015-06-02 18:31:10 -0400
commit2c533d0f45e5b2f93999e5c17c55e90bb46a4ded (patch)
tree7b38b948e05a489633687d5185d1937efc0b7e02 /src/rebar_state.erl
parent94742c40ed93bc786f96418eced67a3b257b372d (diff)
parente4c300417baa15731e0a0239e610a2b87a91172d (diff)
Merge pull request #500 from tsloughter/artifacts
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} ->