google-protobuf 3.19.1 → 4.30.2
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.
- checksums.yaml +4 -4
- data/ext/google/protobuf_c/Rakefile +3 -0
- data/ext/google/protobuf_c/convert.c +153 -166
- data/ext/google/protobuf_c/convert.h +15 -37
- data/ext/google/protobuf_c/defs.c +867 -251
- data/ext/google/protobuf_c/defs.h +22 -47
- data/ext/google/protobuf_c/extconf.rb +25 -5
- data/ext/google/protobuf_c/glue.c +135 -0
- data/ext/google/protobuf_c/map.c +182 -145
- data/ext/google/protobuf_c/map.h +16 -35
- data/ext/google/protobuf_c/message.c +534 -437
- data/ext/google/protobuf_c/message.h +30 -49
- data/ext/google/protobuf_c/protobuf.c +125 -238
- data/ext/google/protobuf_c/protobuf.h +40 -49
- data/ext/google/protobuf_c/repeated_field.c +152 -120
- data/ext/google/protobuf_c/repeated_field.h +16 -34
- data/ext/google/protobuf_c/ruby-upb.c +15827 -7228
- data/ext/google/protobuf_c/ruby-upb.h +15075 -3866
- data/ext/google/protobuf_c/shared_convert.c +69 -0
- data/ext/google/protobuf_c/shared_convert.h +26 -0
- data/ext/google/protobuf_c/shared_message.c +37 -0
- data/ext/google/protobuf_c/shared_message.h +21 -0
- data/ext/google/protobuf_c/third_party/utf8_range/LICENSE +22 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.c +207 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range.h +22 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range_neon.inc +117 -0
- data/ext/google/protobuf_c/third_party/utf8_range/utf8_range_sse.inc +272 -0
- data/ext/google/protobuf_c/wrap_memcpy.c +7 -29
- data/lib/google/protobuf/any_pb.rb +6 -8
- data/lib/google/protobuf/api_pb.rb +6 -26
- data/lib/google/protobuf/descriptor_pb.rb +24 -225
- data/lib/google/protobuf/duration_pb.rb +6 -8
- data/lib/google/protobuf/empty_pb.rb +6 -6
- data/lib/google/protobuf/ffi/descriptor.rb +175 -0
- data/lib/google/protobuf/ffi/descriptor_pool.rb +77 -0
- data/lib/google/protobuf/ffi/enum_descriptor.rb +183 -0
- data/lib/google/protobuf/ffi/ffi.rb +214 -0
- data/lib/google/protobuf/ffi/field_descriptor.rb +340 -0
- data/lib/google/protobuf/ffi/file_descriptor.rb +59 -0
- data/lib/google/protobuf/ffi/internal/arena.rb +60 -0
- data/lib/google/protobuf/ffi/internal/convert.rb +292 -0
- data/lib/google/protobuf/ffi/internal/pointer_helper.rb +35 -0
- data/lib/google/protobuf/ffi/internal/type_safety.rb +25 -0
- data/lib/google/protobuf/ffi/map.rb +433 -0
- data/lib/google/protobuf/ffi/message.rb +783 -0
- data/lib/google/protobuf/ffi/method_descriptor.rb +124 -0
- data/lib/google/protobuf/ffi/object_cache.rb +30 -0
- data/lib/google/protobuf/ffi/oneof_descriptor.rb +107 -0
- data/lib/google/protobuf/ffi/repeated_field.rb +411 -0
- data/lib/google/protobuf/ffi/service_descriptor.rb +117 -0
- data/lib/google/protobuf/field_mask_pb.rb +6 -7
- data/lib/google/protobuf/internal/object_cache.rb +99 -0
- data/lib/google/protobuf/message_exts.rb +10 -28
- data/lib/google/protobuf/plugin_pb.rb +25 -0
- data/lib/google/protobuf/repeated_field.rb +22 -33
- data/lib/google/protobuf/source_context_pb.rb +6 -7
- data/lib/google/protobuf/struct_pb.rb +6 -23
- data/lib/google/protobuf/timestamp_pb.rb +6 -8
- data/lib/google/protobuf/type_pb.rb +6 -71
- data/lib/google/protobuf/well_known_types.rb +16 -40
- data/lib/google/protobuf/wrappers_pb.rb +6 -31
- data/lib/google/protobuf.rb +32 -50
- data/lib/google/protobuf_ffi.rb +52 -0
- data/lib/google/protobuf_native.rb +19 -0
- data/lib/google/tasks/ffi.rake +100 -0
- metadata +97 -20
- data/lib/google/protobuf/descriptor_dsl.rb +0 -458
- data/tests/basic.rb +0 -640
- data/tests/generated_code_test.rb +0 -23
- data/tests/stress.rb +0 -38
@@ -1,33 +1,10 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
# Protocol Buffers - Google's data interchange format
|
3
3
|
# Copyright 2008 Google Inc. All rights reserved.
|
4
|
-
# https://developers.google.com/protocol-buffers/
|
5
4
|
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# * Redistributions of source code must retain the above copyright
|
11
|
-
# notice, this list of conditions and the following disclaimer.
|
12
|
-
# * Redistributions in binary form must reproduce the above
|
13
|
-
# copyright notice, this list of conditions and the following disclaimer
|
14
|
-
# in the documentation and/or other materials provided with the
|
15
|
-
# distribution.
|
16
|
-
# * Neither the name of Google Inc. nor the names of its
|
17
|
-
# contributors may be used to endorse or promote products derived from
|
18
|
-
# this software without specific prior written permission.
|
19
|
-
#
|
20
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
-
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
-
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
5
|
+
# Use of this source code is governed by a BSD-style
|
6
|
+
# license that can be found in the LICENSE file or at
|
7
|
+
# https://developers.google.com/open-source/licenses/bsd
|
31
8
|
|
32
9
|
require 'google/protobuf/any_pb'
|
33
10
|
require 'google/protobuf/duration_pb'
|
@@ -72,14 +49,12 @@ module Google
|
|
72
49
|
end
|
73
50
|
|
74
51
|
Timestamp.class_eval do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
Time.at(seconds, nanos, :nanosecond)
|
82
|
-
end
|
52
|
+
def to_time
|
53
|
+
Time.at(seconds, nanos, :nanosecond)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.from_time(time)
|
57
|
+
new.from_time(time)
|
83
58
|
end
|
84
59
|
|
85
60
|
def from_time(time)
|
@@ -88,10 +63,6 @@ module Google
|
|
88
63
|
self
|
89
64
|
end
|
90
65
|
|
91
|
-
def self.from_time(time)
|
92
|
-
new.from_time(time)
|
93
|
-
end
|
94
|
-
|
95
66
|
def to_i
|
96
67
|
self.seconds
|
97
68
|
end
|
@@ -137,10 +108,14 @@ module Google
|
|
137
108
|
end
|
138
109
|
end
|
139
110
|
|
111
|
+
def self.from_ruby(value)
|
112
|
+
self.new.from_ruby(value)
|
113
|
+
end
|
114
|
+
|
140
115
|
def from_ruby(value)
|
141
116
|
case value
|
142
117
|
when NilClass
|
143
|
-
self.null_value =
|
118
|
+
self.null_value = :NULL_VALUE
|
144
119
|
when Numeric
|
145
120
|
self.number_value = value
|
146
121
|
when String
|
@@ -160,6 +135,8 @@ module Google
|
|
160
135
|
else
|
161
136
|
raise UnexpectedStructType
|
162
137
|
end
|
138
|
+
|
139
|
+
self
|
163
140
|
end
|
164
141
|
end
|
165
142
|
|
@@ -230,6 +207,5 @@ module Google
|
|
230
207
|
ret
|
231
208
|
end
|
232
209
|
end
|
233
|
-
|
234
210
|
end
|
235
211
|
end
|
@@ -1,39 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
3
|
# source: google/protobuf/wrappers.proto
|
3
4
|
|
4
5
|
require 'google/protobuf'
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
add_message "google.protobuf.FloatValue" do
|
12
|
-
optional :value, :float, 1
|
13
|
-
end
|
14
|
-
add_message "google.protobuf.Int64Value" do
|
15
|
-
optional :value, :int64, 1
|
16
|
-
end
|
17
|
-
add_message "google.protobuf.UInt64Value" do
|
18
|
-
optional :value, :uint64, 1
|
19
|
-
end
|
20
|
-
add_message "google.protobuf.Int32Value" do
|
21
|
-
optional :value, :int32, 1
|
22
|
-
end
|
23
|
-
add_message "google.protobuf.UInt32Value" do
|
24
|
-
optional :value, :uint32, 1
|
25
|
-
end
|
26
|
-
add_message "google.protobuf.BoolValue" do
|
27
|
-
optional :value, :bool, 1
|
28
|
-
end
|
29
|
-
add_message "google.protobuf.StringValue" do
|
30
|
-
optional :value, :string, 1
|
31
|
-
end
|
32
|
-
add_message "google.protobuf.BytesValue" do
|
33
|
-
optional :value, :bytes, 1
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
7
|
+
|
8
|
+
descriptor_data = "\n\x1egoogle/protobuf/wrappers.proto\x12\x0fgoogle.protobuf\"\x1c\n\x0b\x44oubleValue\x12\r\n\x05value\x18\x01 \x01(\x01\"\x1b\n\nFloatValue\x12\r\n\x05value\x18\x01 \x01(\x02\"\x1b\n\nInt64Value\x12\r\n\x05value\x18\x01 \x01(\x03\"\x1c\n\x0bUInt64Value\x12\r\n\x05value\x18\x01 \x01(\x04\"\x1b\n\nInt32Value\x12\r\n\x05value\x18\x01 \x01(\x05\"\x1c\n\x0bUInt32Value\x12\r\n\x05value\x18\x01 \x01(\r\"\x1a\n\tBoolValue\x12\r\n\x05value\x18\x01 \x01(\x08\"\x1c\n\x0bStringValue\x12\r\n\x05value\x18\x01 \x01(\t\"\x1b\n\nBytesValue\x12\r\n\x05value\x18\x01 \x01(\x0c\x42\x83\x01\n\x13\x63om.google.protobufB\rWrappersProtoP\x01Z1google.golang.org/protobuf/types/known/wrapperspb\xf8\x01\x01\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3"
|
9
|
+
|
10
|
+
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
37
12
|
|
38
13
|
module Google
|
39
14
|
module Protobuf
|
data/lib/google/protobuf.rb
CHANGED
@@ -1,35 +1,13 @@
|
|
1
1
|
# Protocol Buffers - Google's data interchange format
|
2
2
|
# Copyright 2008 Google Inc. All rights reserved.
|
3
|
-
# https://developers.google.com/protocol-buffers/
|
4
3
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# * Redistributions of source code must retain the above copyright
|
10
|
-
# notice, this list of conditions and the following disclaimer.
|
11
|
-
# * Redistributions in binary form must reproduce the above
|
12
|
-
# copyright notice, this list of conditions and the following disclaimer
|
13
|
-
# in the documentation and/or other materials provided with the
|
14
|
-
# distribution.
|
15
|
-
# * Neither the name of Google Inc. nor the names of its
|
16
|
-
# contributors may be used to endorse or promote products derived from
|
17
|
-
# this software without specific prior written permission.
|
18
|
-
#
|
19
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
20
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
21
|
-
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
22
|
-
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
23
|
-
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
24
|
-
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
25
|
-
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
26
|
-
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
27
|
-
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
28
|
-
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
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
|
30
7
|
|
31
8
|
# require mixins before we hook them into the java & c code
|
32
9
|
require 'google/protobuf/message_exts'
|
10
|
+
require 'google/protobuf/internal/object_cache'
|
33
11
|
|
34
12
|
# We define these before requiring the platform-specific modules.
|
35
13
|
# That way the module init can grab references to these.
|
@@ -38,42 +16,46 @@ module Google
|
|
38
16
|
class Error < StandardError; end
|
39
17
|
class ParseError < Error; end
|
40
18
|
class TypeError < ::TypeError; end
|
41
|
-
end
|
42
|
-
end
|
43
19
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
require 'google/protobuf/descriptor_dsl'
|
57
|
-
require 'google/protobuf/repeated_field'
|
58
|
-
|
59
|
-
module Google
|
60
|
-
module Protobuf
|
61
|
-
|
62
|
-
def self.encode(msg)
|
63
|
-
msg.to_proto
|
20
|
+
PREFER_FFI = case ENV['PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION']
|
21
|
+
when nil, "", /^native$/i
|
22
|
+
false
|
23
|
+
when /^ffi$/i
|
24
|
+
true
|
25
|
+
else
|
26
|
+
warn "Unexpected value `#{ENV['PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION']}` for environment variable `PROTOCOL_BUFFERS_RUBY_IMPLEMENTATION`. Should be either \"FFI\", \"NATIVE\"."
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.encode(msg, options = {})
|
31
|
+
msg.to_proto(options)
|
64
32
|
end
|
65
33
|
|
66
34
|
def self.encode_json(msg, options = {})
|
67
35
|
msg.to_json(options)
|
68
36
|
end
|
69
37
|
|
70
|
-
def self.decode(klass, proto)
|
71
|
-
klass.decode(proto)
|
38
|
+
def self.decode(klass, proto, options = {})
|
39
|
+
klass.decode(proto, options)
|
72
40
|
end
|
73
41
|
|
74
42
|
def self.decode_json(klass, json, options = {})
|
75
43
|
klass.decode_json(json, options)
|
76
44
|
end
|
77
45
|
|
46
|
+
IMPLEMENTATION = if PREFER_FFI
|
47
|
+
begin
|
48
|
+
require 'google/protobuf_ffi'
|
49
|
+
:FFI
|
50
|
+
rescue LoadError
|
51
|
+
warn "Caught exception `#{$!.message}` while loading FFI implementation of google/protobuf."
|
52
|
+
warn "Falling back to native implementation."
|
53
|
+
require 'google/protobuf_native'
|
54
|
+
:NATIVE
|
55
|
+
end
|
56
|
+
else
|
57
|
+
require 'google/protobuf_native'
|
58
|
+
:NATIVE
|
59
|
+
end
|
78
60
|
end
|
79
61
|
end
|
@@ -0,0 +1,52 @@
|
|
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
|
+
require 'ffi-compiler/loader'
|
9
|
+
require 'google/protobuf/ffi/ffi'
|
10
|
+
require 'google/protobuf/ffi/internal/type_safety'
|
11
|
+
require 'google/protobuf/ffi/internal/pointer_helper'
|
12
|
+
require 'google/protobuf/ffi/internal/arena'
|
13
|
+
require 'google/protobuf/ffi/internal/convert'
|
14
|
+
require 'google/protobuf/ffi/descriptor'
|
15
|
+
require 'google/protobuf/ffi/enum_descriptor'
|
16
|
+
require 'google/protobuf/ffi/field_descriptor'
|
17
|
+
require 'google/protobuf/ffi/oneof_descriptor'
|
18
|
+
require 'google/protobuf/ffi/method_descriptor'
|
19
|
+
require 'google/protobuf/ffi/service_descriptor'
|
20
|
+
require 'google/protobuf/ffi/descriptor_pool'
|
21
|
+
require 'google/protobuf/ffi/file_descriptor'
|
22
|
+
require 'google/protobuf/ffi/map'
|
23
|
+
require 'google/protobuf/ffi/object_cache'
|
24
|
+
require 'google/protobuf/ffi/repeated_field'
|
25
|
+
require 'google/protobuf/ffi/message'
|
26
|
+
|
27
|
+
module Google
|
28
|
+
module Protobuf
|
29
|
+
def self.deep_copy(object)
|
30
|
+
case object
|
31
|
+
when RepeatedField
|
32
|
+
RepeatedField.send(:deep_copy, object)
|
33
|
+
when Google::Protobuf::Map
|
34
|
+
Google::Protobuf::Map.deep_copy(object)
|
35
|
+
when Google::Protobuf::MessageExts
|
36
|
+
object.class.send(:deep_copy, object.instance_variable_get(:@msg))
|
37
|
+
else
|
38
|
+
raise NotImplementedError
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.discard_unknown(message)
|
43
|
+
raise FrozenError if message.frozen?
|
44
|
+
raise ArgumentError.new "Expected message, got #{message.class} instead." if message.instance_variable_get(:@msg).nil?
|
45
|
+
pool_def = message.class.descriptor.instance_variable_get(:@descriptor_pool).descriptor_pool
|
46
|
+
unless Google::Protobuf::FFI.message_discard_unknown(message.instance_variable_get(:@msg), message.class.descriptor, pool_def, 128)
|
47
|
+
raise RuntimeError.new "Messages nested too deeply."
|
48
|
+
end
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -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,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-protobuf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.30.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Protobuf Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-03-26 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: bigdecimal
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - ">="
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
21
39
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
23
|
-
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13'
|
48
|
+
type: :runtime
|
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:
|
30
|
-
|
54
|
+
version: '13'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ffi
|
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
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ffi-compiler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
31
81
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
82
|
+
version: '1'
|
33
83
|
- !ruby/object:Gem::Dependency
|
34
84
|
name: rake-compiler
|
35
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -69,13 +119,16 @@ email: protobuf@googlegroups.com
|
|
69
119
|
executables: []
|
70
120
|
extensions:
|
71
121
|
- ext/google/protobuf_c/extconf.rb
|
122
|
+
- ext/google/protobuf_c/Rakefile
|
72
123
|
extra_rdoc_files: []
|
73
124
|
files:
|
125
|
+
- ext/google/protobuf_c/Rakefile
|
74
126
|
- ext/google/protobuf_c/convert.c
|
75
127
|
- ext/google/protobuf_c/convert.h
|
76
128
|
- ext/google/protobuf_c/defs.c
|
77
129
|
- ext/google/protobuf_c/defs.h
|
78
130
|
- ext/google/protobuf_c/extconf.rb
|
131
|
+
- ext/google/protobuf_c/glue.c
|
79
132
|
- ext/google/protobuf_c/map.c
|
80
133
|
- ext/google/protobuf_c/map.h
|
81
134
|
- ext/google/protobuf_c/message.c
|
@@ -86,16 +139,43 @@ files:
|
|
86
139
|
- ext/google/protobuf_c/repeated_field.h
|
87
140
|
- ext/google/protobuf_c/ruby-upb.c
|
88
141
|
- ext/google/protobuf_c/ruby-upb.h
|
142
|
+
- ext/google/protobuf_c/shared_convert.c
|
143
|
+
- ext/google/protobuf_c/shared_convert.h
|
144
|
+
- ext/google/protobuf_c/shared_message.c
|
145
|
+
- ext/google/protobuf_c/shared_message.h
|
146
|
+
- ext/google/protobuf_c/third_party/utf8_range/LICENSE
|
147
|
+
- ext/google/protobuf_c/third_party/utf8_range/utf8_range.c
|
148
|
+
- ext/google/protobuf_c/third_party/utf8_range/utf8_range.h
|
149
|
+
- ext/google/protobuf_c/third_party/utf8_range/utf8_range_neon.inc
|
150
|
+
- ext/google/protobuf_c/third_party/utf8_range/utf8_range_sse.inc
|
89
151
|
- ext/google/protobuf_c/wrap_memcpy.c
|
90
152
|
- lib/google/protobuf.rb
|
91
153
|
- lib/google/protobuf/any_pb.rb
|
92
154
|
- lib/google/protobuf/api_pb.rb
|
93
|
-
- lib/google/protobuf/descriptor_dsl.rb
|
94
155
|
- lib/google/protobuf/descriptor_pb.rb
|
95
156
|
- lib/google/protobuf/duration_pb.rb
|
96
157
|
- lib/google/protobuf/empty_pb.rb
|
158
|
+
- lib/google/protobuf/ffi/descriptor.rb
|
159
|
+
- lib/google/protobuf/ffi/descriptor_pool.rb
|
160
|
+
- lib/google/protobuf/ffi/enum_descriptor.rb
|
161
|
+
- lib/google/protobuf/ffi/ffi.rb
|
162
|
+
- lib/google/protobuf/ffi/field_descriptor.rb
|
163
|
+
- lib/google/protobuf/ffi/file_descriptor.rb
|
164
|
+
- lib/google/protobuf/ffi/internal/arena.rb
|
165
|
+
- lib/google/protobuf/ffi/internal/convert.rb
|
166
|
+
- lib/google/protobuf/ffi/internal/pointer_helper.rb
|
167
|
+
- lib/google/protobuf/ffi/internal/type_safety.rb
|
168
|
+
- lib/google/protobuf/ffi/map.rb
|
169
|
+
- lib/google/protobuf/ffi/message.rb
|
170
|
+
- lib/google/protobuf/ffi/method_descriptor.rb
|
171
|
+
- lib/google/protobuf/ffi/object_cache.rb
|
172
|
+
- lib/google/protobuf/ffi/oneof_descriptor.rb
|
173
|
+
- lib/google/protobuf/ffi/repeated_field.rb
|
174
|
+
- lib/google/protobuf/ffi/service_descriptor.rb
|
97
175
|
- lib/google/protobuf/field_mask_pb.rb
|
176
|
+
- lib/google/protobuf/internal/object_cache.rb
|
98
177
|
- lib/google/protobuf/message_exts.rb
|
178
|
+
- lib/google/protobuf/plugin_pb.rb
|
99
179
|
- lib/google/protobuf/repeated_field.rb
|
100
180
|
- lib/google/protobuf/source_context_pb.rb
|
101
181
|
- lib/google/protobuf/struct_pb.rb
|
@@ -103,14 +183,14 @@ files:
|
|
103
183
|
- lib/google/protobuf/type_pb.rb
|
104
184
|
- lib/google/protobuf/well_known_types.rb
|
105
185
|
- lib/google/protobuf/wrappers_pb.rb
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
186
|
+
- lib/google/protobuf_ffi.rb
|
187
|
+
- lib/google/protobuf_native.rb
|
188
|
+
- lib/google/tasks/ffi.rake
|
109
189
|
homepage: https://developers.google.com/protocol-buffers
|
110
190
|
licenses:
|
111
191
|
- BSD-3-Clause
|
112
192
|
metadata:
|
113
|
-
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/
|
193
|
+
source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v4.30.2/ruby
|
114
194
|
post_install_message:
|
115
195
|
rdoc_options: []
|
116
196
|
require_paths:
|
@@ -119,18 +199,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
199
|
requirements:
|
120
200
|
- - ">="
|
121
201
|
- !ruby/object:Gem::Version
|
122
|
-
version: '
|
202
|
+
version: '3.0'
|
123
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
204
|
requirements:
|
125
205
|
- - ">="
|
126
206
|
- !ruby/object:Gem::Version
|
127
207
|
version: '0'
|
128
208
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
209
|
+
rubygems_version: 3.5.16
|
130
210
|
signing_key:
|
131
211
|
specification_version: 4
|
132
212
|
summary: Protocol Buffers
|
133
|
-
test_files:
|
134
|
-
- tests/basic.rb
|
135
|
-
- tests/stress.rb
|
136
|
-
- tests/generated_code_test.rb
|
213
|
+
test_files: []
|