Skip to content

Commit

Permalink
Bump gpb deps (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferd authored Jun 11, 2024
1 parent 7f0e4a8 commit a93c925
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 46 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
- erlang: master
rebar3: 3.22.1

- erlang: 26
rebar3: 3.21.0

- erlang: 25
rebar3: 3.18.0

Expand All @@ -31,9 +34,6 @@ jobs:

- erlang: 21
rebar3: 3.15.1

- erlang: 20
rebar3: 3.15.1
steps:
- uses: actions/checkout@v3

Expand Down
4 changes: 2 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
{profiles, [
{dev, [
{deps, [
{gpb, "4.17.6"}
{gpb, "4.21.1"}
]},
{plugins, [
{rebar3_gpb_plugin, "2.20.1"}
{rebar3_gpb_plugin, "2.23.1"}
]},
{overrides, [
{del, rebar3_gpb_plugin, [
Expand Down
53 changes: 41 additions & 12 deletions src/hex_pb_names.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%% -*- coding: utf-8 -*-
%% % this file is @generated
%% @private
%% Automatically generated, do not edit
%% Generated by gpb_compile version 4.17.6
%% Generated by gpb_compile version 4.21.1
%% Version source: file
-module(hex_pb_names).

Expand Down Expand Up @@ -72,9 +73,15 @@
-type '$msg'() :: 'Names'() | 'Package'() | 'Timestamp'().
-export_type(['$msg_name'/0, '$msg'/0]).

-if(?OTP_RELEASE >= 24).
-dialyzer({no_underspecs, encode_msg/2}).
-endif.
-spec encode_msg('$msg'(), '$msg_name'()) -> binary().
encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []).

-if(?OTP_RELEASE >= 24).
-dialyzer({no_underspecs, encode_msg/3}).
-endif.
-spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary().
encode_msg(Msg, MsgName, Opts) ->
verify_msg(Msg, MsgName, Opts),
Expand Down Expand Up @@ -237,14 +244,21 @@ decode_msg(Bin, MsgName, Opts) when is_binary(Bin) ->
-ifdef('OTP_RELEASE').
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
catch
error:{gpb_error,_}=Reason:StackTrace ->
erlang:raise(error, Reason, StackTrace);
Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
-else.
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch Class:Reason ->
StackTrace = erlang:get_stacktrace(),
error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
catch
error:{gpb_error,_}=Reason ->
erlang:raise(error, Reason,
erlang:get_stacktrace());
Class:Reason ->
StackTrace = erlang:get_stacktrace(),
error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
-endif.

Expand Down Expand Up @@ -536,11 +550,12 @@ verify_msg(Msg, MsgName, Opts) ->


-compile({nowarn_unused_function,v_msg_Names/3}).
-dialyzer({nowarn_function,v_msg_Names/3}).
v_msg_Names(#{repository := F2} = M, Path, TrUserData) ->
case M of
#{packages := F1} ->
if is_list(F1) ->
_ = [v_msg_Package(Elem, [packages | Path], TrUserData) || Elem <- F1],
_ = [v_submsg_Package(Elem, [packages | Path], TrUserData) || Elem <- F1],
ok;
true -> mk_type_error({invalid_list_of, {msg, 'Package'}}, F1, [packages | Path])
end;
Expand All @@ -556,11 +571,16 @@ v_msg_Names(#{repository := F2} = M, Path, TrUserData) ->
v_msg_Names(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [repository] -- maps:keys(M), 'Names'}, M, Path);
v_msg_Names(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Names'}, X, Path).

-compile({nowarn_unused_function,v_submsg_Package/3}).
-dialyzer({nowarn_function,v_submsg_Package/3}).
v_submsg_Package(Msg, Path, TrUserData) -> v_msg_Package(Msg, Path, TrUserData).

-compile({nowarn_unused_function,v_msg_Package/3}).
-dialyzer({nowarn_function,v_msg_Package/3}).
v_msg_Package(#{name := F1} = M, Path, TrUserData) ->
v_type_string(F1, [name | Path], TrUserData),
case M of
#{updated_at := F2} -> v_msg_Timestamp(F2, [updated_at | Path], TrUserData);
#{updated_at := F2} -> v_submsg_Timestamp(F2, [updated_at | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (name) -> ok;
Expand All @@ -572,7 +592,12 @@ v_msg_Package(#{name := F1} = M, Path, TrUserData) ->
v_msg_Package(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [name] -- maps:keys(M), 'Package'}, M, Path);
v_msg_Package(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Package'}, X, Path).

-compile({nowarn_unused_function,v_submsg_Timestamp/3}).
-dialyzer({nowarn_function,v_submsg_Timestamp/3}).
v_submsg_Timestamp(Msg, Path, TrUserData) -> v_msg_Timestamp(Msg, Path, TrUserData).

-compile({nowarn_unused_function,v_msg_Timestamp/3}).
-dialyzer({nowarn_function,v_msg_Timestamp/3}).
v_msg_Timestamp(#{seconds := F1, nanos := F2} = M, Path, TrUserData) ->
v_type_int64(F1, [seconds | Path], TrUserData),
v_type_int32(F2, [nanos | Path], TrUserData),
Expand All @@ -586,16 +611,19 @@ v_msg_Timestamp(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_f
v_msg_Timestamp(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Timestamp'}, X, Path).

-compile({nowarn_unused_function,v_type_int32/3}).
v_type_int32(N, _Path, _TrUserData) when -2147483648 =< N, N =< 2147483647 -> ok;
-dialyzer({nowarn_function,v_type_int32/3}).
v_type_int32(N, _Path, _TrUserData) when is_integer(N), -2147483648 =< N, N =< 2147483647 -> ok;
v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path);
v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path).

-compile({nowarn_unused_function,v_type_int64/3}).
v_type_int64(N, _Path, _TrUserData) when -9223372036854775808 =< N, N =< 9223372036854775807 -> ok;
-dialyzer({nowarn_function,v_type_int64/3}).
v_type_int64(N, _Path, _TrUserData) when is_integer(N), -9223372036854775808 =< N, N =< 9223372036854775807 -> ok;
v_type_int64(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int64, signed, 64}, N, Path);
v_type_int64(X, Path, _TrUserData) -> mk_type_error({bad_integer, int64, signed, 64}, X, Path).

-compile({nowarn_unused_function,v_type_string/3}).
-dialyzer({nowarn_function,v_type_string/3}).
v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) ->
try unicode:characters_to_binary(S) of
B when is_binary(B) -> ok;
Expand All @@ -613,8 +641,9 @@ mk_type_error(Error, ValueSeen, Path) ->


-compile({nowarn_unused_function,prettify_path/1}).
-dialyzer({nowarn_function,prettify_path/1}).
prettify_path([]) -> top_level;
prettify_path(PathR) -> string:join(lists:map(fun atom_to_list/1, lists:reverse(PathR)), ".").
prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))).


-compile({nowarn_unused_function,id/2}).
Expand Down Expand Up @@ -818,10 +847,10 @@ get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}).


gpb_version_as_string() ->
"4.17.6".
"4.21.1".

gpb_version_as_list() ->
[4,17,6].
[4,21,1].

gpb_version_source() ->
"file".
57 changes: 46 additions & 11 deletions src/hex_pb_package.erl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
%% -*- coding: utf-8 -*-
%% % this file is @generated
%% @private
%% Automatically generated, do not edit
%% Generated by gpb_compile version 4.17.6
%% Generated by gpb_compile version 4.21.1
%% Version source: file
-module(hex_pb_package).

Expand Down Expand Up @@ -85,9 +86,15 @@
-type '$msg'() :: 'Package'() | 'Release'() | 'RetirementStatus'() | 'Dependency'().
-export_type(['$msg_name'/0, '$msg'/0]).

-if(?OTP_RELEASE >= 24).
-dialyzer({no_underspecs, encode_msg/2}).
-endif.
-spec encode_msg('$msg'(), '$msg_name'()) -> binary().
encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []).

-if(?OTP_RELEASE >= 24).
-dialyzer({no_underspecs, encode_msg/3}).
-endif.
-spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary().
encode_msg(Msg, MsgName, Opts) ->
verify_msg(Msg, MsgName, Opts),
Expand Down Expand Up @@ -305,14 +312,21 @@ decode_msg(Bin, MsgName, Opts) when is_binary(Bin) ->
-ifdef('OTP_RELEASE').
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
catch
error:{gpb_error,_}=Reason:StackTrace ->
erlang:raise(error, Reason, StackTrace);
Class:Reason:StackTrace -> error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
-else.
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch Class:Reason ->
StackTrace = erlang:get_stacktrace(),
error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
catch
error:{gpb_error,_}=Reason ->
erlang:raise(error, Reason,
erlang:get_stacktrace());
Class:Reason ->
StackTrace = erlang:get_stacktrace(),
error({gpb_error,{decoding_failure, {Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
-endif.

Expand Down Expand Up @@ -793,11 +807,12 @@ verify_msg(Msg, MsgName, Opts) ->


-compile({nowarn_unused_function,v_msg_Package/3}).
-dialyzer({nowarn_function,v_msg_Package/3}).
v_msg_Package(#{name := F2, repository := F3} = M, Path, TrUserData) ->
case M of
#{releases := F1} ->
if is_list(F1) ->
_ = [v_msg_Release(Elem, [releases | Path], TrUserData) || Elem <- F1],
_ = [v_submsg_Release(Elem, [releases | Path], TrUserData) || Elem <- F1],
ok;
true -> mk_type_error({invalid_list_of, {msg, 'Release'}}, F1, [releases | Path])
end;
Expand All @@ -815,21 +830,26 @@ v_msg_Package(#{name := F2, repository := F3} = M, Path, TrUserData) ->
v_msg_Package(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [name, repository] -- maps:keys(M), 'Package'}, M, Path);
v_msg_Package(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Package'}, X, Path).

-compile({nowarn_unused_function,v_submsg_Release/3}).
-dialyzer({nowarn_function,v_submsg_Release/3}).
v_submsg_Release(Msg, Path, TrUserData) -> v_msg_Release(Msg, Path, TrUserData).

-compile({nowarn_unused_function,v_msg_Release/3}).
-dialyzer({nowarn_function,v_msg_Release/3}).
v_msg_Release(#{version := F1, inner_checksum := F2} = M, Path, TrUserData) ->
v_type_string(F1, [version | Path], TrUserData),
v_type_bytes(F2, [inner_checksum | Path], TrUserData),
case M of
#{dependencies := F3} ->
if is_list(F3) ->
_ = [v_msg_Dependency(Elem, [dependencies | Path], TrUserData) || Elem <- F3],
_ = [v_submsg_Dependency(Elem, [dependencies | Path], TrUserData) || Elem <- F3],
ok;
true -> mk_type_error({invalid_list_of, {msg, 'Dependency'}}, F3, [dependencies | Path])
end;
_ -> ok
end,
case M of
#{retired := F4} -> v_msg_RetirementStatus(F4, [retired | Path], TrUserData);
#{retired := F4} -> v_submsg_RetirementStatus(F4, [retired | Path], TrUserData);
_ -> ok
end,
case M of
Expand All @@ -848,7 +868,12 @@ v_msg_Release(#{version := F1, inner_checksum := F2} = M, Path, TrUserData) ->
v_msg_Release(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [version, inner_checksum] -- maps:keys(M), 'Release'}, M, Path);
v_msg_Release(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Release'}, X, Path).

-compile({nowarn_unused_function,v_submsg_RetirementStatus/3}).
-dialyzer({nowarn_function,v_submsg_RetirementStatus/3}).
v_submsg_RetirementStatus(Msg, Path, TrUserData) -> v_msg_RetirementStatus(Msg, Path, TrUserData).

-compile({nowarn_unused_function,v_msg_RetirementStatus/3}).
-dialyzer({nowarn_function,v_msg_RetirementStatus/3}).
v_msg_RetirementStatus(#{reason := F1} = M, Path, TrUserData) ->
v_enum_RetirementReason(F1, [reason | Path], TrUserData),
case M of
Expand All @@ -864,7 +889,12 @@ v_msg_RetirementStatus(#{reason := F1} = M, Path, TrUserData) ->
v_msg_RetirementStatus(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [reason] -- maps:keys(M), 'RetirementStatus'}, M, Path);
v_msg_RetirementStatus(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'RetirementStatus'}, X, Path).

-compile({nowarn_unused_function,v_submsg_Dependency/3}).
-dialyzer({nowarn_function,v_submsg_Dependency/3}).
v_submsg_Dependency(Msg, Path, TrUserData) -> v_msg_Dependency(Msg, Path, TrUserData).

-compile({nowarn_unused_function,v_msg_Dependency/3}).
-dialyzer({nowarn_function,v_msg_Dependency/3}).
v_msg_Dependency(#{package := F1, requirement := F2} = M, Path, TrUserData) ->
v_type_string(F1, [package | Path], TrUserData),
v_type_string(F2, [requirement | Path], TrUserData),
Expand Down Expand Up @@ -893,6 +923,7 @@ v_msg_Dependency(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_
v_msg_Dependency(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Dependency'}, X, Path).

-compile({nowarn_unused_function,v_enum_RetirementReason/3}).
-dialyzer({nowarn_function,v_enum_RetirementReason/3}).
v_enum_RetirementReason('RETIRED_OTHER', _Path, _TrUserData) -> ok;
v_enum_RetirementReason('RETIRED_INVALID', _Path, _TrUserData) -> ok;
v_enum_RetirementReason('RETIRED_SECURITY', _Path, _TrUserData) -> ok;
Expand All @@ -902,13 +933,15 @@ v_enum_RetirementReason(V, _Path, _TrUserData) when -2147483648 =< V, V =< 21474
v_enum_RetirementReason(X, Path, _TrUserData) -> mk_type_error({invalid_enum, 'RetirementReason'}, X, Path).

-compile({nowarn_unused_function,v_type_bool/3}).
-dialyzer({nowarn_function,v_type_bool/3}).
v_type_bool(false, _Path, _TrUserData) -> ok;
v_type_bool(true, _Path, _TrUserData) -> ok;
v_type_bool(0, _Path, _TrUserData) -> ok;
v_type_bool(1, _Path, _TrUserData) -> ok;
v_type_bool(X, Path, _TrUserData) -> mk_type_error(bad_boolean_value, X, Path).

-compile({nowarn_unused_function,v_type_string/3}).
-dialyzer({nowarn_function,v_type_string/3}).
v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) ->
try unicode:characters_to_binary(S) of
B when is_binary(B) -> ok;
Expand All @@ -919,6 +952,7 @@ v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) ->
v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path).

-compile({nowarn_unused_function,v_type_bytes/3}).
-dialyzer({nowarn_function,v_type_bytes/3}).
v_type_bytes(B, _Path, _TrUserData) when is_binary(B) -> ok;
v_type_bytes(B, _Path, _TrUserData) when is_list(B) -> ok;
v_type_bytes(X, Path, _TrUserData) -> mk_type_error(bad_binary_value, X, Path).
Expand All @@ -931,8 +965,9 @@ mk_type_error(Error, ValueSeen, Path) ->


-compile({nowarn_unused_function,prettify_path/1}).
-dialyzer({nowarn_function,prettify_path/1}).
prettify_path([]) -> top_level;
prettify_path(PathR) -> string:join(lists:map(fun atom_to_list/1, lists:reverse(PathR)), ".").
prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))).


-compile({nowarn_unused_function,id/2}).
Expand Down Expand Up @@ -1183,10 +1218,10 @@ get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}).


gpb_version_as_string() ->
"4.17.6".
"4.21.1".

gpb_version_as_list() ->
[4,17,6].
[4,21,1].

gpb_version_source() ->
"file".
Loading

0 comments on commit a93c925

Please sign in to comment.