From dcc2741b6026a66c457fd2193cda8a42a3874839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 9 May 2023 17:11:22 +0200 Subject: Autopatch: better handle COMPILE_FIRST/erl_first_files This is still a bit hackish but it appears that some projects have wrong erl_first_files entries (module exists but not at the location configured) and so we have to do a bit of manipulation before we can find the module. We also need to be cautious about .yrl/.xrl because their corresponding .erl files may not exist in the repository before compilation yet can be listed in erl_first_files. --- core/deps.mk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/deps.mk b/core/deps.mk index 5b01b8d..c848224 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -468,13 +468,16 @@ define dep_autopatch_rebar.erl fun() -> case lists:keyfind(erl_first_files, 1, Conf) of false -> ok; - {_, Files} -> + {_, Files0} -> + Files = [begin + hd(filelib:wildcard("$(call core_native_path,$(DEPS_DIR)/$1/src/**/" ++ filename:rootname(F) ++ ".*rl"))) + end || "src/" ++ F <- Files0], Names = [[" ", case lists:reverse(F) of "lre." ++ Elif -> lists:reverse(Elif); "lrx." ++ Elif -> lists:reverse(Elif); "lry." ++ Elif -> lists:reverse(Elif); Elif -> lists:reverse(Elif) - end] || "src/" ++ F <- Files], + end] || "$(call core_native_path,$(DEPS_DIR)/$1/src/)" ++ F <- Files], Write(io_lib:format("COMPILE_FIRST +=~s\n", [Names])) end end(), -- cgit v1.2.3