10000 Bump erlware_commons to 1.8.0 by ferd · Pull Request #2957 · erlang/rebar3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Bump erlware_commons to 1.8.0 #2957

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

Merged
merged 3 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
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
4 changes: 1 addition & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ jobs:
- name: Debug Brew
run: brew doctor || true
- name: Install Erlang
# fallback to OTP-27 since OTP-28 does not currently build on Brew
# run: brew install erlang@${{ env.LATEST_OTP_RELEASE }}
run: brew install erlang@27
run: brew install erlang@${{ env.LATEST_OTP_RELEASE }}
- name: Compile
run: ./bootstrap
- name: CT tests
Expand Down
2 changes: 1 addition & 1 deletion apps/rebar/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

%% Upgrade by calling 'rebar3 experimental vendor' and making sure
%% any manual patches (Eg. erlware_commons or relx) are kept.
{deps, [{erlware_commons, "1.7.0"},
{deps, [{erlware_commons, "1.8.0"},
{ssl_verify_fun, "1.1.6"},
{certifi, "2.13.0"},
{providers, "1.9.0"},
Expand Down
3 changes: 2 additions & 1 deletion vendor/erlware_commons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Erlware Commons
Current Status
--------------

![Tests](https://github.com/erlware/erlware_commons/workflows/EUnit/badge.svg)
[![Hex.pm](https://img.shields.io/hexpm/v/erlware_commons)](https://hex.pm/packages/erlware_commons)
[![Tests](https://github.com/erlware/erlware_commons/workflows/EUnit/badge.svg)](https://github.com/erlware/erlware_commons/actions)

Introduction
------------
Expand Down
13 changes: 7 additions & 6 deletions vendor/erlware_commons/hex_metadata.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
[<<"README.md">>,<<"include">>,<<"include/ec_cmd_log.hrl">>,<<"priv">>,
<<"priv/ec_semver_parser.peg">>,<<"rebar.config">>,
<<"rebar.config.script">>,<<"rebar.lock">>,<<"src">>,
<<"src/ec_assoc_list.erl">>,<<"src/ec_cmd_log.erl">>,<<"src/ec_cnv.erl">>,
<<"src/ec_compile.erl">>,<<"src/ec_date.erl">>,<<"src/ec_dict.erl">>,
<<"src/ec_dictionary.erl">>,<<"src/ec_file.erl">>,<<"src/ec_gb_trees.erl">>,
<<"src/ec_git_vsn.erl">>,<<"src/ec_lists.erl">>,<<"src/ec_orddict.erl">>,
<<"src/ec_plists.erl">>,<<"src/ec_rbdict.erl">>,<<"src/ec_semver.erl">>,
<<"src/ec_assoc_list.erl">>,<<"src/ec_cmd_log.erl">>,
<<"src/ec_cmd_log.hrl">>,<<"src/ec_cnv.erl">>,<<"src/ec_compile.erl">>,
<<"src/ec_date.erl">>,<<"src/ec_dict.erl">>,<<"src/ec_dictionary.erl">>,
<<"src/ec_file.erl">>,<<"src/ec_gb_trees.erl">>,<<"src/ec_git_vsn.erl">>,
<<"src/ec_lists.erl">>,<<"src/ec_orddict.erl">>,<<"src/ec_plists.erl">>,
<<"src/ec_rbdict.erl">>,<<"src/ec_semver.erl">>,
<<"src/ec_semver_parser.erl">>,<<"src/ec_talk.erl">>,<<"src/ec_vsn.erl">>,
<<"src/erlware_commons.app.src">>]}.
{<<"licenses">>,[<<"Apache">>,<<"MIT">>]}.
Expand All @@ -21,4 +22,4 @@
[{<<"app">>,<<"cf">>},
{<<"optional">>,false},
{<<"requirement">>,<<"~>0.3">>}]}]}.
{<<"version">>,<<"1.7.0">>}.
{<<"version">>,<<"1.8.0">>}.
21 changes: 5 additions & 16 deletions vendor/erlware_commons/rebar.config.script
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
IsRebar3 = true,
NoDialWarns = {dialyzer, [{warnings, [no_unknown]}]},
OTPRelease = erlang:list_to_integer(erlang:system_info(otp_release)),

Rebar2Deps = [
{cf, ".*", {git, "https://github.com/project-fifo/cf", {tag, "0.2.2"}}}
],

NoDialWarns = {dialyzer, [{warnings, [no_unknown]}]},
OTPRelease = erlang:list_to_integer(erlang:system_info(otp_release)),
WarnsRemoved = case OTPRelease<26 of
true -> fun(Config) -> Config end;
false -> fun(Config) -> lists:keystore(dialyzer, 1, Config, NoDialWarns) end
end,

case IsRebar3 of
true -> WarnsRemoved(CONFIG);
false ->
lists:keyreplace(deps, 1, WarnsRemoved(CONFIG), {deps, Rebar2Deps})
case OTPRelease<26 of
true -> CONFIG;
false -> lists:keystore(dialyzer, 1, CONFIG, NoDialWarns)
end.
52 changes: 3 additions & 49 deletions vendor/erlware_commons/src/ec_cmd_log.erl
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,17 @@
warn/3,
log_level/1,
atom_log_level/1,
colorize/4,
format/1]).

-include_lib("erlware_commons/include/ec_cmd_log.hrl").
-include("ec_cmd_log.hrl").

-define(RED, $r).
-define(GREEN, $g).
-define(YELLOW, $y).
-define(BLUE, $b).
-define(MAGENTA, $m).
-define(CYAN, $c).

-define(PREFIX, "===> ").

-record(state_t, {log_level=0 :: int_log_level(),
caller=api :: caller(),
intensity=low :: none | low | high}).
intensity=low :: intensity()}).

%%============================================================================
%% types
Expand Down Expand Up @@ -260,44 +255,3 @@ colorize(#state_t{caller=command_line, intensity = low},
lists:flatten(cf:format("~!" ++ [Color] ++"~ts~!!~ts", [?PREFIX, Msg]));
colorize(_LogState, _Color, _Bold, Msg) ->
Msg.

%%%===================================================================
%%% Test Functions
%%%===================================================================

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").

should_test() ->
ErrorLogState = new(error),
?assertMatch(true, should(ErrorLogState, ?EC_ERROR)),
?assertMatch(true, not should(ErrorLogState, ?EC_INFO)),
?assertMatch(true, not should(ErrorLogState, ?EC_DEBUG)),
?assertEqual(?EC_ERROR, log_level(ErrorLogState)),
?assertEqual(error, atom_log_level(ErrorLogState)),

InfoLogState = new(info),
?assertMatch(true, should(InfoLogState, ?EC_ERROR)),
?assertMatch(true, should(InfoLogState, ?EC_INFO)),
?assertMatch(true, not should(InfoLogState, ?EC_DEBUG)),
?assertEqual(?EC_INFO, log_level(InfoLogState)),
?assertEqual(info, atom_log_level(InfoLogState)),

DebugLogState = new(debug),
?assertMatch(true, should(DebugLogState, ?EC_ERROR)),
?assertMatch(true, should(DebugLogState, ?EC_INFO)),
?assertMatch(true, should(DebugLogState, ?EC_DEBUG)),
?assertEqual(?EC_DEBUG, log_level(DebugLogState)),
?assertEqual(debug, atom_log_level(DebugLogState)).


no_color_test() ->
LogState = new(debug, command_line, none),
?assertEqual("test",
colorize(LogState, ?RED, true, "test")).

color_test() ->
LogState = new(debug, command_line, high),
?assertEqual("\e[1;31m===> test\e[0m",
colorize(LogState, ?RED, true, "test")).
-endif.
7 changes: 7 additions & 0 deletions vendor/erlware_commons/src/ec_cmd_log.hrl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
%%% @copyright 2024 Erlware, LLC.
-define(RED, $r).
-define(GREEN, $g).
-define(YELLOW, $y).
-define(BLUE, $b).
-define(MAGENTA, $m).
-define(CYAN, $c).
33 changes: 0 additions & 33 deletions vendor/erlware_commons/src/ec_cnv.erl
Original file line number Diff line number Diff line change
Expand Up @@ -212,36 +212,3 @@ to_atom(X)
erlang:list_to_existing_atom(X);
to_atom(X) ->
to_atom(to_list(X)).

%%%===================================================================
%%% Tests
%%%===================================================================

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").

to_integer_test() ->
?assertError(badarg, to_integer(1.5, strict)).

to_float_test() ->
?assertError(badarg, to_float(10, strict)).

to_atom_test() ->
?assertMatch(true, to_atom("true")),
?assertMatch(true, to_atom(<<"true">>)),
?assertMatch(false, to_atom(<<"false">>)),
?assertMatch(false, to_atom(false)),
?assertError(badarg, to_atom("hello_foo_bar_baz")),

S = erlang:list_to_atom("1"),
?assertMatch(S, to_atom(1)).

to_boolean_test()->
?assertMatch(true, to_boolean(<<"true">>)),
?assertMatch(true, to_boolean("true")),
?assertMatch(true, to_boolean(true)),
?assertMatch(false, to_boolean(<<"false">>)),
?assertMatch(false, to_boolean("false")),
?assertMatch(false, to_boolean(false)).

-endif.
78 changes: 39 additions & 39 deletions vendor/erlware_commons/src/ec_date.erl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
-define( is_month(X), ( (is_integer(X) andalso X =< 12) orelse ?is_hinted_month(X) ) ).
-define( is_tz_offset(H1,H2,M1,M2), (?is_num(H1) andalso ?is_num(H2) andalso ?is_num(M1) andalso ?is_num(M2)) ).

-define(GREGORIAN_SECONDS_1970, 62167219200).
-define(GREGORIAN_SECONDS_1970, 62_167_219_200).
-define(ISO_8601_DATETIME_FORMAT, "Y-m-dTH:i:sZ").
-define(ISO_8601_DATETIME_WITH_MS_FORMAT, "Y-m-dTH:i:s.fZ").

Expand All @@ -54,7 +54,7 @@
-type hour() :: 0..23.
-type minute() :: 0..59.
-type second() :: 0..59.
-type microsecond() :: 0..999999.
-type microsecond() :: 0..999_999.

-type daynum() :: 1..7.
-type date() :: {year(),month(),day()}.
Expand Down Expand Up @@ -138,11 +138,11 @@ nparse(Date) ->
{DateS, {H, M, S, Ms} } ->
GSeconds = calendar:datetime_to_gregorian_seconds({DateS, {H, M, S} }),
ESeconds = GSeconds - ?GREGORIAN_SECONDS_1970,
{ESeconds div 1000000, ESeconds rem 1000000, Ms};
{ESeconds div 1_000_000, ESeconds rem 1_000_000, Ms};
DateTime ->
GSeconds = calendar:datetime_to_gregorian_seconds(DateTime),
ESeconds = GSeconds - ?GREGORIAN_SECONDS_1970,
{ESeconds div 1000000, ESeconds rem 1000000, 0}
{ESeconds div 1_000_000, ESeconds rem 1_000_000, 0}
end.

%%
Expand All @@ -151,7 +151,7 @@ nparse(Date) ->

parse([Year, X, Month, X, Day, Hour, $:, Min, $:, Sec, $., Micros, $Z ], _Now, _Opts)
when ?is_world_sep(X)
andalso (Micros >= 0 andalso Micros < 1000000)
andalso (Micros >= 0 andalso Micros < 1_000_000)
andalso Year > 31 ->
{{Year, Month, Day}, {hour(Hour, []), Min, Sec}, {Micros}};

Expand All @@ -162,7 +162,7 @@ parse([Year, X, Month, X, Day, Hour, $:, Min, $:, Sec, $Z ], _Now, _Opts)

parse([Year, X, Month, X, Day, Hour, $:, Min, $:, Sec, $., Micros, $+, Off | _Rest ], _Now, _Opts)
when (?is_us_sep(X) orelse ?is_world_sep(X))
andalso (Micros >= 0 andalso Micros < 1000000)
andalso (Micros >= 0 andalso Micros < 1_000_000)
andalso Year > 31 ->
{{Year, Month, Day}, {hour(Hour, []) - Off, Min, Sec}, {Micros}};

Expand All @@ -173,7 +173,7 @@ parse([Year, X, Month, X, Day, Hour, $:, Min, $:, Sec, $+, Off | _Rest ], _Now,

parse([Year, X, Month, X, Day, Hour, $:, Min, $:, Sec, $., Micros, $-, Off | _Rest ], _Now, _Opts)
when (?is_us_sep(X) orelse ?is_world_sep(X))
andalso (Micros >= 0 andalso Micros < 1000000)
andalso (Micros >= 0 andalso Micros < 1_000_000)
andalso Year > 31 ->
{{Year, Month, Day}, {hour(Hour, []) + Off, Min, Sec}, {Micros}};

Expand Down Expand Up @@ -316,11 +316,11 @@ tokenise([$., N1, N2, N3, N4 | Rest], Acc)
when ?is_num(N1), ?is_num(N2), ?is_num(N3), ?is_num(N4) ->
tokenise(Rest, [ ltoi([N1, N2, N3, N4]) * 100, $. | Acc]);
tokenise([$., N1, N2, N3 | Rest], Acc) when ?is_num(N1), ?is_num(N2), ?is_num(N3) ->
tokenise(Rest, [ ltoi([N1, N2, N3]) * 1000, $. | Acc]);
tokenise(Rest, [ ltoi([N1, N2, N3]) * 1_000, $. | Acc]);
tokenise([$., N1, N2 | Rest], Acc) when ?is_num(N1), ?is_num(N2) ->
tokenise(Rest, [ ltoi([N1, N2]) * 10000, $. | Acc]);
tokenise(Rest, [ ltoi([N1, N2]) * 10_000, $. | Acc]);
tokenise([$., N1 | Rest], Acc) when ?is_num(N1) ->
tokenise(Rest, [ ltoi([N1]) * 100000, $. | Acc]);
tokenise(Rest, [ ltoi([N1]) * 100_000, $. | Acc]);

tokenise([N1, N2, N3, N4, N5, N6 | Rest], Acc)
when ?is_num(N1), ?is_num(N2), ?is_num(N3), ?is_num(N4), ?is_num(N5), ?is_num(N6) ->
Expand Down Expand Up @@ -718,7 +718,7 @@ ltoi(X) ->


-define(DATE, {{2001,3,10},{17,16,17}}).
-define(DATEMS, {{2001,3,10},{17,16,17,123456}}).
-define(DATEMS, {{2001,3,10},{17,16,17,123_456}}).
-define(DATE_NOON, {{2001,3,10},{12,0,0}}).
-define(DATE_MIDNIGHT, {{2001,3,10},{0,0,0}}).
-define(ISO, "o \\WW").
Expand Down Expand Up @@ -955,7 +955,7 @@ ms_test_() ->
Now=os:timestamp(),
[
?_assertEqual({{2012,12,12}, {12,12,12,1234}}, parse("2012-12-12T12:12:12.001234")),
?_assertEqual({{2012,12,12}, {12,12,12,123000}}, parse("2012-12-12T12:12:12.123")),
?_assertEqual({{2012,12,12}, {12,12,12,123_000}}, parse("2012-12-12T12:12:12.123")),
?_assertEqual(format("H:m:s.f \\m \\i\\s \\m\\o\\n\\t\\h",?DATEMS),
"17:03:17.123456 m is month"),
?_assertEqual(format("Y-m-d\\TH:i:s.f",?DATEMS),
Expand Down Expand Up @@ -994,21 +994,21 @@ format_iso8601_test_() ->
?_assertEqual("2001-03-10T17:16:17.000000Z",
format_iso8601({{2001,3,10},{17,16,17,0}})),
?_assertEqual("2001-03-10T17:16:17.100000Z",
format_iso8601({{2001,3,10},{17,16,17,100000}})),
format_iso8601({{2001,3,10},{17,16,17,100_000}})),
?_assertEqual("2001-03-10T17:16:17.120000Z",
format_iso8601({{2001,3,10},{17,16,17,120000}})),
format_iso8601({{2001,3,10},{17,16,17,120_000}})),
?_assertEqual("2001-03-10T17:16:17.123000Z",
format_iso8601({{2001,3,10},{17,16,17,123000}})),
format_iso8601({{2001,3,10},{17,16,17,123_000}})),
?_assertEqual("2001-03-10T17:16:17.123400Z",
format_iso8601({{2001,3,10},{17,16,17,123400}})),
format_iso8601({{2001,3,10},{17,16,17,123_400}})),
?_assertEqual("2001-03-10T17:16:17.123450Z",
format_iso8601({{2001,3,10},{17,16,17,123450}})),
format_iso8601({{2001,3,10},{17,16,17,123_450}})),
?_assertEqual("2001-03-10T17:16:17.123456Z",
format_iso8601({{2001,3,10},{17,16,17,123456}})),
format_iso8601({{2001,3,10},{17,16,17,123_456}})),
?_assertEqual("2001-03-10T17:16:17.023456Z",
format_iso8601({{2001,3,10},{17,16,17,23456}})),
format_iso8601({{2001,3,10},{17,16,17,23_456}})),
?_assertEqual("2001-03-10T17:16:17.003456Z",
format_iso8601({{2001,3,10},{17,16,17,3456}})),
format_iso8601({{2001,3,10},{17,16,17,3_456}})),
?_assertEqual("2001-03-10T17:16:17.000456Z",
format_iso8601({{2001,3,10},{17,16,17,456}})),
?_assertEqual("2001-03-10T17:16:17.000056Z",
Expand All @@ -1020,21 +1020,21 @@ format_iso8601_test_() ->
?_assertEqual("2001-03-10T07:16:17.000000Z",
format_iso8601({{2001,3,10},{07,16,17,0}})),
?_assertEqual("2001-03-10T07:16:17.100000Z",
format_iso8601({{2001,3,10},{07,16,17,100000}})),
format_iso8601({{2001,3,10},{07,16,17,100_000}})),
?_assertEqual("2001-03-10T07:16:17.120000Z",
format_iso8601({{2001,3,10},{07,16,17,120000}})),
format_iso8601({{2001,3,10},{07,16,17,120_000}})),
?_assertEqual("2001-03-10T07:16:17.123000Z",
format_iso8601({{2001,3,10},{07,16,17,123000}})),
format_iso8601({{2001,3,10},{07,16,17,123_000}})),
?_assertEqual("2001-03-10T07:16:17.123400Z",
format_iso8601({{2001,3,10},{07,16,17,123400}})),
format_iso8601({{2001,3,10},{07,16,17,123_400}})),
?_assertEqual("2001-03-10T07:16:17.123450Z",
format_iso8601({{2001,3,10},{07,16,17,123450}})),
format_iso8601({{2001,3,10},{07,16,17,123_450}})),
?_assertEqual("2001-03-10T07:16:17.123456Z",
format_iso8601({{2001,3,10},{07,16,17,123456}})),
format_iso8601({{2001,3,10},{07,16,17,123_456}})),
?_assertEqual("2001-03-10T07:16:17.023456Z",
format_iso8601({{2001,3,10},{07,16,17,23456}})),
format_iso8601({{2001,3,10},{07,16,17,23_456}})),
?_assertEqual("2001-03-10T07:16:17.003456Z",
format_iso8601({{2001,3,10},{07,16,17,3456}})),
format_iso8601({{2001,3,10},{07,16,17,3_456}})),
?_assertEqual("2001-03-10T07:16:17.000456Z",
format_iso8601({{2001,3,10},{07,16,17,456}})),
?_assertEqual("2001-03-10T07:16:17.000056Z",
Expand All @@ -1051,31 +1051,31 @@ parse_iso8601_test_() ->
parse("2001-03-10T17:16:17.000Z")),
?_assertEqual({{2001,3,10},{17,16,17,0}},
parse("2001-03-10T17:16:17.000000Z")),
?_assertEqual({{2001,3,10},{17,16,17,100000}},
?_assertEqual({{2001,3,10},{17,16,17,100_000}},
parse("2001-03-10T17:16:17.1Z")),
?_assertEqual({{2001,3,10},{17,16,17,120000}},
?_assertEqual({{2001,3,10},{17,16,17,120_000}},
parse("2001-03-10T17:16:17.12Z")),
?_assertEqual({{2001,3,10},{17,16,17,123000}},
?_assertEqual({{2001,3,10},{17,16,17,123_000}},
parse("2001-03-10T17:16:17.123Z")),
?_assertEqual({{2001,3,10},{17,16,17,123400}},
?_assertEqual({{2001,3,10},{17,16,17,123_400}},
parse("2001-03-10T17:16:17.1234Z")),
?_assertEqual({{2001,3,10},{17,16,17,123450}},
?_assertEqual({{2001,3,10},{17,16,17,123_450}},
parse("2001-03-10T17:16:17.12345Z")),
?_assertEqual({{2001,3,10},{17,16,17,123456}},
?_assertEqual({{2001,3,10},{17,16,17,123_456}},
parse("2001-03-10T17:16:17.123456Z")),

?_assertEqual({{2001,3,10},{15,16,17,100000}},
?_assertEqual({{2001,3,10},{15,16,17,100_000}},
parse("2001-03-10T16:16:17.1+01:00")),
?_assertEqual({{2001,3,10},{15,16,17,123456}},
?_assertEqual({{2001,3,10},{15,16,17,123_456}},
parse("2001-03-10T16:16:17.123456+01:00")),
?_assertEqual({{2001,3,10},{17,16,17,100000}},
?_assertEqual({{2001,3,10},{17,16,17,100_000}},
parse("2001-03-10T16:16:17.1-01:00")),
?_assertEqual({{2001,3,10},{17,16,17,123456}},
?_assertEqual({{2001,3,10},{17,16,17,123_456}},
parse("2001-03-10T16:16:17.123456-01:00")),

?_assertEqual({{2001,3,10},{17,16,17,456}},
parse("2001-03-10T17:16:17.000456Z")),
?_assertEqual({{2001,3,10},{17,16,17,123000}},
?_assertEqual({{2001,3,10},{17,16,17,123_000}},
parse("2001-03-10T17:16:17.123000Z"))
].

Expand Down
Loading
Loading
0