Commit Graph

227 Commits

Author SHA1 Message Date
Toby Hsieh
63d2f3bc80 Fix RepeatedField#first in Ruby gem (#5293)
Given an argument, the previous implementation was off by one
(`.first(2)` would return 3 elements) compared to the `Enumerable#first`
method.
2018-10-29 11:32:50 -07:00
micw523
0038ff49af Remove Debug Statement for Win/MinGW (#5283) 2018-10-23 12:50:57 -07:00
Paul Yang
333b3ceab6
Add ruby 2.3, 2.4 and 2.5 test for linux. (#5256)
* Add ruby 2.3, 2.4 and 2.5 test for linux.

* Update kokoro files

* Add back commented gc test

* Fix gc_test failure

* Remove unused code

* Update ruby 2.5.0 to 2.5.1

* Update ruby 2.3 to 2.3.8

* Remove useless comment
2018-10-18 11:16:55 -07:00
Paul Yang
a0da84bff4
Fix broken ruby test (#5235)
* Replace assert_true/assert_false with assert, because they are not provided in newer version of test/unit

* Use rescue to handle exception subclass

* Commented out the require that caused gc_test failure.

* Commented out test

* Fix typo
2018-10-08 13:16:56 -07:00
Joshua Haberman
19ef4ab1c2
Merge pull request #4816 from hrsht/hrsht/zanker-proto2
Basic Proto2 support for Ruby gem
2018-09-27 15:23:10 -07:00
Harshit Chopra
d0535cc09e Adds support for proto2 syntax for Ruby gem.
This change only adds basic proto2 support without advanced features
like extensions, custom options, maps, etc.

The protoc binary now generates ruby code for proto2 syntax.
However, for now, it is restricted to proto2 files without advanced features
like extensions, in which case it still errors out.

This change also modifies the DSL to add proto messages to the DescriptorPool.
There is a new DSL Builder#add_file to create a new FileDescriptor. With this,
the generated ruby DSL looks something like:

Google::Protobuf::DescriptorPool.generated_pool.build do
  add_file "test.proto" do
    add_message "foo" do
      optional :val, :int32, 1
    end
  end
end
2018-09-27 14:21:16 -04:00
Feng Xiao
afe98de32a Replace repo links. 2018-08-22 11:55:30 -07:00
Adam Cozzette
94d55e5292 Merge branch '3.6.x' into merge-3-6-x 2018-08-01 13:44:55 -07:00
Adam Cozzette
9e1286b949 Updated version numbers to 3.6.1 2018-07-27 13:30:28 -07:00
Paul Yang
e508fc0c66
Check the message to be encoded is the wrong type. (#4885) (#4949)
* Check the message to be encoded is the wrong type. (#4885)

* Change TypeError to ArgumentError
2018-07-23 11:05:28 -07:00
Paul Yang
8356d270a5 Add continuous test for ruby 2.3, 2.4 and 2.5 (#4829)
* Add continuous test for ruby 2.3, 2.4 and 2.5

* Change ruby 2.5 to 2.5.0

* No need to provide argument to rb_funcall when argc is 0

* Fix tests for ruby 2.5

* Use rescue instead of assert_raise to accept subclass of error
2018-07-17 17:34:25 -07:00
Paul Yang
40f9ef2f56
Check the message to be encoded is the wrong type. (#4885) 2018-07-12 11:04:29 -07:00
Paul Yang
78ba021b84
Add continuous test for ruby 2.3, 2.4 and 2.5 (#4829)
* Add continuous test for ruby 2.3, 2.4 and 2.5

* Change ruby 2.5 to 2.5.0

* No need to provide argument to rb_funcall when argc is 0

* Fix tests for ruby 2.5

* Use rescue instead of assert_raise to accept subclass of error
2018-07-02 15:11:36 -07:00
Joshua Haberman
59e04d80cc
Merge pull request #4321 from devwout/ruby_json_omit_repeated
Ruby JSON encoding omits zero-length repeated fields by default.
2018-07-02 14:00:05 -07:00
Joshua Haberman
e00266a74e
Merge pull request #3847 from FX-HAO/master
Google::Protobuf::Struct can access a missing key (#3846)
2018-07-02 13:56:25 -07:00
Zachary Anker
70544627cb When initializing a message, skip a field if value is nil (#3693) 2018-06-26 20:27:24 -07:00
Erik Benoist
74f8e24232 Adds a base class for all explicitly raised TypeErrors (#4255)
* This allows for ruby code to catch and handle Protobuf
    TypeErrors separately from the standard Ruby TypeError

  * Maintains backwards compatibility by having the new
    Google::Protobuf::TypeError inherit from the base
    TypeError. Any code that was catching TypeError should
    continue to work.
2018-06-26 20:24:24 -07:00
Adam Cozzette
82d3d7d250 Merge branch '3.6.x' into merge-3-6-x 2018-06-25 13:22:10 -07:00
Paul Yang
f7ada1280f
Build ruby gem on kokoro (#4819)
* Install rake compiler

* Add kokoro config to build ruby gem on linux

* Rename from linix to linux

* Fix prepare_build.sh name

* Clean up

* Install bundler

* Install bundler

* Use c99 in order to build gem on mingw-32 on ruby 2.0.0

See https://github.com/rake-compiler/rake-compiler-dock/issues/4

* Move c99 config to extcofig.rb
2018-06-25 11:14:49 -07:00
igorpeshansky
944693c44c Add Google::Protobuf::Any.pack convenience class method. (#4719) 2018-06-19 13:26:41 -07:00
Erik Benoist
c19fcee48f Allows the json marshaller to be passed json marshal options (#4252) 2018-05-25 13:03:30 -07:00
Paul Yang
5289ee0c21 Adopt ruby_package in ruby generated code. (#4627)
* Adopt ruby_package in ruby generated code.

* Add test for ruby_package
2018-05-25 13:02:59 -07:00
Erik Benoist
a8e2359329 Allows the json marshaller to be passed json marshal options (#4252) 2018-05-22 08:14:04 -07:00
Paul Yang
9ccc3e536c
Adopt ruby_package in ruby generated code. (#4627)
* Adopt ruby_package in ruby generated code.

* Add test for ruby_package
2018-05-17 17:11:06 -07:00
Jisi Liu
45eb28b588 Update version number to 3.6.0 2018-05-14 16:06:22 -07:00
Stuart Campbell
05c2d01b61 Fix RepeatedField#delete_if (#4292)
Make RepeatedField#delete_if consistent with Array#delete_if.
2018-04-30 16:04:13 -07:00
Jisi Liu
9972e1608e Set ext.no_native = true for non mac platform
From:
https://github.com/rake-compiler/rake-compiler/issues/146#issuecomment-368539245
2018-04-25 09:52:30 -07:00
Paul Yang
c931743461
Merge branch (#4466)
* Fix setup.py for windows build.

* Bump version number to 3.5.2

* Cat the test-suite.log on errors for presubits
2018-04-02 15:55:28 -07:00
Joshua Haberman
4f110257c5
Merge pull request #4167 from mike9005/patch-1
Ruby: Fix scope resolution for MessageExts
2018-03-13 13:46:01 -07:00
Jisi Liu
bb40c0c0c4
Merge pull request #4291 from google/3.5.x
Merge 3.5.x to master
2018-02-26 10:05:09 -08:00
Ewout
7b8f571756 Ruby JSON encoding omits zero-length repeated fields by default.
This makes it behave the same way as the other implementations.
It is also nice to always encode an empty message as {}.
2018-02-20 17:13:21 +01:00
Jisi Liu
2a8e10257f Bumping number to fix ruby 2.1 on mac 2018-01-26 15:17:38 -08:00
Jisi Liu
53d907f646 Update rake file to build of 2.1.6. 2018-01-17 17:01:32 -08:00
Jisi Liu
d9f0f0bfac Support ruby2.5 2018-01-17 15:00:46 -08:00
Michael Collis
2a6eaeb86e
Fix scope resolution for MessageExts in Ruby 2018-01-12 15:16:16 -05:00
Jisi Liu
383a4941d5 Merge remote-tracking branch 'origin/3.5.x' into master 2018-01-03 09:28:40 -08:00
Jisi Liu
050fc9a437 Update version number to 3.5.1 2017-12-19 11:00:33 -08:00
Paul Yang
cf7c15e31a
Fix ruby gc_test in ruby 2.4 (#4011)
* Fix ruby gc_test in ruby 2.4

* Initialize global variables to Qnil.
2017-12-08 12:38:25 -08:00
Paul Yang
0e7b589566
Add discard unknown API in ruby. (#3990)
* Add discard unknown API in ruby.

* Add test for oneof message field.

* Add TestUnknown to represent unknown field data clearly.

* Only serialize the message with unknown fields itself in test.

* Move discard_unknown from Message to Google.Protobuf
2017-12-07 14:18:38 -08:00
W
0316ae802d
--pre is not necessary
--pre was not necessary to install google-protobuf when I tried it today (2017-12-06).
2017-12-06 18:18:50 +01:00
Adam Cozzette
a27da09339 Merge branch '3.5.x' into 3.5.x-merge 2017-11-30 13:34:51 -08:00
Joshua Haberman
0289dd8f90
Merge pull request #2519 from rubynerd-forks/ruby-fix-repeated-message-type-field
unwrap descriptor class before comparison of RepeatedField types
2017-11-29 10:07:35 -08:00
parker
8695997eb5 Google::Protobuf::Struct can access a missing key (#3846) 2017-11-17 11:43:14 +08:00
Jisi Liu
97dd175a91 Update version number to 3.5.0 2017-11-02 14:16:22 -07:00
Paul Yang
23adfeb003 Reserve unknown in Ruby (#3763)
* Reserve unknown in ruby

* Revert ruby tests. Wait for cpp impl for conformance test

* Add conformance test for preserving unknown

* Add unknown field conformance test to csharp failure list.

* Fix comments

* Fix comment

* Fix comments

* Fix typo

* Use stringsink_string directly

* Mark hd unused

* Remove unused encodeunknown_handlerfunc
2017-10-26 14:41:43 -07:00
@rubynerd
1e58006b3c test for field reassignment 2017-10-12 18:23:01 +01:00
Jisi Liu
de15e73d58 Merge remote-tracking branch 'origin/3.4.x' into master 2017-10-11 14:44:03 -07:00
Paul Yang
cd5f49d094 Fix ruby segment fault (#3708)
* Fix ruby segment fault

1) rb_ary_new cannot be called during allocate function. During allocate
fucntion, the containing object hasn't been marked and rb_ary_new may
invoke gc to collect containing object.
2) The global map should be marked before allocating it. Otherwise it
may be garbage collected.

* Add test

* Remove commented code

* Fix grammer error
2017-10-03 17:28:49 -07:00
Joshua Haberman
4fc75296c7 Merge pull request #3627 from zanker/zanker/add-submsg-hash-init
Allow initializing a chain of protos using only a hash in Ruby
2017-09-21 15:08:45 -07:00
Zachary Anker
633ef8bde9 Update message.c 2017-09-21 09:26:54 -07:00