Skip to content

Commit

Permalink
Merge pull request #2850 from ferd/dedupe-edges-on-dag-insert
Browse files Browse the repository at this point in the history
Dedupe compiler DAG edge insertion for artifacts
  • Loading branch information
ferd authored Dec 19, 2023
2 parents 3d847e3 + e94e124 commit 8f9c872
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/rebar/src/rebar_compiler_dag.erl
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,16 @@ terminate(G) ->
store_artifact(G, Source, Target, Meta) ->
mark_dirty(G),
digraph:add_vertex(G, Target, {artifact, Meta}),
digraph:add_edge(G, Target, Source, artifact).
%% artifact edges can get duplicated, so see if it exists before doing
%% anything with it
Edges = [{Beam,Src} || E <- digraph:edges(G, Target),
{_,Beam,Src,artifact} <- [digraph:edge(G,E)]],
case lists:member({Target, Source}, Edges) of
true ->
ok;
false ->
digraph:add_edge(G, Target, Source, artifact)
end.

%%%%%%%%%%%%%%%
%%% PRIVATE %%%
Expand Down

0 comments on commit 8f9c872

Please sign in to comment.