summaryrefslogtreecommitdiff
path: root/src/rebar_erlc_compiler.erl
diff options
context:
space:
mode:
authorPhil Toland <phil.toland@gmail.com>2015-11-30 17:42:01 -0600
committerPhil Toland <phil.toland@gmail.com>2015-11-30 17:43:37 -0600
commitbe09be6d6bb005646e22d68ca8cc3a51fe4a1ab1 (patch)
tree3596b99efc6f038e92314120fe777eac5cd9dae0 /src/rebar_erlc_compiler.erl
parenta025066940583a5a18f4b6d8e76fd02cebf8aff9 (diff)
Fix a small bug in the MIB compiler when building dependencies
When compiling a dependency with a MIB file the generated hrl file is left in the root project directory in a file called "include". This has the perverse effect of messing up the search path for include files causing any dependencies with files in their "include" directory to fail to build after that.
Diffstat (limited to 'src/rebar_erlc_compiler.erl')
-rw-r--r--src/rebar_erlc_compiler.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rebar_erlc_compiler.erl b/src/rebar_erlc_compiler.erl
index fb5796c..2cd66a5 100644
--- a/src/rebar_erlc_compiler.erl
+++ b/src/rebar_erlc_compiler.erl
@@ -520,15 +520,20 @@ target_base(OutDir, Source) ->
rebar_dict()) -> 'ok'.
compile_mib(Source, Target, Opts) ->
Dir = filename:dirname(Target),
+ IncludeDir = filename:join(Dir, "include"),
+
+ Mib = filename:rootname(Target),
+ HrlFilename = Mib ++ ".hrl",
+
ok = filelib:ensure_dir(Target),
- ok = filelib:ensure_dir(filename:join([Dir, "include", "dummy.hrl"])),
+ ok = filelib:ensure_dir(filename:join([IncludeDir, HrlFilename])),
+
AllOpts = [{outdir, Dir}
,{i, [Dir]}] ++
rebar_opts:get(Opts, mib_opts, []),
case snmpc:compile(Source, AllOpts) of
{ok, _} ->
- Mib = filename:rootname(Target),
MibToHrlOpts =
case proplists:get_value(verbosity, AllOpts, undefined) of
undefined ->
@@ -537,8 +542,7 @@ compile_mib(Source, Target, Opts) ->
#options{specific = [{verbosity, Verbosity}]}
end,
ok = snmpc:mib_to_hrl(Mib, Mib, MibToHrlOpts),
- Hrl_filename = Mib ++ ".hrl",
- rebar_file_utils:mv(Hrl_filename, "include"),
+ rebar_file_utils:mv(HrlFilename, IncludeDir),
ok;
{error, compilation_failed} ->
?FAIL