Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

64 lignes
1.6 KiB

  1. % This file is part of Jiffy released under the MIT license.
  2. % See the LICENSE file for more information.
  3. % Only include PropEr as a dependency when the JIFFY_DEV
  4. % environment variable is defined. This allows downstream
  5. % applications to avoid requiring PropEr.
  6. %
  7. % This script is based on the example provided with Rebar.
  8. IsRebar3 = erlang:function_exported(rebar3, main, 1),
  9. PropErUrl = "git://github.com/manopapad/proper.git",
  10. IsDevEnv = begin
  11. ConfigPath = filename:dirname(SCRIPT),
  12. DevMarker = filename:join([ConfigPath, ".jiffy.dev"]),
  13. filelib:is_file(DevMarker)
  14. end.
  15. Deps = if not IsDevEnv -> []; true ->
  16. case IsRebar3 of
  17. true -> [proper];
  18. false -> [{proper, ".*", {git, PropErUrl, {branch, "master"}}}]
  19. end
  20. end,
  21. ErlOpts = if not IsDevEnv -> []; true ->
  22. [{d, 'JIFFY_DEV'}]
  23. end,
  24. Plugins = case IsRebar3 of
  25. true -> [pc];
  26. false -> [rebar_gdb_plugin]
  27. end,
  28. ProviderHooks = if not IsRebar3 -> []; true ->
  29. [{pre, [
  30. {compile, {pc, compile}},
  31. {clean, {pc, clean}}
  32. ]}]
  33. end,
  34. OptsToAdd = [
  35. {deps, Deps},
  36. {erl_opts, ErlOpts},
  37. {plugins, Plugins},
  38. {provider_hooks, ProviderHooks}
  39. ],
  40. AddOpt = fun(Name, Value, Config) when is_list(Value) ->
  41. case lists:keyfind(Name, 1, Config) of
  42. {Name, CurrVal} when is_list(CurrVal) ->
  43. lists:keyreplace(Name, 1, Config, {Name, CurrVal ++ Value});
  44. false ->
  45. Config ++ [{Name, Value}];
  46. _ ->
  47. Config
  48. end
  49. end,
  50. lists:foldl(fun({Name, Value}, CfgAcc) ->
  51. AddOpt(Name, Value, CfgAcc)
  52. end, CONFIG, OptsToAdd).