From 105965c8216f84c6bc21fcb04502323bd4b32d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szymczyszyn?= Date: Wed, 5 Mar 2014 17:36:36 +0100 Subject: [PATCH 1/3] Simplify main/1 heads --- syntax_checkers/erlang/erlang_check_file.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/syntax_checkers/erlang/erlang_check_file.erl b/syntax_checkers/erlang/erlang_check_file.erl index 01622d9e..019cfe61 100755 --- a/syntax_checkers/erlang/erlang_check_file.erl +++ b/syntax_checkers/erlang/erlang_check_file.erl @@ -5,7 +5,7 @@ main([FileName]) -> LibDirs = filelib:wildcard("{lib,deps}/*/ebin"), compile(FileName, LibDirs); -main([FileName | ["-rebar" | [Path | LibDirs]]]) -> +main([FileName, "-rebar", Path, LibDirs]) -> {ok, L} = file:consult(Path), P = dict:from_list(L), Root = filename:dirname(Path), @@ -31,7 +31,7 @@ main([FileName | ["-rebar" | [Path | LibDirs]]]) -> %io:format("~p~n", [LibDirs1]), compile(FileName, LibDirs1); -main([FileName | LibDirs]) -> +main([FileName, LibDirs]) -> compile(FileName, LibDirs). compile(FileName, LibDirs) -> From 2286363adb7118003f6b4f090c260613cde7448e Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 5 Mar 2014 19:20:29 +0100 Subject: [PATCH 2/3] Properly add deps/*/include to header file path --- syntax_checkers/erlang/erlang_check_file.erl | 22 +++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/syntax_checkers/erlang/erlang_check_file.erl b/syntax_checkers/erlang/erlang_check_file.erl index 019cfe61..308a6012 100755 --- a/syntax_checkers/erlang/erlang_check_file.erl +++ b/syntax_checkers/erlang/erlang_check_file.erl @@ -2,7 +2,8 @@ -export([main/1]). main([FileName]) -> - LibDirs = filelib:wildcard("{lib,deps}/*/ebin"), + LibDirs = (["include", "src", "test"] ++ + filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")), compile(FileName, LibDirs); main([FileName, "-rebar", Path, LibDirs]) -> @@ -37,17 +38,14 @@ main([FileName, LibDirs]) -> compile(FileName, LibDirs) -> Root = get_root(filename:dirname(FileName)), ok = code:add_pathsa(LibDirs), - compile:file(FileName, [warn_obsolete_guard, - warn_unused_import, - warn_shadow_vars, - warn_export_vars, - strong_validation, - report, - {i, filename:join(Root, "include")}, - {i, filename:join(Root, "deps")}, - {i, filename:join(Root, "apps")}, - {i, filename:join(Root, "lib")} - ]). + compile:file(FileName, + [warn_obsolete_guard, + warn_unused_import, + warn_shadow_vars, + warn_export_vars, + strong_validation, + report] ++ + [{i, filename:join(Root, I)} || I <- LibDirs]). get_root(Dir) -> Path = filename:split(filename:absname(Dir)), From 1fcb6b89b5593cac1f43026f27287aff1000401f Mon Sep 17 00:00:00 2001 From: Radek Szymczyszyn Date: Wed, 5 Mar 2014 19:44:43 +0100 Subject: [PATCH 3/3] Don't forget about ebin/ --- syntax_checkers/erlang/erlang_check_file.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax_checkers/erlang/erlang_check_file.erl b/syntax_checkers/erlang/erlang_check_file.erl index 308a6012..bd94870b 100755 --- a/syntax_checkers/erlang/erlang_check_file.erl +++ b/syntax_checkers/erlang/erlang_check_file.erl @@ -2,7 +2,7 @@ -export([main/1]). main([FileName]) -> - LibDirs = (["include", "src", "test"] ++ + LibDirs = (["ebin", "include", "src", "test"] ++ filelib:wildcard("{apps,deps,lib}/*/{ebin,include}")), compile(FileName, LibDirs);