google-protobuf 3.14.0 → 4.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of google-protobuf might be problematic. Click here for more details.

Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/ext/google/protobuf_c/Rakefile +3 -0
  3. data/ext/google/protobuf_c/convert.c +317 -0
  4. data/ext/google/protobuf_c/convert.h +50 -0
  5. data/ext/google/protobuf_c/defs.c +759 -1709
  6. data/ext/google/protobuf_c/defs.h +82 -0
  7. data/ext/google/protobuf_c/extconf.rb +15 -8
  8. data/ext/google/protobuf_c/glue.c +56 -0
  9. data/ext/google/protobuf_c/map.c +328 -485
  10. data/ext/google/protobuf_c/map.h +44 -0
  11. data/ext/google/protobuf_c/message.c +1061 -530
  12. data/ext/google/protobuf_c/message.h +86 -0
  13. data/ext/google/protobuf_c/protobuf.c +314 -94
  14. data/ext/google/protobuf_c/protobuf.h +66 -621
  15. data/ext/google/protobuf_c/repeated_field.c +314 -353
  16. data/ext/google/protobuf_c/repeated_field.h +41 -0
  17. data/ext/google/protobuf_c/ruby-upb.c +15407 -0
  18. data/ext/google/protobuf_c/ruby-upb.h +13966 -0
  19. data/ext/google/protobuf_c/shared_convert.c +66 -0
  20. data/ext/google/protobuf_c/shared_convert.h +26 -0
  21. data/ext/google/protobuf_c/shared_message.c +67 -0
  22. data/ext/google/protobuf_c/shared_message.h +25 -0
  23. data/ext/google/protobuf_c/third_party/utf8_range/LICENSE +22 -0
  24. data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.c +467 -0
  25. data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.h +22 -0
  26. data/ext/google/protobuf_c/wrap_memcpy.c +7 -29
  27. data/lib/google/protobuf/any_pb.rb +6 -8
  28. data/lib/google/protobuf/api_pb.rb +7 -26
  29. data/lib/google/protobuf/descriptor_pb.rb +65 -0
  30. data/lib/google/protobuf/duration_pb.rb +6 -8
  31. data/lib/google/protobuf/empty_pb.rb +6 -6
  32. data/lib/google/protobuf/ffi/descriptor.rb +164 -0
  33. data/lib/google/protobuf/ffi/descriptor_pool.rb +75 -0
  34. data/lib/google/protobuf/ffi/enum_descriptor.rb +171 -0
  35. data/lib/google/protobuf/ffi/ffi.rb +215 -0
  36. data/lib/google/protobuf/ffi/field_descriptor.rb +328 -0
  37. data/lib/google/protobuf/ffi/file_descriptor.rb +47 -0
  38. data/lib/google/protobuf/ffi/internal/arena.rb +66 -0
  39. data/lib/google/protobuf/ffi/internal/convert.rb +289 -0
  40. data/lib/google/protobuf/ffi/internal/pointer_helper.rb +35 -0
  41. data/lib/google/protobuf/ffi/internal/type_safety.rb +25 -0
  42. data/lib/google/protobuf/ffi/map.rb +409 -0
  43. data/lib/google/protobuf/ffi/message.rb +659 -0
  44. data/lib/google/protobuf/ffi/object_cache.rb +30 -0
  45. data/lib/google/protobuf/ffi/oneof_descriptor.rb +95 -0
  46. data/lib/google/protobuf/ffi/repeated_field.rb +385 -0
  47. data/lib/google/protobuf/field_mask_pb.rb +6 -7
  48. data/lib/google/protobuf/internal/object_cache.rb +99 -0
  49. data/lib/google/protobuf/message_exts.rb +10 -28
  50. data/lib/google/protobuf/plugin_pb.rb +25 -0
  51. data/lib/google/protobuf/repeated_field.rb +19 -30
  52. data/lib/google/protobuf/source_context_pb.rb +6 -7
  53. data/lib/google/protobuf/struct_pb.rb +6 -23
  54. data/lib/google/protobuf/timestamp_pb.rb +6 -8
  55. data/lib/google/protobuf/type_pb.rb +7 -71
  56. data/lib/google/protobuf/well_known_types.rb +17 -36
  57. data/lib/google/protobuf/wrappers_pb.rb +6 -31
  58. data/lib/google/protobuf.rb +32 -118
  59. data/lib/google/protobuf_ffi.rb +49 -0
  60. data/lib/google/protobuf_native.rb +19 -0
  61. data/lib/google/tasks/ffi.rake +100 -0
  62. metadata +88 -37
  63. data/ext/google/protobuf_c/encode_decode.c +0 -1795
  64. data/ext/google/protobuf_c/storage.c +0 -1198
  65. data/ext/google/protobuf_c/upb.c +0 -13817
  66. data/ext/google/protobuf_c/upb.h +0 -6777
  67. data/tests/basic.rb +0 -543
  68. data/tests/generated_code_test.rb +0 -23
  69. data/tests/stress.rb +0 -38
@@ -0,0 +1,19 @@
1
+ # Protocol Buffers - Google's data interchange format
2
+ # Copyright 2023 Google Inc. All rights reserved.
3
+ #
4
+ # Use of this source code is governed by a BSD-style
5
+ # license that can be found in the LICENSE file or at
6
+ # https://developers.google.com/open-source/licenses/bsd
7
+
8
+ if RUBY_PLATFORM == "java"
9
+ require 'json'
10
+ require 'google/protobuf_java'
11
+ else
12
+ begin
13
+ require "google/#{RUBY_VERSION.sub(/\.\d+$/, '')}/protobuf_c"
14
+ rescue LoadError
15
+ require 'google/protobuf_c'
16
+ end
17
+ end
18
+
19
+ require 'google/protobuf/repeated_field'
@@ -0,0 +1,100 @@
1
+ # # @param task [FFI::Compiler::CompileTask] task to configure
2
+ def configure_common_compile_task(task)
3
+ if FileUtils.pwd.include? 'ext'
4
+ src_dir = '.'
5
+ third_party_path = 'third_party/utf8_range'
6
+ else
7
+ src_dir = 'ext/google/protobuf_c'
8
+ third_party_path = 'ext/google/protobuf_c/third_party/utf8_range'
9
+ end
10
+
11
+ task.add_include_path third_party_path
12
+ task.add_define 'NDEBUG'
13
+ task.cflags << "-std=gnu99 -O3"
14
+ [
15
+ :convert, :defs, :map, :message, :protobuf, :repeated_field, :wrap_memcpy
16
+ ].each { |file| task.exclude << "/#{file}.c" }
17
+ task.ext_dir = src_dir
18
+ task.source_dirs = [src_dir]
19
+ if RbConfig::CONFIG['target_os'] =~ /darwin|linux/
20
+ task.cflags << "-Wall -Wsign-compare -Wno-declaration-after-statement"
21
+ end
22
+ end
23
+
24
+ # FFI::CompilerTask's constructor walks the filesystem at task definition time
25
+ # to create subtasks for each source file, so files from third_party must be
26
+ # copied into place before the task is defined for it to work correctly.
27
+ # TODO Is there a sane way to check for generated protos under lib too?
28
+ def with_generated_files
29
+ expected_path = FileUtils.pwd.include?('ext') ? 'third_party/utf8_range' : 'ext/google/protobuf_c/third_party/utf8_range'
30
+ if File.directory?(expected_path)
31
+ yield
32
+ else
33
+ task :default do
34
+ # It is possible, especially in cases like the first invocation of
35
+ # `rake test` following `rake clean` or a fresh checkout that the
36
+ # `copy_third_party` task has been executed since initial task definition.
37
+ # If so, run the task definition block now and invoke it explicitly.
38
+ if File.directory?(expected_path)
39
+ yield
40
+ Rake::Task[:default].invoke
41
+ else
42
+ raise "Missing directory #{File.absolute_path(expected_path)}." +
43
+ " Did you forget to run `rake copy_third_party` before building" +
44
+ " native extensions?"
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ begin
51
+ require "ffi-compiler/compile_task"
52
+
53
+ desc "Compile Protobuf library for FFI"
54
+ namespace "ffi-protobuf" do
55
+ with_generated_files do
56
+ # Compile Ruby UPB separately in order to limit use of -DUPB_BUILD_API to one
57
+ # compilation unit.
58
+ desc "Compile UPB library for FFI"
59
+ namespace "ffi-upb" do
60
+ with_generated_files do
61
+ FFI::Compiler::CompileTask.new('ruby-upb') do |c|
62
+ configure_common_compile_task c
63
+ c.add_define "UPB_BUILD_API"
64
+ c.exclude << "/glue.c"
65
+ c.exclude << "/shared_message.c"
66
+ c.exclude << "/shared_convert.c"
67
+ if RbConfig::CONFIG['target_os'] =~ /darwin|linux/
68
+ c.cflags << "-fvisibility=hidden"
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ FFI::Compiler::CompileTask.new 'protobuf_c_ffi' do |c|
75
+ configure_common_compile_task c
76
+ # Ruby UPB was already compiled with different flags.
77
+ c.exclude << "/utf8_range.c"
78
+ c.exclude << "/ruby-upb.c"
79
+ end
80
+
81
+ # Setup dependencies so that the .o files generated by building ffi-upb are
82
+ # available to link here.
83
+ # TODO Can this be simplified? Can the single shared library be used
84
+ # instead of the object files?
85
+ protobuf_c_task = Rake::Task[:default]
86
+ protobuf_c_shared_lib_task = Rake::Task[protobuf_c_task.prereqs.last]
87
+ ruby_upb_shared_lib_task = Rake::Task[:"ffi-upb:default"].prereqs.first
88
+ Rake::Task[ruby_upb_shared_lib_task].prereqs.each do |dependency|
89
+ protobuf_c_shared_lib_task.prereqs.prepend dependency
90
+ end
91
+ end
92
+ end
93
+ rescue LoadError
94
+ desc "Compile Protobuf library for FFI"
95
+ namespace "ffi-protobuf" do
96
+ task :default do
97
+ warn "Skipping build of FFI; `gem install ffi-compiler` to enable."
98
+ end
99
+ end
100
+ end
metadata CHANGED
@@ -1,35 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.14.0
4
+ version: 4.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-13 00:00:00.000000000 Z
11
+ date: 2024-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.2.1
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.2.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - ">="
18
32
  - !ruby/object:Gem::Version
19
- version: 1.0.1
20
- - - "<"
33
+ version: '13'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '13'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ffi
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
21
46
  - !ruby/object:Gem::Version
22
- version: '2.0'
47
+ version: '1'
23
48
  type: :development
24
49
  prerelease: false
25
50
  version_requirements: !ruby/object:Gem::Requirement
26
51
  requirements:
27
- - - ">="
52
+ - - "~>"
28
53
  - !ruby/object:Gem::Version
29
- version: 1.0.1
30
- - - "<"
54
+ version: '1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ffi-compiler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
31
67
  - !ruby/object:Gem::Version
32
- version: '2.0'
68
+ version: '1'
33
69
  - !ruby/object:Gem::Dependency
34
70
  name: rake-compiler
35
71
  requirement: !ruby/object:Gem::Requirement
@@ -64,46 +100,64 @@ dependencies:
64
100
  - - ">="
65
101
  - !ruby/object:Gem::Version
66
102
  version: 3.0.9
67
- - !ruby/object:Gem::Dependency
68
- name: rubygems-tasks
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: 0.2.4
74
- type: :development
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: 0.2.4
81
103
  description: Protocol Buffers are Google's data interchange format.
82
104
  email: protobuf@googlegroups.com
83
105
  executables: []
84
106
  extensions:
85
107
  - ext/google/protobuf_c/extconf.rb
108
+ - ext/google/protobuf_c/Rakefile
86
109
  extra_rdoc_files: []
87
110
  files:
111
+ - ext/google/protobuf_c/Rakefile
112
+ - ext/google/protobuf_c/convert.c
113
+ - ext/google/protobuf_c/convert.h
88
114
  - ext/google/protobuf_c/defs.c
89
- - ext/google/protobuf_c/encode_decode.c
115
+ - ext/google/protobuf_c/defs.h
90
116
  - ext/google/protobuf_c/extconf.rb
117
+ - ext/google/protobuf_c/glue.c
91
118
  - ext/google/protobuf_c/map.c
119
+ - ext/google/protobuf_c/map.h
92
120
  - ext/google/protobuf_c/message.c
121
+ - ext/google/protobuf_c/message.h
93
122
  - ext/google/protobuf_c/protobuf.c
94
123
  - ext/google/protobuf_c/protobuf.h
95
124
  - ext/google/protobuf_c/repeated_field.c
96
- - ext/google/protobuf_c/storage.c
97
- - ext/google/protobuf_c/upb.c
98
- - ext/google/protobuf_c/upb.h
125
+ - ext/google/protobuf_c/repeated_field.h
126
+ - ext/google/protobuf_c/ruby-upb.c
127
+ - ext/google/protobuf_c/ruby-upb.h
128
+ - ext/google/protobuf_c/shared_convert.c
129
+ - ext/google/protobuf_c/shared_convert.h
130
+ - ext/google/protobuf_c/shared_message.c
131
+ - ext/google/protobuf_c/shared_message.h
132
+ - ext/google/protobuf_c/third_party/utf8_range/LICENSE
133
+ - ext/google/protobuf_c/third_party/utf8_range/utf8_range.c
134
+ - ext/google/protobuf_c/third_party/utf8_range/utf8_range.h
99
135
  - ext/google/protobuf_c/wrap_memcpy.c
100
136
  - lib/google/protobuf.rb
101
137
  - lib/google/protobuf/any_pb.rb
102
138
  - lib/google/protobuf/api_pb.rb
139
+ - lib/google/protobuf/descriptor_pb.rb
103
140
  - lib/google/protobuf/duration_pb.rb
104
141
  - lib/google/protobuf/empty_pb.rb
142
+ - lib/google/protobuf/ffi/descriptor.rb
143
+ - lib/google/protobuf/ffi/descriptor_pool.rb
144
+ - lib/google/protobuf/ffi/enum_descriptor.rb
145
+ - lib/google/protobuf/ffi/ffi.rb
146
+ - lib/google/protobuf/ffi/field_descriptor.rb
147
+ - lib/google/protobuf/ffi/file_descriptor.rb
148
+ - lib/google/protobuf/ffi/internal/arena.rb
149
+ - lib/google/protobuf/ffi/internal/convert.rb
150
+ - lib/google/protobuf/ffi/internal/pointer_helper.rb
151
+ - lib/google/protobuf/ffi/internal/type_safety.rb
152
+ - lib/google/protobuf/ffi/map.rb
153
+ - lib/google/protobuf/ffi/message.rb
154
+ - lib/google/protobuf/ffi/object_cache.rb
155
+ - lib/google/protobuf/ffi/oneof_descriptor.rb
156
+ - lib/google/protobuf/ffi/repeated_field.rb
105
157
  - lib/google/protobuf/field_mask_pb.rb
158
+ - lib/google/protobuf/internal/object_cache.rb
106
159
  - lib/google/protobuf/message_exts.rb
160
+ - lib/google/protobuf/plugin_pb.rb
107
161
  - lib/google/protobuf/repeated_field.rb
108
162
  - lib/google/protobuf/source_context_pb.rb
109
163
  - lib/google/protobuf/struct_pb.rb
@@ -111,14 +165,14 @@ files:
111
165
  - lib/google/protobuf/type_pb.rb
112
166
  - lib/google/protobuf/well_known_types.rb
113
167
  - lib/google/protobuf/wrappers_pb.rb
114
- - tests/basic.rb
115
- - tests/generated_code_test.rb
116
- - tests/stress.rb
168
+ - lib/google/protobuf_ffi.rb
169
+ - lib/google/protobuf_native.rb
170
+ - lib/google/tasks/ffi.rake
117
171
  homepage: https://developers.google.com/protocol-buffers
118
172
  licenses:
119
173
  - BSD-3-Clause
120
174
  metadata:
121
- source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.14.0/ruby
175
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.26.1/ruby
122
176
  post_install_message:
123
177
  rdoc_options: []
124
178
  require_paths:
@@ -127,18 +181,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
181
  requirements:
128
182
  - - ">="
129
183
  - !ruby/object:Gem::Version
130
- version: '2.3'
184
+ version: '2.7'
131
185
  required_rubygems_version: !ruby/object:Gem::Requirement
132
186
  requirements:
133
187
  - - ">="
134
188
  - !ruby/object:Gem::Version
135
189
  version: '0'
136
190
  requirements: []
137
- rubygems_version: 3.1.4
191
+ rubygems_version: 3.0.8
138
192
  signing_key:
139
193
  specification_version: 4
140
194
  summary: Protocol Buffers
141
- test_files:
142
- - tests/basic.rb
143
- - tests/stress.rb
144
- - tests/generated_code_test.rb
195
+ test_files: []