diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2017-07-13 18:01:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 18:01:16 -0400 |
commit | 2326ad016c5e9ef941ae81e9b11a4cfedf15ff6f (patch) | |
tree | 5051ee0e53667f71aae5e96a4f036fe586a1eb37 /src | |
parent | 3f21c8dc9fcfff24538faa2812679711f3f816c1 (diff) | |
parent | 15ea087336ffe377dd1cbaf09806594dbeea3b67 (diff) |
Merge pull request #1584 from tsloughter/erl_opts_recompile
recompile only if new option effects code generation
Diffstat (limited to 'src')
-rw-r--r-- | src/rebar_erlc_compiler.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index f7244dc..9157aba 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -279,7 +279,7 @@ gather_src(Opts, BaseDirParts, [Dir|Rest], Srcs, CompileOpts) -> end, DirRecursive = dir_recursive(Opts, RelDir, CompileOpts), gather_src(Opts, BaseDirParts, Rest, Srcs ++ rebar_utils:find_files(Dir, ?RE_PREFIX".*\\.erl\$", DirRecursive), CompileOpts). - + %% Get files which need to be compiled first, i.e. those specified in erl_first_files %% and parse_transform options. Also produce specific erl_opts for these first %% files, so that yet to be compiled parse transformations are excluded from it. @@ -351,10 +351,25 @@ opts_changed(NewOpts, Target) -> false -> NewOpts end, case compile_info(Target) of - {ok, Opts} -> lists:sort(Opts) =/= lists:sort(TotalOpts); + {ok, Opts} -> lists:any(fun effects_code_generation/1, lists:usort(TotalOpts) -- lists:usort(Opts)); _ -> true end. +effects_code_generation(Option) -> + case Option of + beam -> false; + report_warnings -> false; + report_errors -> false; + return_errors-> false; + return_warnings-> false; + warnings_as_errors -> false; + binary -> false; + verbose -> false; + {cwd,_} -> false; + {outdir, _} -> false; + _ -> true + end. + compile_info(Target) -> case beam_lib:chunks(Target, [compile_info]) of {ok, {_mod, Chunks}} -> |