From b74912ea73d3d5dac820aac76b6372fd437db7f2 Mon Sep 17 00:00:00 2001 From: Fred Hebert Date: Fri, 25 Jun 2021 12:57:32 +0000 Subject: [PATCH] Drop bootstrap URI handling functions warnings bootstrap is always on an immediate run and should be skippable safely when dealing with compiler versions. As suggested by @saleyn in https://github.com/erlang/rebar3/issues/2584 --- bootstrap | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/bootstrap b/bootstrap index 5b54876f8..b3f9e86a7 100755 --- a/bootstrap +++ b/bootstrap @@ -747,30 +747,32 @@ chr([], _C, _I) -> 0. %% These two functions are ports of rebar_uri module calls that %% can't be called before the app is built; they're utility functions for %% forwards and backwards compat so we need them to be current. +-ifdef(OTP_RELEASE). rebar_uri_parse(URIString) -> %% we drop rebar_uri:apply_opts since it's a noop as called here - try uri_string:parse(URIString) of + case uri_string:parse(URIString) of Map = #{userinfo := _} -> Map; Map when is_map(Map) -> Map#{userinfo => ""}; Res -> Res - catch - error:undef -> - %% Taken from rebar_uri and trimmed down. - case http_uri:parse(URIString, []) of - {error, Reason} -> - {error, "", Reason}; - {ok, {Scheme, UserInfo, Host, Port, Path, Query}} -> - #{ - scheme => atom_to_list(Scheme), - host => Host, port => Port, path => Path, - query => case Query of - [] -> ""; - _ -> string:substr(Query, 2) - end, - userinfo => UserInfo - } - end end. +-else. +rebar_uri_parse(URIString) -> + %% Taken from rebar_uri and trimmed down. + case http_uri:parse(URIString, []) of + {error, Reason} -> + {error, "", Reason}; + {ok, {Scheme, UserInfo, Host, Port, Path, Query}} -> + #{ + scheme => atom_to_list(Scheme), + host => Host, port => Port, path => Path, + query => case Query of + [] -> ""; + _ -> string:substr(Query, 2) + end, + userinfo => UserInfo + } + end. +-endif. %% Taken from rebar_uri.erl rebar_uri_percent_decode(URIMap) when is_map(URIMap)->