|
|
@ -135,7 +135,7 @@ populate_deps(G, SourceExt, ArtifactExts) -> |
|
|
|
%% in depth already, and improvements should be driven at that level) |
|
|
|
IgnoredExts = [SourceExt | ArtifactExts], |
|
|
|
Vertices = digraph:vertices(G), |
|
|
|
[refresh_dep(G, File) |
|
|
|
[refresh_dep(G, digraph:vertex(G, File)) |
|
|
|
|| File <- Vertices, |
|
|
|
Ext <- [filename:extension(File)], |
|
|
|
not lists:member(Ext, IgnoredExts)], |
|
|
@ -211,7 +211,7 @@ restore_dag(G, File, CritMeta) -> |
|
|
|
%% the whole restore operation. |
|
|
|
#dag{vsn=?DAG_VSN, info={Vs, Es, CritMeta}} = binary_to_term(Data), |
|
|
|
[digraph:add_vertex(G, V, LastUpdated) || {V, LastUpdated} <- Vs], |
|
|
|
[digraph:add_edge(G, V1, V2) || {_, V1, V2, _} <- Es], |
|
|
|
[digraph:add_edge(G, V1, V2, Label) || {_, V1, V2, Label} <- Es], |
|
|
|
ok; |
|
|
|
{error, _Err} -> |
|
|
|
ok |
|
|
@ -234,8 +234,8 @@ maybe_rm_artifact_and_edge(G, OutDir, SrcExt, Ext, Source) -> |
|
|
|
false; |
|
|
|
false -> |
|
|
|
Edges = digraph:in_edges(G, Source), |
|
|
|
Targets = [V2 || Edge <- Edges, |
|
|
|
{_E, _V1, V2, artifact} <- [digraph:edge(G, Edge)]], |
|
|
|
Targets = [V1 || Edge <- Edges, |
|
|
|
{_E, V1, _V2, artifact} <- [digraph:edge(G, Edge)]], |
|
|
|
case Targets of |
|
|
|
[] -> |
|
|
|
Target = target(OutDir, Source, SrcExt, Ext), |
|
|
@ -243,8 +243,8 @@ maybe_rm_artifact_and_edge(G, OutDir, SrcExt, Ext, Source) -> |
|
|
|
file:delete(Target); |
|
|
|
[_|_] -> |
|
|
|
lists:foreach(fun(Target) -> |
|
|
|
?DEBUG("Source ~ts is gone, deleting artiface ~ts " |
|
|
|
"if it exists ~ts", [Source, Target]), |
|
|
|
?DEBUG("Source ~ts is gone, deleting artifact ~ts " |
|
|
|
"if it exists", [Source, Target]), |
|
|
|
file:delete(Target) |
|
|
|
end, Targets) |
|
|
|
end, |
|
|
@ -288,8 +288,10 @@ prepopulate_deps(G, Compiler, InDirs, Source, DepOpts, Status) -> |
|
|
|
ok. |
|
|
|
|
|
|
|
%% check that a dep file is up to date |
|
|
|
refresh_dep(G, File) -> |
|
|
|
{_, LastUpdated} = digraph:vertex(G, File), |
|
|
|
refresh_dep(_G, {artifact, _}) -> |
|
|
|
%% ignore artifacts |
|
|
|
ok; |
|
|
|
refresh_dep(G, {File, LastUpdated}) -> |
|
|
|
case filelib:last_modified(File) of |
|
|
|
0 -> |
|
|
|
%% Gone! Erase from the graph |
|
|
|