Skip to content

Commit

Permalink
Warn about deprepcated build options (erlef#331)
Browse files Browse the repository at this point in the history
* Warn about deprepcated build options

---------

Co-authored-by: Paulo F. Oliveira <[email protected]>
  • Loading branch information
starbelly and paulo-ferraz-oliveira authored Oct 16, 2023
1 parent 86bbaef commit 9412b5c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/rebar3_hex_build.erl
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ include_files(Name, AppDir, AppDetails) ->
%% exclude_files. We don't document this anymore, but we do support it to avoid breaking changes. However,
%% users should be instructed to use *_paths. Likewise for exclude_regexps which is now documented as
%% exclude_patterns.
maybe_warn_about(include_files, proplists:get_value(include_files, AppDetails, undefined)),
maybe_warn_about(exclude_regexps, proplists:get_value(exclude_regexps, AppDetails, undefined)),
IncludePaths = proplists:get_value(include_paths, AppDetails, proplists:get_value(include_files, AppDetails, [])),
ExcludePaths = proplists:get_value(exclude_paths, AppDetails, proplists:get_value(exclude_files, AppDetails, [])),
ExcludeRes = proplists:get_value(exclude_patterns, AppDetails, proplists:get_value(exclude_regexps, AppDetails, [])),
Expand All @@ -433,6 +435,22 @@ include_files(Name, AppDir, AppDetails) ->
AppSrcBinary = binarify(lists:flatten(io_lib:format("~tp.\n", [AppSrc]))),
lists:keystore(AppFileSrc, 1, WithIncludes, {AppFileSrc, AppSrcBinary}).

maybe_warn_about(_, undefined) -> ok;
maybe_warn_about(include_files, _) ->
Deprecation = "include_files has been deprecated, and will be "
++ "removed in a later version of rebar3_hex. "
++ "You should use include_paths instead. See "
++ "\"rebar3 help hex build\" or \"rebar3_hex_build\" "
++ "module docs for more info.",
rebar_api:warn(Deprecation, []);
maybe_warn_about(exclude_regexps, _) ->
Deprecation = "exclude_regexps has been deprecated, and will be "
++ "removed in a later version of rebar3_hex. "
++ "You should use exclude_paths instead. See "
++ "\"rebar3 help hex build\" or \"rebar3_hex_build\" "
++ "module docs for more info.",
rebar_api:warn(Deprecation, []).

exclude_file(Path, ExcludeFiles, ExcludeRe) ->
lists:keymember(Path, 2, ExcludeFiles) orelse
known_exclude_file(Path, ExcludeRe).
Expand Down

0 comments on commit 9412b5c

Please sign in to comment.