google-protobuf 3.9.2-x86-mingw32 → 3.10.0.rc.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Binary file
Binary file
Binary file
Binary file
@@ -50,6 +50,72 @@ else
50
50
  rescue LoadError
51
51
  require 'google/protobuf_c'
52
52
  end
53
+
54
+ module Google
55
+ module Protobuf
56
+ module Internal
57
+ def self.infer_package(names)
58
+ # Package is longest common prefix ending in '.', if any.
59
+ min, max = names.minmax
60
+ last_common_dot = nil
61
+ min.size.times { |i|
62
+ if min[i] != max[i] then break end
63
+ if min[i] == ?. then last_common_dot = i end
64
+ }
65
+ if last_common_dot
66
+ return min.slice(0, last_common_dot)
67
+ end
68
+ end
69
+
70
+ class NestingBuilder
71
+ def initialize(msg_names, enum_names)
72
+ @to_pos = {nil=>nil}
73
+ @msg_children = Hash.new { |hash, key| hash[key] = [] }
74
+ @enum_children = Hash.new { |hash, key| hash[key] = [] }
75
+
76
+ msg_names.each_with_index { |name, idx| @to_pos[name] = idx }
77
+ enum_names.each_with_index { |name, idx| @to_pos[name] = idx }
78
+
79
+ msg_names.each { |name| @msg_children[parent(name)] << name }
80
+ enum_names.each { |name| @enum_children[parent(name)] << name }
81
+ end
82
+
83
+ def build(package)
84
+ return build_msg(package)
85
+ end
86
+
87
+ private
88
+ def build_msg(msg)
89
+ return {
90
+ :pos => @to_pos[msg],
91
+ :msgs => @msg_children[msg].map { |child| build_msg(child) },
92
+ :enums => @enum_children[msg].map { |child| @to_pos[child] },
93
+ }
94
+ end
95
+
96
+ private
97
+ def parent(name)
98
+ idx = name.rindex(?.)
99
+ if idx
100
+ return name.slice(0, idx)
101
+ else
102
+ return nil
103
+ end
104
+ end
105
+ end
106
+
107
+ def self.fixup_descriptor(package, msg_names, enum_names)
108
+ if package.nil?
109
+ package = self.infer_package(msg_names + enum_names)
110
+ end
111
+
112
+ nesting = NestingBuilder.new(msg_names, enum_names).build(package)
113
+
114
+ return package, nesting
115
+ end
116
+ end
117
+ end
118
+ end
53
119
  end
54
120
 
55
121
  require 'google/protobuf/repeated_field'
@@ -14,6 +14,6 @@ end
14
14
 
15
15
  module Google
16
16
  module Protobuf
17
- Any = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Any").msgclass
17
+ Any = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Any").msgclass
18
18
  end
19
19
  end
@@ -34,8 +34,8 @@ end
34
34
 
35
35
  module Google
36
36
  module Protobuf
37
- Api = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Api").msgclass
38
- Method = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Method").msgclass
39
- Mixin = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Mixin").msgclass
37
+ Api = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Api").msgclass
38
+ Method = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Method").msgclass
39
+ Mixin = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Mixin").msgclass
40
40
  end
41
41
  end
@@ -14,6 +14,6 @@ end
14
14
 
15
15
  module Google
16
16
  module Protobuf
17
- Duration = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Duration").msgclass
17
+ Duration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Duration").msgclass
18
18
  end
19
19
  end
@@ -12,6 +12,6 @@ end
12
12
 
13
13
  module Google
14
14
  module Protobuf
15
- Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass
15
+ Empty = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass
16
16
  end
17
17
  end
@@ -13,6 +13,6 @@ end
13
13
 
14
14
  module Google
15
15
  module Protobuf
16
- FieldMask = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldMask").msgclass
16
+ FieldMask = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FieldMask").msgclass
17
17
  end
18
18
  end
@@ -13,6 +13,6 @@ end
13
13
 
14
14
  module Google
15
15
  module Protobuf
16
- SourceContext = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceContext").msgclass
16
+ SourceContext = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.SourceContext").msgclass
17
17
  end
18
18
  end
@@ -29,9 +29,9 @@ end
29
29
 
30
30
  module Google
31
31
  module Protobuf
32
- Struct = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Struct").msgclass
33
- Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Value").msgclass
34
- ListValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ListValue").msgclass
35
- NullValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.NullValue").enummodule
32
+ Struct = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Struct").msgclass
33
+ Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Value").msgclass
34
+ ListValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.ListValue").msgclass
35
+ NullValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.NullValue").enummodule
36
36
  end
37
37
  end
@@ -14,6 +14,6 @@ end
14
14
 
15
15
  module Google
16
16
  module Protobuf
17
- Timestamp = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Timestamp").msgclass
17
+ Timestamp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Timestamp").msgclass
18
18
  end
19
19
  end
@@ -79,13 +79,13 @@ end
79
79
 
80
80
  module Google
81
81
  module Protobuf
82
- Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Type").msgclass
83
- Field = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field").msgclass
84
- Field::Kind = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Kind").enummodule
85
- Field::Cardinality = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Cardinality").enummodule
86
- Enum = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Enum").msgclass
87
- EnumValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValue").msgclass
88
- Option = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Option").msgclass
89
- Syntax = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Syntax").enummodule
82
+ Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Type").msgclass
83
+ Field = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field").msgclass
84
+ Field::Kind = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Kind").enummodule
85
+ Field::Cardinality = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Field.Cardinality").enummodule
86
+ Enum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Enum").msgclass
87
+ EnumValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.EnumValue").msgclass
88
+ Option = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Option").msgclass
89
+ Syntax = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Syntax").enummodule
90
90
  end
91
91
  end
@@ -72,8 +72,14 @@ module Google
72
72
  end
73
73
 
74
74
  Timestamp.class_eval do
75
- def to_time
76
- Time.at(self.to_f)
75
+ if RUBY_VERSION < "2.5"
76
+ def to_time
77
+ Time.at(self.to_f)
78
+ end
79
+ else
80
+ def to_time
81
+ Time.at(seconds, nanos, :nanosecond)
82
+ end
77
83
  end
78
84
 
79
85
  def from_time(time)
@@ -37,14 +37,14 @@ end
37
37
 
38
38
  module Google
39
39
  module Protobuf
40
- DoubleValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DoubleValue").msgclass
41
- FloatValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FloatValue").msgclass
42
- Int64Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int64Value").msgclass
43
- UInt64Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt64Value").msgclass
44
- Int32Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int32Value").msgclass
45
- UInt32Value = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt32Value").msgclass
46
- BoolValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BoolValue").msgclass
47
- StringValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.StringValue").msgclass
48
- BytesValue = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BytesValue").msgclass
40
+ DoubleValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.DoubleValue").msgclass
41
+ FloatValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.FloatValue").msgclass
42
+ Int64Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int64Value").msgclass
43
+ UInt64Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt64Value").msgclass
44
+ Int32Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Int32Value").msgclass
45
+ UInt32Value = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.UInt32Value").msgclass
46
+ BoolValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BoolValue").msgclass
47
+ StringValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.StringValue").msgclass
48
+ BytesValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.BytesValue").msgclass
49
49
  end
50
50
  end
@@ -17,7 +17,6 @@ module BasicTest
17
17
  add_message "BadFieldNames" do
18
18
  optional :dup, :int32, 1
19
19
  optional :class, :int32, 2
20
- optional :"a.b", :int32, 3
21
20
  end
22
21
  end
23
22
 
@@ -204,6 +203,20 @@ module BasicTest
204
203
  end
205
204
  end
206
205
 
206
+ def test_map_field_with_symbol
207
+ m = MapMessage.new
208
+ assert m.map_string_int32 == {}
209
+ assert m.map_string_msg == {}
210
+
211
+ m = MapMessage.new(
212
+ :map_string_int32 => {a: 1, "b" => 2},
213
+ :map_string_msg => {a: TestMessage2.new(:foo => 1),
214
+ b: TestMessage2.new(:foo => 10)})
215
+ assert_equal 1, m.map_string_int32[:a]
216
+ assert_equal 2, m.map_string_int32[:b]
217
+ assert_equal 10, m.map_string_msg[:b].foo
218
+ end
219
+
207
220
  def test_map_inspect
208
221
  m = MapMessage.new(
209
222
  :map_string_int32 => {"a" => 1, "b" => 2},
@@ -271,6 +284,14 @@ module BasicTest
271
284
  assert_match(/No such field: not_in_message/, e.message)
272
285
  end
273
286
 
287
+ #def test_json_quoted_string
288
+ # m = TestMessage.decode_json(%q(
289
+ # "optionalInt64": "1",,
290
+ # }))
291
+ # puts(m)
292
+ # assert_equal 1, m.optional_int32
293
+ #end
294
+
274
295
  def test_to_h
275
296
  m = TestMessage.new(:optional_bool => true, :optional_double => -10.100001, :optional_string => 'foo', :repeated_string => ['bar1', 'bar2'], :repeated_msg => [TestMessage2.new(:foo => 100)])
276
297
  expected_result = {
@@ -357,11 +378,6 @@ module BasicTest
357
378
  assert nil != file_descriptor
358
379
  assert_equal "tests/basic_test.proto", file_descriptor.name
359
380
  assert_equal :proto3, file_descriptor.syntax
360
-
361
- file_descriptor = BadFieldNames.descriptor.file_descriptor
362
- assert nil != file_descriptor
363
- assert_equal nil, file_descriptor.name
364
- assert_equal :proto3, file_descriptor.syntax
365
381
  end
366
382
 
367
383
  # Ruby 2.5 changed to raise FrozenError instead of RuntimeError
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-protobuf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.2
4
+ version: 3.10.0.rc.1
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Protobuf Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler-dock
@@ -114,7 +114,8 @@ files:
114
114
  homepage: https://developers.google.com/protocol-buffers
115
115
  licenses:
116
116
  - BSD-3-Clause
117
- metadata: {}
117
+ metadata:
118
+ source_code_uri: https://github.com/protocolbuffers/protobuf/tree/v3.10.0-rc1/ruby
118
119
  post_install_message:
119
120
  rdoc_options: []
120
121
  require_paths:
@@ -126,9 +127,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
127
  version: '2.3'
127
128
  required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  requirements:
129
- - - ">="
130
+ - - ">"
130
131
  - !ruby/object:Gem::Version
131
- version: '0'
132
+ version: 1.3.1
132
133
  requirements: []
133
134
  rubyforge_project:
134
135
  rubygems_version: 2.7.9