Skip to content

Commit

Permalink
Merge pull request #2866 from bjorng/bjorn/eliminate-use-of-code_lib_…
Browse files Browse the repository at this point in the history
…dir_2

Eliminate use of experimental function code:lib_dir/2
  • Loading branch information
ferd authored Feb 22, 2024
2 parents 2f1a67d + 6a847f9 commit 17f6861
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions apps/rebar/src/rebar_compiler_erl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ maybe_expand_include_lib_path(File, Dir) ->
[_] ->
warn_and_find_path(File, Dir);
[Lib | SubDir] ->
case code:lib_dir(list_to_atom(Lib), list_to_atom(filename:join(SubDir))) of
case code:lib_dir(list_to_atom(Lib)) of
{error, bad_name} ->
warn_and_find_path(File, Dir);
AppDir ->
[filename:join(AppDir, File1)]
[filename:join([AppDir] ++ SubDir ++ [File1])]
end
end.

Expand Down
4 changes: 2 additions & 2 deletions apps/rebar/src/rebar_erlc_compiler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -755,11 +755,11 @@ maybe_expand_include_lib_path(File, Dir) ->
[_] ->
warn_and_find_path(File, Dir);
[Lib | SubDir] ->
case code:lib_dir(list_to_atom(Lib), list_to_atom(filename:join(SubDir))) of
case code:lib_dir(list_to_atom(Lib)) of
{error, bad_name} ->
warn_and_find_path(File, Dir);
AppDir ->
[filename:join(AppDir, File1)]
[filename:join([AppDir] ++ SubDir ++ [File1])]
end
end.

Expand Down
7 changes: 4 additions & 3 deletions apps/rebar/src/rebar_prv_dialyzer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,14 @@ app_files(AppName, ExtraDirs) ->
end.

app_ebin(AppName) ->
case code:lib_dir(AppName, ebin) of
case code:lib_dir(AppName) of
{error, bad_name} = Error ->
Error;
EbinDir ->
AppDir ->
EbinDir = filename:join(AppDir, "ebin"),
case check_ebin(EbinDir) of
{error, bad_name} ->
check_ebin(filename:join(code:lib_dir(AppName), "preloaded/ebin"));
check_ebin(filename:join(AppDir, "preloaded/ebin"));
Response ->
Response
end
Expand Down
5 changes: 3 additions & 2 deletions apps/rebar/src/rebar_prv_escriptize.erl
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,11 @@ get_apps_beams([App | Rest], AllApps, Acc) ->
Beams = get_app_beams(App, OutDir),
get_apps_beams(Rest, AllApps, Beams ++ Acc);
_->
case code:lib_dir(App, ebin) of
case code:lib_dir(App) of
{error, bad_name} ->
throw(?PRV_ERROR({bad_name, App}));
Path ->
AppDir ->
Path = filename:join(AppDir, "ebin"),
Beams = get_app_beams(App, Path),
get_apps_beams(Rest, AllApps, Beams ++ Acc)
end
Expand Down
2 changes: 1 addition & 1 deletion vendor/relx/src/rlx_assemble.erl
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ maybe_check_for_undefined_functions_(State, Release) ->
%% without adding the erts application there will be warnings about
%% missing functions from the preloaded modules even though they
%% are in the runtime.
ErtsApp = code:lib_dir(erts, ebin),
ErtsApp = filename:join(code:lib_dir(erts), "ebin"),

%% xref library path is what is searched for functions used by the
%% project apps.
Expand Down

0 comments on commit 17f6861

Please sign in to comment.