diff --git a/inttest/erlc_dep_graph/erlc_dep_graph_rt.erl b/inttest/erlc_dep_graph/erlc_dep_graph_rt.erl index ee3907e..fb128c6 100644 --- a/inttest/erlc_dep_graph/erlc_dep_graph_rt.erl +++ b/inttest/erlc_dep_graph/erlc_dep_graph_rt.erl @@ -40,7 +40,7 @@ files() -> run(_Dir) -> compile_all(ok, ""), check_beams_ok(), - check_beams_untouched(), + check_beams_untouched(filelib:wildcard("ebin/*.beam")), modify_and_recompile_ok("src/lisp.erl", "ebin/lisp.beam"), clean_all_ok(), @@ -48,14 +48,27 @@ run(_Dir) -> compile_all(ok, ""), modify_and_recompile_ok("extra_include/extra.hrl", "ebin/java.beam"), + Java = "src/java.erl", + {ok, OrigContent} = file:read_file(Java), + %% Remove header file inclusion + {ok, _} = file:copy("src/java.erl.no_extra", Java), + %% Ensure recompilation + touch([Java]), + compile_all(ok, ""), + %% Modify that header file + touch(["extra_include/extra.hrl"]), + %% Ensure we don't have to recompile anything + check_beams_untouched(["ebin/java.beam"]), + %% Clean up + ok = file:write_file(Java, OrigContent), + ok. check_beams_ok() -> F = fun(BeamFile) -> ?assert(filelib:is_regular(BeamFile)) end, with_erl_beams(F). -check_beams_untouched() -> - Beams = filelib:wildcard("ebin/*.beam"), +check_beams_untouched(Beams) -> compile_all_and_assert_mtimes(Beams, fun erlang:'=:='/2). modify_and_recompile_ok(TouchFile, CheckFile) -> diff --git a/inttest/erlc_dep_graph/src/java.erl.no_extra b/inttest/erlc_dep_graph/src/java.erl.no_extra new file mode 100644 index 0000000..7a8fc04 --- /dev/null +++ b/inttest/erlc_dep_graph/src/java.erl.no_extra @@ -0,0 +1,10 @@ +%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*- +%% ex: ts=4 sw=4 ft=erlang et +-module(java). + +-export([factory/0]). + +-include("lambda.hrl"). + +factory() -> + ?FUN. diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl index 19dc40a..7c3f6db 100644 --- a/src/rebar_erlc_compiler.erl +++ b/src/rebar_erlc_compiler.erl @@ -448,6 +448,7 @@ modify_erlcinfo(G, Source, Dirs) -> ok = file:close(Fd), LastUpdated = {date(), time()}, digraph:add_vertex(G, Source, LastUpdated), + digraph:del_edges(G, digraph:out_edges(G, Source)), lists:foreach( fun(Incl) -> update_erlcinfo(G, Dirs, Incl),