summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrujo Benavides <elbrujohalcon@inaka.net>2016-09-28 19:32:22 -0300
committerBrujo Benavides <elbrujohalcon@inaka.net>2016-09-28 19:32:22 -0300
commit3f0e56d9c8c6da6c304543e47ff83e101aabf847 (patch)
tree1558c0469c82a7caf94c3e607f8dfb98804d7319
parenta40fe42d906fde0be0534b6c6acf7e5868860357 (diff)
Add support for behaviors, and not just behaviours
-rw-r--r--src/rebar_erlc_compiler.erl2
-rw-r--r--src/rebar_prv_xref.erl3
-rw-r--r--test/rebar_xref_SUITE.erl2
3 files changed, 5 insertions, 2 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index b148172..e6f2b71 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -668,6 +668,8 @@ process_attr(include_lib, Form, Includes, Dir) ->
[FileNode] = erl_syntax:attribute_arguments(Form),
RawFile = erl_syntax:string_value(FileNode),
maybe_expand_include_lib_path(RawFile, Dir) ++ Includes;
+process_attr(behavior, Form, Includes, _Dir) ->
+ process_attr(behaviour, Form, Includes, _Dir);
process_attr(behaviour, Form, Includes, _Dir) ->
[FileNode] = erl_syntax:attribute_arguments(Form),
File = module_to_erl(erl_syntax:atom_value(FileNode)),
diff --git a/src/rebar_prv_xref.erl b/src/rebar_prv_xref.erl
index 45badd3..3d74c9a 100644
--- a/src/rebar_prv_xref.erl
+++ b/src/rebar_prv_xref.erl
@@ -165,7 +165,8 @@ keyall(Key, List) ->
lists:flatmap(fun({K, L}) when Key =:= K -> L; (_) -> [] end, List).
get_behaviour_callbacks(exports_not_used, Attributes) ->
- [B:behaviour_info(callbacks) || B <- keyall(behaviour, Attributes)];
+ [B:behaviour_info(callbacks) || B <- keyall(behaviour, Attributes) ++
+ keyall(behavior, Attributes)];
get_behaviour_callbacks(_XrefCheck, _Attributes) ->
[].
diff --git a/test/rebar_xref_SUITE.erl b/test/rebar_xref_SUITE.erl
index 75d6786..09f73a7 100644
--- a/test/rebar_xref_SUITE.erl
+++ b/test/rebar_xref_SUITE.erl
@@ -150,7 +150,7 @@ get_module_body(mymod, AppName, IgnoreXref) ->
["-ignore_xref([{other2,1},{localfunc2,0},{fdeprecated,0}]).\n"
|| X <- [IgnoreXref], X =:= true],
"-behaviour(", AppName, "_behaviour1).\n", % 2 behaviours
- "-behaviour(", AppName, "_behaviour2).\n",
+ "-behavior(", AppName, "_behaviour2).\n",
"-deprecated({fdeprecated,0}).\n", % deprecated function
"bh1_a(A) -> localfunc1(bh1_a, A).\n", % behaviour functions
"bh1_b(A) -> localfunc1(bh1_b, A).\n",