Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

41 righe
1.4 KiB

  1. %% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
  2. %% ex: ts=4 sw=4 et
  3. -module(rebar_prv_app_discovery).
  4. -behaviour(provider).
  5. -export([init/1,
  6. do/1,
  7. format_error/1]).
  8. -include("rebar.hrl").
  9. -define(PROVIDER, app_discovery).
  10. -define(DEPS, []).
  11. %% ===================================================================
  12. %% Public API
  13. %% ===================================================================
  14. -spec init(rebar_state:t()) -> {ok, rebar_state:t()}.
  15. init(State) ->
  16. State1 = rebar_state:add_provider(State, providers:create([{name, ?PROVIDER},
  17. {module, ?MODULE},
  18. {bare, true},
  19. {deps, ?DEPS},
  20. {example, ""},
  21. {short_desc, ""},
  22. {desc, ""},
  23. {opts, []}])),
  24. {ok, State1}.
  25. -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
  26. do(State) ->
  27. LibDirs = rebar_state:get(State, lib_dirs, ?DEFAULT_LIB_DIRS),
  28. State1 = rebar_app_discover:do(State, LibDirs),
  29. {ok, State1}.
  30. -spec format_error(any()) -> iolist().
  31. format_error(Reason) ->
  32. io_lib:format("~p", [Reason]).