Skip to content

Commit

Permalink
Merge pull request #1953 from tsloughter/subdirs-modules
Browse files Browse the repository at this point in the history
fix to include beams built from src files in subdirs in modules list
  • Loading branch information
ferd authored Nov 24, 2018
2 parents 86922f0 + a90f84a commit 515283a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
{erl_opts, [{platform_define, "^[0-9]+", namespaced_types},
{platform_define, "^(19|2)", rand_only},
{platform_define, "^2", unicode_str},
{platform_define, "^2", filelib_find_source},
{platform_define, "^(2[1-9])|(20\\\\.3)", filelib_find_source},
{platform_define, "^(R|1|20)", fun_stacktrace},
warnings_as_errors
]}.
Expand Down
2 changes: 1 addition & 1 deletion src/rebar_otp_app.erl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ebin_modules(AppInfo, Dir) ->
Beams = lists:sort(rebar_utils:beams(filename:join(Dir, "ebin"))),
SrcDirs = rebar_dir:src_dirs(rebar_app_info:opts(AppInfo), ["src"]),
FindSourceRules = [{".beam", ".erl",
[{"ebin", SrcDir} || SrcDir <- SrcDirs]}],
[{"ebin", filename:join(SrcDir, "**")} || SrcDir <- SrcDirs]}],
Filtered = lists:filter(fun(Beam) ->
rebar_utils:find_source(filename:basename(Beam),
filename:dirname(Beam),
Expand Down
8 changes: 7 additions & 1 deletion test/rebar_compile_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,13 @@ recursive(Config) ->

EbinDir = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]),
{ok, Files} = rebar_utils:list_dir(EbinDir),
?assert(lists:member("rec.beam",Files)).
?assert(lists:member("rec.beam",Files)),

%% check that rec is in modules list of .app file
AppFile = filename:join(EbinDir, Name++".app"),
{ok, [{application, _, List}]} = file:consult(AppFile),
{modules, Modules} = lists:keyfind(modules, 1, List),
?assert(lists:member(rec, Modules)).

no_recursive(Config) ->
AppDir = ?config(apps, Config),
Expand Down

0 comments on commit 515283a

Please sign in to comment.