summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralisdair sullivan <alisdairsullivan@yahoo.ca>2015-02-22 17:35:17 -0800
committeralisdair sullivan <alisdairsullivan@yahoo.ca>2015-02-22 20:03:49 -0800
commit521a49dd262da0264718d6e5765b23d37c6f6240 (patch)
tree4c782c40e8a5c4b5a2182bd79c315268aafa9564 /src
parent4b9adefcb844111607891c9d7071794764126fc7 (diff)
don't unescessarily recompile yrl/xrl files
fixes #175
Diffstat (limited to 'src')
-rw-r--r--src/rebar_erlc_compiler.erl14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index afdd6bd..ce15ab0 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -265,14 +265,20 @@ opts_changed(Opts, Target) ->
case code:load_abs(ObjectFile) of
{module, Mod} ->
Compile = Mod:module_info(compile),
- %% dialyzer and eunit have trouble without the next two lines
- code:delete(Mod),
- code:purge(Mod),
+ _ = purge(Mod),
lists:sort(Opts) =/= lists:sort(proplists:get_value(options,
Compile));
- {error, _} -> true
+ {error, nofile} -> false
end.
+purge(Mod) ->
+ %% remove old code if necessary
+ _ = code:purge(Mod),
+ %% move current code to old
+ true = code:delete(Mod),
+ %% remove new old code
+ _ = code:purge(Mod).
+
check_erlcinfo(_Config, #erlcinfo{vsn=?ERLCINFO_VSN}) ->
ok;
check_erlcinfo(Config, #erlcinfo{vsn=Vsn}) ->