Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn about deprepcated build options #331

Merged
merged 5 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading