From 521a49dd262da0264718d6e5765b23d37c6f6240 Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Sun, 22 Feb 2015 17:35:17 -0800 Subject: don't unescessarily recompile yrl/xrl files fixes #175 --- src/rebar_erlc_compiler.erl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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}) -> -- cgit v1.1