This changes should be done to prevent from failing of compilation if rel directory is set in sub_dirs. Rebar plugin mechanism is calling post and pre hooks for targets both for app files and for reltool.config files, and functions are provided to check wherether it is app dir or rel dir.
rebar_vsn_plugin/src/rebar_vsn_plugin.erl
@@ -29,14 +29,19 @@
%% API
%%============================================================================
post_compile(Config, AppFile) ->
- {AppName, SrcDetail} =
- get_app_meta(Config, AppFile),
- case proplists:get_value(vsn, SrcDetail) of
- "semver" ->
- do_vsn_replacement(AppName, Config, AppFile);
- semver ->
- do_vsn_replacement(AppName, Config, AppFile);
- _ ->
+ case rebar_app_utils:is_app_dir() of
+ {true, AppFile} ->
+ {AppName, SrcDetail} =
+ get_app_meta(Config, AppFile),
+ case proplists:get_value(vsn, SrcDetail) of
+ "semver" ->
+ do_vsn_replacement(AppName, Config, AppFile);
+ semver ->
+ do_vsn_replacement(AppName, Config, AppFile);
+ _ ->
+ ok
+ end;
+ false ->
ok
end.
@define-null I am not a reltool user, so I didn't realize it called the 'compile' on both. Thats more then a bit crazy. However, I will get a patch out with your changes.
This changes should be done to prevent from failing of compilation if rel directory is set in sub_dirs. Rebar plugin mechanism is calling post and pre hooks for targets both for app files and for reltool.config files, and functions are provided to check wherether it is app dir or rel dir.