diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2016-06-12 13:43:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-12 13:43:56 -0400 |
commit | db8dbdfbcf886283a43a9decd02fd370c2ba9d59 (patch) | |
tree | 49343b193cced99e09ccf0b0a9443e007ca8a4b7 /src | |
parent | 095af3bfcae9e72a6197f7bf732c8612aab70ce1 (diff) | |
parent | dfec27a1cd2ee28318187674a1461d6f6d17de35 (diff) |
Merge pull request #1233 from talentdeficit/REBAR-1199
normalize include dirs to absolute paths during compilation
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_erlc_compiler.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index bdd1868..167f2bb 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -200,7 +200,7 @@ compile_dirs(RebarOpts, BaseDir, SrcDirs, OutDir, Opts) -> ok = filelib:ensure_dir(filename:join(OutDir, "dummy.beam")), true = code:add_patha(filename:absname(OutDir)), - G = init_erlcinfo(proplists:get_all_values(i, ErlOpts), AllErlFiles, BaseDir, OutDir), + G = init_erlcinfo(include_abs_dirs(ErlOpts, BaseDir), AllErlFiles, BaseDir, OutDir), NeededErlFiles = needed_files(G, ErlOpts, BaseDir, OutDir, AllErlFiles), {ErlFirstFiles, ErlOptsFirst} = erl_first_files(RebarOpts, ErlOpts, BaseDir, NeededErlFiles), @@ -387,7 +387,7 @@ maybe_rm_beams_and_edges(G, Dir, Files) -> source_and_include_dirs(InclDirs, Erls) -> SourceDirs = lists:map(fun filename:dirname/1, Erls), - lists:usort(["include" | InclDirs ++ SourceDirs]). + lists:usort(InclDirs ++ SourceDirs). update_erlcinfo(G, Dirs, Source) -> case digraph:vertex(G, Source) of @@ -503,7 +503,6 @@ expand_file_names(Files, Dirs) -> end end, Files). - -spec internal_erl_compile(rebar_dict(), file:filename(), file:filename(), file:filename(), list()) -> ok | {ok, any()} | {error, any(), any()}. internal_erl_compile(Opts, Dir, Module, OutDir, ErlOpts) -> @@ -738,6 +737,10 @@ outdir(RebarOpts) -> ErlOpts = rebar_opts:erl_opts(RebarOpts), proplists:get_value(outdir, ErlOpts, ?DEFAULT_OUTDIR). +include_abs_dirs(ErlOpts, BaseDir) -> + InclDirs = ["include"|proplists:get_all_values(i, ErlOpts)], + lists:map(fun(Incl) -> filename:join([BaseDir, Incl]) end, InclDirs). + parse_opts(Opts) -> parse_opts(Opts, #compile_opts{}). parse_opts([], CompileOpts) -> CompileOpts; |