aboutsummaryrefslogtreecommitdiffstats
path: root/core/deps.mk
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2015-05-17 19:59:59 +0300
committerLoïc Hoguin <[email protected]>2015-05-17 19:59:59 +0300
commitcb1031957e0a0a627f15ed1ac9f1bff5fc316e7d (patch)
treeeb6ed29450e07a0777a2ba9f519b9700e6a7ef77 /core/deps.mk
parent82e962a02bd8e6206249260452c7e0cd4fd83a37 (diff)
downloaderlang.mk-cb1031957e0a0a627f15ed1ac9f1bff5fc316e7d.tar.gz
erlang.mk-cb1031957e0a0a627f15ed1ac9f1bff5fc316e7d.tar.bz2
erlang.mk-cb1031957e0a0a627f15ed1ac9f1bff5fc316e7d.zip
Improve detection of compile first files for rebar apps
File includes header that defines parse_transform that imports function. Sigh.
Diffstat (limited to 'core/deps.mk')
-rw-r--r--core/deps.mk11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 68430bc..ade91a5 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -202,6 +202,11 @@ define dep_autopatch_rebar.erl
{ok, {attribute, _, include_lib, "$(1)/include/" ++ Hrl}, _} ->
{ok, HrlFd} = file:open("$(DEPS_DIR)/$(1)/include/" ++ Hrl, [read]),
[F(F, HrlFd), F(F, Fd)];
+ {ok, {attribute, _, import, {Imp, _}}, _} ->
+ case file:open("$(DEPS_DIR)/$(1)/src/" ++ atom_to_list(Imp) ++ ".erl", [read]) of
+ {ok, ImpFd} -> [Imp, F(F, ImpFd), F(F, Fd)];
+ _ -> [F(F, Fd)]
+ end;
{eof, _} ->
file:close(Fd),
[];
@@ -211,10 +216,14 @@ define dep_autopatch_rebar.erl
end,
fun() ->
ErlFiles = filelib:wildcard("$(DEPS_DIR)/$(1)/src/*.erl"),
- First = lists:usort(lists:flatten([begin
+ First0 = lists:usort(lists:flatten([begin
{ok, Fd} = file:open(F, [read]),
FindFirst(FindFirst, Fd)
end || F <- ErlFiles])),
+ First = lists:flatten([begin
+ {ok, Fd} = file:open("$(DEPS_DIR)/$(1)/src/" ++ atom_to_list(F) ++ ".erl", [read]),
+ FindFirst(FindFirst, Fd)
+ end || F <- First0]) ++ First0,
Write(["COMPILE_FIRST +=", [[" ", atom_to_list(M)] || M <- First,
lists:member("$(DEPS_DIR)/$(1)/src/" ++ atom_to_list(M) ++ ".erl", ErlFiles)], "\n"])
end(),