aboutsummaryrefslogtreecommitdiffstats
path: root/core/deps.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-16 15:27:23 +0300
committerLoïc Hoguin <[email protected]>2015-05-16 15:27:23 +0300
commit21ed404df9b353bafe328fb0c69cf1134ae14d0a (patch)
treeb21c9f1f26a8cd98fb47131cc46979dd2531b01a /core/deps.mk
parentbcb1ed7963abc9474174b7630df0a6ce66d74231 (diff)
downloaderlang.mk-21ed404df9b353bafe328fb0c69cf1134ae14d0a.tar.gz
erlang.mk-21ed404df9b353bafe328fb0c69cf1134ae14d0a.tar.bz2
erlang.mk-21ed404df9b353bafe328fb0c69cf1134ae14d0a.zip
Initial rebar2 plugins support
We do nothing more than what is necessary to make riak_pb work. It's possible other plugins will not work, however this is the only plugin that I have seen to be required so far, and hook plugins seem to have been removed from rebar3, so it should be fine.
Diffstat (limited to 'core/deps.mk')
-rw-r--r--core/deps.mk20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/deps.mk b/core/deps.mk
index dfbe5ce..820f72a 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -260,6 +260,26 @@ define dep_autopatch_rebar.erl
Write("\n\nCFLAGS := $$$$\(filter-out -std=c99 -Wmissing-prototypes,$$$$\(CFLAGS\)\)\n")
end
end(),
+ fun() ->
+ case lists:keyfind(plugins, 1, Conf) of
+ {_, [Plugin]} when is_atom(Plugin) ->
+ ErlFile = "$(DEPS_DIR)/$(1)/plugins/" ++ atom_to_list(Plugin) ++ ".erl",
+ try
+ {ok, PF} = file:read_file(ErlFile),
+ PF2 = re:replace(PF, "rebar_utils:find_files", "find_files", [global, {return, list}]),
+ PF3 = PF2 ++ "find_files(Dir, Regex) ->
+ filelib:fold_files(Dir, Regex, true, fun(F, Acc) -> [F|Acc] end, []).",
+ ok = file:write_file(ErlFile, PF3),
+ {ok, Mod, Bin} = compile:file(ErlFile, [binary]),
+ {module, Mod} = code:load_binary(Mod, ErlFile, Bin),
+ c:cd("$(DEPS_DIR)/$(1)/"),
+ ok = Mod:pre_compile(Conf, undefined)
+ catch _:_ ->
+ ok
+ end;
+ _ -> ok
+ end
+ end(),
halt()
endef