summaryrefslogtreecommitdiff
path: root/src/rebar_protobuffs_compiler.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebar_protobuffs_compiler.erl')
-rw-r--r--src/rebar_protobuffs_compiler.erl18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/rebar_protobuffs_compiler.erl b/src/rebar_protobuffs_compiler.erl
index ea34d4f..7ef58d6 100644
--- a/src/rebar_protobuffs_compiler.erl
+++ b/src/rebar_protobuffs_compiler.erl
@@ -35,7 +35,7 @@
%% Public API
%% ===================================================================
-compile(_Config, _AppFile) ->
+compile(Config, _AppFile) ->
case rebar_utils:find_files("src", ".*\\.proto$") of
[] ->
ok;
@@ -49,11 +49,11 @@ compile(_Config, _AppFile) ->
Proto <- FoundFiles],
%% Compile each proto file
- compile_each(Targets);
+ compile_each(Config, Targets);
false ->
?ERROR("Protobuffs library not present in code path!\n",
[]),
- ?ABORT
+ ?FAIL
end
end.
@@ -95,13 +95,15 @@ needs_compile(Proto, Beam) ->
ActualBeam = filename:join(["ebin", filename:basename(Beam)]),
filelib:last_modified(ActualBeam) < filelib:last_modified(Proto).
-compile_each([]) ->
+compile_each(_, []) ->
ok;
-compile_each([{Proto, Beam, Hrl} | Rest]) ->
+compile_each(Config, [{Proto, Beam, Hrl} | Rest]) ->
case needs_compile(Proto, Beam) of
true ->
?CONSOLE("Compiling ~s\n", [Proto]),
- case protobuffs_compile:scan_file(Proto) of
+ ErlOpts = rebar_utils:erl_opts(Config),
+ case protobuffs_compile:scan_file(Proto,
+ [{compile_flags,ErlOpts}]) of
ok ->
%% Compilation worked, but we need to move the
%% beam and .hrl file into the ebin/ and include/
@@ -115,12 +117,12 @@ compile_each([{Proto, Beam, Hrl} | Rest]) ->
Other ->
?ERROR("Protobuff compile of ~s failed: ~p\n",
[Proto, Other]),
- ?ABORT
+ ?FAIL
end;
false ->
ok
end,
- compile_each(Rest).
+ compile_each(Config, Rest).
delete_each([]) ->
ok;