rebar.config.script 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. %% -*- mode: erlang -*-
  2. Patch = fun (Key, Value, Config) ->
  3. case lists:keysearch(Key, 1, Config) of
  4. {value, {_, Org}} ->
  5. lists:keyreplace(Key, 1, Config, {Key, Org ++ Value});
  6. false ->
  7. [{Key, Value}|Config]
  8. end
  9. end,
  10. application:load(syntax_tools),
  11. case application:get_key(syntax_tools, vsn) of
  12. {ok, Vsn} when "1.7" > Vsn ->
  13. Deps = [{merl, ".*",
  14. {git, "git://github.com/erlydtl/merl.git", {branch, "erlydtl"}},
  15. [raw]}],
  16. PreHooks =
  17. [{"(linux|darwin|solaris)", compile, "make -C \"$REBAR_DEPS_DIR/merl\" all -W test"},
  18. {"(freebsd|netbsd|openbsd)", compile, "gmake -C \"$REBAR_DEPS_DIR/merl\" all"},
  19. {"win32", compile, "make -C \"%REBAR_DEPS_DIR%/merl\" all -W test"},
  20. {"(linux|darwin|solaris)", eunit, "make -C \"$REBAR_DEPS_DIR/merl\" test"},
  21. {"(freebsd|netbsd|openbsd)", eunit, "gmake -C \"$REBAR_DEPS_DIR/merl\" test"},
  22. {"win32", eunit, "make -C \"%REBAR_DEPS_DIR%/merl\" test"}],
  23. lists:foldl(fun ({K, V}, C) -> Patch(K, V, C) end, CONFIG,
  24. [{deps, Deps},
  25. {pre_hooks, PreHooks},
  26. {erl_opts, [{d, 'MERL_DEP'}]}]);
  27. _ ->
  28. CONFIG
  29. end.