|
|
@ -62,6 +62,7 @@ |
|
|
|
handle_call/3, |
|
|
|
handle_cast/2, |
|
|
|
handle_info/2, |
|
|
|
code_change/3, |
|
|
|
terminate/2 |
|
|
|
]). |
|
|
|
|
|
|
@ -264,6 +265,9 @@ handle_info(timeout, State) -> |
|
|
|
handle_info(_Msg, State) -> |
|
|
|
{noreply, State}. |
|
|
|
|
|
|
|
code_change(_OldVsn, State, _Extra) -> |
|
|
|
{ok, State}. |
|
|
|
|
|
|
|
terminate(_Reason, _State) -> |
|
|
|
ok. |
|
|
|
|
|
|
@ -366,7 +370,7 @@ tryGetSrcOpts(SrcDir) -> |
|
|
|
_ when IsBaseSrcDir -> |
|
|
|
try filelib:fold_files(SrcDir, ".*\\.(erl|dtl|lfe|ex)$", true, |
|
|
|
fun(OneFile, Acc) -> |
|
|
|
Mod = binary_to_atom(filename:basename(OneFile, filename:extension(OneFile))), |
|
|
|
Mod = binary_to_atom(filename:basename(OneFile, filename:extension(OneFile)), utf8), |
|
|
|
case tryGetModOpts(Mod) of |
|
|
|
{ok, _Options} = Opts -> |
|
|
|
throw(Opts); |
|
|
@ -666,7 +670,7 @@ collSrcFiles(IsAddPath) -> |
|
|
|
%MTimeSec = dateTimeToSec(filelib:last_modified(OneFile)), |
|
|
|
case filename:extension(OneFile) of |
|
|
|
<<".beam">> -> |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>)), |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>), utf8), |
|
|
|
setelement(4, Acc, Beams#{BeamMod => MTimeSec}); |
|
|
|
<<".config">> -> |
|
|
|
setelement(3, Acc, Configs#{OneFile => MTimeSec}); |
|
|
@ -684,7 +688,7 @@ collSrcFiles(IsAddPath) -> |
|
|
|
end, |
|
|
|
case getOptions(RootSrcDir) of |
|
|
|
undefined -> |
|
|
|
Mod = binary_to_atom(filename:basename(OneFile, filename:extension(OneFile))), |
|
|
|
Mod = binary_to_atom(filename:basename(OneFile, filename:extension(OneFile)), utf8), |
|
|
|
case getModOpts(Mod) of |
|
|
|
{ok, Options} -> |
|
|
|
setOptions(RootSrcDir, Options); |
|
|
@ -708,7 +712,7 @@ collSrcFiles(IsAddPath) -> |
|
|
|
MTimeSec = dateTimeToSec(filelib:last_modified(OneFile)), |
|
|
|
case filename:extension(OneFile) of |
|
|
|
<<".beam">> -> |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>)), |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>), utf8), |
|
|
|
setelement(4, Acc, Beams#{BeamMod => MTimeSec}); |
|
|
|
<<".config">> -> |
|
|
|
setelement(3, Acc, Configs#{OneFile => MTimeSec}); |
|
|
@ -730,7 +734,7 @@ collSrcFiles(IsAddPath) -> |
|
|
|
MTimeSec = dateTimeToSec(filelib:last_modified(OneFile)), |
|
|
|
case filename:extension(OneFile) of |
|
|
|
<<".beam">> -> |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>)), |
|
|
|
BeamMod = binary_to_atom(filename:basename(OneFile, <<".beam">>), utf8), |
|
|
|
setelement(4, Acc, Beams#{BeamMod => MTimeSec}); |
|
|
|
<<".config">> -> |
|
|
|
setelement(3, Acc, Configs#{OneFile => MTimeSec}); |
|
|
@ -904,14 +908,14 @@ onSyncApplyList(Funs, Modules) -> |
|
|
|
onSyncApply({M, F}, Modules) -> |
|
|
|
try erlang:apply(M, F, [Modules]) |
|
|
|
catch |
|
|
|
C:R:S -> |
|
|
|
?logErrors("apply sync fun ~p:~p(~p) error ~p", [M, F, Modules, {C, R, S}]) |
|
|
|
C:R -> |
|
|
|
?logErrors("apply sync fun ~p:~p(~p) error ~p", [M, F, Modules, {C, R}]) |
|
|
|
end; |
|
|
|
onSyncApply(Fun, Modules) when is_function(Fun) -> |
|
|
|
try Fun(Modules) |
|
|
|
catch |
|
|
|
C:R:S -> |
|
|
|
?logErrors("apply sync fun ~p(~p) error ~p", [Fun, Modules, {C, R, S}]) |
|
|
|
C:R -> |
|
|
|
?logErrors("apply sync fun ~p(~p) error ~p", [Fun, Modules, {C, R}]) |
|
|
|
end. |
|
|
|
|
|
|
|
reloadChangedMod([], _SwSyncNode, OnSyncFun, Acc) -> |
|
|
@ -984,7 +988,7 @@ erlydtlCompile(SrcFile, Options) -> |
|
|
|
(OtherOption, Acc) -> [OtherOption | Acc] |
|
|
|
end, |
|
|
|
DtlOptions = lists:foldl(F, [], Options), |
|
|
|
Module = binary_to_atom(lists:flatten(filename:basename(SrcFile, ".dtl") ++ "_dtl")), |
|
|
|
Module = binary_to_atom(lists:flatten(filename:basename(SrcFile, ".dtl") ++ "_dtl"), utf8), |
|
|
|
Compiler = erlydtl, |
|
|
|
Compiler:compile(SrcFile, Module, DtlOptions). |
|
|
|
|
|
|
@ -1008,13 +1012,13 @@ lfe_compile(SrcFile, Options) -> |
|
|
|
getCompileFunAndModuleName(SrcFile) -> |
|
|
|
case getFileType(SrcFile) of |
|
|
|
erl -> |
|
|
|
{fun compile:file/2, binary_to_atom(filename:basename(SrcFile, <<".erl">>))}; |
|
|
|
{fun compile:file/2, binary_to_atom(filename:basename(SrcFile, <<".erl">>), utf8)}; |
|
|
|
dtl -> |
|
|
|
{fun erlydtlCompile/2, list_to_atom(lists:flatten(binary_to_list(filename:basename(SrcFile, <<".dtl">>)) ++ "_dtl"))}; |
|
|
|
lfe -> |
|
|
|
{fun lfe_compile/2, binary_to_atom(filename:basename(SrcFile, <<".lfe">>))}; |
|
|
|
{fun lfe_compile/2, binary_to_atom(filename:basename(SrcFile, <<".lfe">>), utf8)}; |
|
|
|
elixir -> |
|
|
|
{fun elixir_compile/2, binary_to_atom(filename:basename(SrcFile, <<".ex">>))} |
|
|
|
{fun elixir_compile/2, binary_to_atom(filename:basename(SrcFile, <<".ex">>), utf8)} |
|
|
|
end. |
|
|
|
|
|
|
|
getObjectCode(Module) -> |
|
|
@ -1210,7 +1214,7 @@ classifyChangeFile([OneFile | LeftFile], Beams, Configs, Hrls, Srcs, ColSrcs, Co |
|
|
|
CurMTimeSec = dateTimeToSec(filelib:last_modified(OneFile)), |
|
|
|
case filename:extension(OneFile) of |
|
|
|
<<".beam">> -> |
|
|
|
BinMod = binary_to_atom(filename:basename(OneFile, <<".beam">>)), |
|
|
|
BinMod = binary_to_atom(filename:basename(OneFile, <<".beam">>), utf8), |
|
|
|
case ColBeams of |
|
|
|
#{BinMod := OldMTimeSec} -> |
|
|
|
case CurMTimeSec =/= OldMTimeSec andalso CurMTimeSec =/= 0 of |
|
|
|