Skip to content

Commit

Permalink
Low hanging fruits for speedups
Browse files Browse the repository at this point in the history
  • Loading branch information
ferd committed May 12, 2020
1 parent 235543d commit 9a2898a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/rebar_compiler_erl.erl
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,18 @@ filename_to_atom(F) -> list_to_atom(filename:rootname(filename:basename(F))).
%% Get subset of SourceFiles which need to be recompiled, respecting
%% dependencies induced by given graph G.
needed_files(Graph, ErlOpts, RebarOpts, Dir, OutDir, SourceFiles) ->
PrivIncludes = [{i, filename:join(Dir, Src)}
|| Src <- rebar_dir:all_src_dirs(RebarOpts, ["src"], [])],
SharedOpts = [{i, filename:join(Dir, "include")},
{i, Dir}] ++ PrivIncludes ++ ErlOpts,
CompilerOptsSet = erl_compiler_opts_set(),
lists:filter(fun(Source) ->
TargetBase = target_base(OutDir, Source),
Target = TargetBase ++ ".beam",
PrivIncludes = [{i, filename:join(Dir, Src)}
|| Src <- rebar_dir:all_src_dirs(RebarOpts, ["src"], [])],
AllOpts = [{outdir, filename:dirname(Target)}
,{i, filename:join(Dir, "include")}
,{i, Dir}] ++ PrivIncludes ++ ErlOpts,
AllOpts = [{outdir, filename:dirname(Target)} | SharedOpts],
digraph:vertex(Graph, Source) > {Source, filelib:last_modified(Target)}
orelse opts_changed(Graph, AllOpts, Target, TargetBase)
orelse erl_compiler_opts_set()
orelse CompilerOptsSet
end, SourceFiles).

target_base(OutDir, Source) ->
Expand Down

0 comments on commit 9a2898a

Please sign in to comment.