소스 검색

Don't detect the source file as an include of itself

pull/3/head
Vagabond 15 년 전
부모
커밋
50832a1a14
1개의 변경된 파일9개의 추가작업 그리고 7개의 파일을 삭제
  1. +9
    -7
      src/rebar_erlc_compiler.erl

+ 9
- 7
src/rebar_erlc_compiler.erl 파일 보기

@ -109,14 +109,14 @@ inspect(Source, IncludePath) ->
ModuleDefault = filename:basename(Source, ".erl"),
case epp:open(Source, IncludePath) of
{ok, Epp} ->
inspect_epp(Epp, ModuleDefault, []);
inspect_epp(Epp, Source, ModuleDefault, []);
{error, Reason} ->
?DEBUG("Failed to inspect ~s: ~p\n", [Source, Reason]),
{ModuleDefault, []}
end.
-spec inspect_epp(Epp::pid(), Module::string(), Includes::[string()]) -> {string(), [string()]}.
inspect_epp(Epp, Module, Includes) ->
-spec inspect_epp(Epp::pid(), Source::string(), Module::string(), Includes::[string()]) -> {string(), [string()]}.
inspect_epp(Epp, Source, Module, Includes) ->
case epp:parse_erl_form(Epp) of
{ok, {attribute, _, module, ModInfo}} ->
case ModInfo of
@ -133,16 +133,18 @@ inspect_epp(Epp, Module, Includes) ->
{ActualModule, _} when is_list(ActualModule) ->
ActualModuleStr = string:join([atom_to_list(P) || P <- ActualModule], ".")
end,
inspect_epp(Epp, ActualModuleStr, Includes);
inspect_epp(Epp, Source, ActualModuleStr, Includes);
{ok, {attribute, 1, file, {Module, 1}}} ->
inspect_epp(Epp, Module, Includes);
inspect_epp(Epp, Source, Module, Includes);
{ok, {attribute, 1, file, {Source, 1}}} ->
inspect_epp(Epp, Source, Module, Includes);
{ok, {attribute, 1, file, {IncFile, 1}}} ->
inspect_epp(Epp, Module, [IncFile | Includes]);
inspect_epp(Epp, Source, Module, [IncFile | Includes]);
{eof, _} ->
epp:close(Epp),
{Module, Includes};
_ ->
inspect_epp(Epp, Module, Includes)
inspect_epp(Epp, Source, Module, Includes)
end.
-spec needs_compile(Source::string(), Target::string(), Hrls::[string()]) -> boolean().

불러오는 중...
취소
저장