Browse Source

ft: 优化

master
lijie 3 years ago
parent
commit
a675067d62
1 changed files with 21 additions and 16 deletions
  1. +21
    -16
      src/eMake.erl

+ 21
- 16
src/eMake.erl View File

@ -15,7 +15,6 @@
main(Args) ->
process_flag(trap_exit, true),
case Args of
[] ->
all(max(1, erlang:system_info(schedulers) - 1), "./Emakefile", []);
@ -57,6 +56,7 @@ saveEMake(NowTime) ->
end.
all(WorkerCnt, EMakeFile, Opts) ->
io:format("compile start use EMakefile: ~ts~n", [EMakeFile]),
StartTime = erlang:system_time(second),
{MakeOpts, CompileOpts} = splitOpts(Opts, [], []),
case readEMakefile(EMakeFile, CompileOpts) of
@ -72,7 +72,7 @@ all(WorkerCnt, EMakeFile, Opts) ->
ignore
end,
saveEMake(EndTime),
io:format("compile over all is ok use time:~ps", [EndTime - StartTime]);
io:format("compile over all is ok use time: ~ps ", [EndTime - StartTime]);
_Err ->
_Err
end.
@ -154,7 +154,7 @@ transform([Mod | EMake], Opts, Files) ->
ensure_dir(Opts) ->
case lists:keysearch(outdir, 1, Opts) of
{value, {outdir, OutDir}} ->
BeamDir = filename:join(OutDir, "tttt.beam"),
BeamDir = filename:join(OutDir, "xxx.beam"),
filelib:ensure_dir(BeamDir);
_ ->
ignore
@ -194,19 +194,24 @@ foldErl([OneFile | Left], Acc) ->
-define(OnceCnt, 8).
forMake([], _Worker, _NoExec, _Load, AllWorkPids) ->
receive
{mOverCompile, WPid} ->
NewAllWorkPids = lists:delete(WPid, AllWorkPids),
case NewAllWorkPids of
[] ->
ok;
_ ->
forMake([], _Worker, _NoExec, _Load, NewAllWorkPids)
end;
{mCompileError, Err} ->
errorStop(Err, AllWorkPids);
_Other ->
io:format("forMake [] receive unexpect msg:~p ~n", [_Other])
case AllWorkPids of
[] ->
ok;
_ ->
receive
{mOverCompile, WPid} ->
NewAllWorkPids = lists:delete(WPid, AllWorkPids),
case NewAllWorkPids of
[] ->
ok;
_ ->
forMake([], _Worker, _NoExec, _Load, NewAllWorkPids)
end;
{mCompileError, Err} ->
errorStop(Err, AllWorkPids);
_Other ->
io:format("forMake [] receive unexpect msg:~p ~n", [_Other])
end
end;
forMake([{Mods, Opts} | Rest], Worker, NoExec, Load, AllWorkPids) ->
case Mods of

Loading…
Cancel
Save