diff options
Diffstat (limited to 'src/rebar_protobuffs_compiler.erl')
-rw-r--r-- | src/rebar_protobuffs_compiler.erl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/rebar_protobuffs_compiler.erl b/src/rebar_protobuffs_compiler.erl index 8ad0318..421b258 100644 --- a/src/rebar_protobuffs_compiler.erl +++ b/src/rebar_protobuffs_compiler.erl @@ -40,8 +40,8 @@ compile(_Config, _AppFile) -> [] -> ok; FoundFiles -> - %% Check for protobuffs library -- if it's not present, fail since we have - %% .proto files that need building + %% Check for protobuffs library -- if it's not present, fail + %% since we have.proto files that need building case protobuffs_is_present() of true -> %% Build a list of output files - { Proto, Beam, Hrl } @@ -51,7 +51,8 @@ compile(_Config, _AppFile) -> %% Compile each proto file compile_each(Targets); false -> - ?ERROR("Protobuffs library not present in code path!\n", []), + ?ERROR("Protobuffs library not present in code path!\n", + []), ?FAIL end end. @@ -60,7 +61,9 @@ compile(_Config, _AppFile) -> clean(_Config, _AppFile) -> %% Get a list of generated .beam and .hrl files and then delete them Protos = filelib:wildcard("src/*.proto"), - Targets = [fq_beam_file(F) || F <- Protos] ++ [fq_hrl_file(F) || F <- Protos], + BeamFiles = [fq_beam_file(F) || F <- Protos], + HrlFiles = [fq_hrl_file(F) || F <- Protos], + Targets = BeamFiles ++ HrlFiles, case Targets of [] -> ok; @@ -100,16 +103,18 @@ compile_each([{Proto, Beam, Hrl} | Rest]) -> ?CONSOLE("Compiling ~s\n", [Proto]), case protobuffs_compile:scan_file(Proto) of ok -> - %% Compilation worked, but we need to move the .beam and .hrl file - %% into the ebin/ and include/ directories respectively - %% TODO: Protobuffs really needs to be better about this...sigh. + %% Compilation worked, but we need to move the + %% beam and .hrl file into the ebin/ and include/ + %% directories respectively + %% TODO: Protobuffs really needs to be better about this ok = filelib:ensure_dir(filename:join("ebin","dummy")), ok = rebar_file_utils:mv(Beam, "ebin"), ok = filelib:ensure_dir(filename:join("include", Hrl)), ok = rebar_file_utils:mv(Hrl, "include"), ok; Other -> - ?ERROR("Protobuff compile of ~s failed: ~p\n", [Proto, Other]), + ?ERROR("Protobuff compile of ~s failed: ~p\n", + [Proto, Other]), ?FAIL end; false -> |