Commit Graph

530 Commits

Author SHA1 Message Date
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
Zachary Anker
8eae3fe6e9 Update message.c 2017-09-20 12:45:42 -07:00
Zachary Anker
87714836e3 Allow initializing a chain of protos using only a hash 2017-09-20 11:39:46 -07:00
Zachary Anker
83264bd160 Fixed to_h with repeated messages to return hashes in Ruby 2017-09-20 11:38:05 -07:00
Jisi Liu
2eb1bacc26 Bumping minor version for ruby gems 2017-09-15 13:57:16 -07:00
Jisi Liu
dba647a6b2 Bump version for minor release 2017-09-14 11:12:55 -07:00
Aaron Patterson
a459b224b5 Storing the frame on the map means we don't need the array 2017-09-13 14:28:02 -07:00
Aaron Patterson
c1dd8e85a1 Move parse frame array to the Map object
This makes the frame stack per-parser, and per-thread.  Fixes #3250
2017-09-13 14:27:52 -07:00
Aaron Patterson
f55c6ec24f
Storing the frame on the map means we don't need the array 2017-08-30 11:38:09 -07:00
Aaron Patterson
d6152dd51c
Move parse frame array to the Map object
This makes the frame stack per-parser, and per-thread.  Fixes #3250
2017-08-30 11:38:04 -07:00
Jisi Liu
d76e4c7068 Bump gemspec again 2017-08-18 16:18:45 -07:00
Jisi Liu
19266369f0 Bump gem version for the next upload 2017-08-17 13:10:47 -07:00
Jisi Liu
7bb39bef1a Update version number for 3.4.0 2017-07-24 16:03:49 -07:00
Adam Cozzette
bd5ab154da Merge pull request #2482 from andreaseger/fix_ruby_timestamp_accuracy
[Ruby] fix floating point accuracy problem in Timestamp#to_f
2017-07-06 08:11:50 -07:00
Joshua Haberman
1325588982 Updated upb to fix JSON conformance issues. (#3206)
* Fixed a bunch of Ruby conformance errors.

* Fixed some more Ruby conformance errors in JSON.
2017-06-19 15:13:24 -07:00
Joshua Haberman
b28617b813 Merge pull request #2815 from devwout/ruby_json_emit_defaults
Ruby version optionally emits default values in JSON encoding.
2017-05-15 08:05:27 -07:00
Andreas Eger
78cb804063 change test for nanosecond accurate timestamps 2017-05-13 22:20:45 +02:00
Andreas Eger
ad203bcb2b fix floating point accuracy problem in Timestamp#to_f
`.quo` return the most exact devision which fixes accuracy problems for the
timestamp coercion
2017-05-13 21:38:15 +02:00
Feng Xiao
80f0c0ac40 Update version number and changelog for 3.3.0 2017-04-05 17:32:17 -07:00
Adam Cozzette
ea5ef14aa0 Ruby: only link against specific version of memcpy if we're using glibc
We have some special code in wrap_memcpy.c to ensure that we use the
2.2.5 version of memcpy, for compatibility with older versions of glibc.
However, we need to make sure we only attempt to do this when we are
actually building with glibc, so that the code can also build
successfully against other libc implementations such as musl.
2017-03-17 11:23:01 -07:00
Ewout
aec0711075 Ruby tests compare parsed JSON instead of raw JSON 2017-03-17 10:28:17 +01:00
Joshua Haberman
2957703a01 Merge pull request #2847 from haberman/ruby-toh
Ruby: fixed Message#to_h for map fields.
2017-03-16 09:28:09 -07:00
Adam Cozzette
e77a09e1e9 Incremented Ruby version number to 3.2.0.1 2017-03-15 14:16:49 -07:00
Josh Haberman
8c40b5149a Ruby: update Gemspec. 2017-03-15 14:16:49 -07:00
Josh Haberman
014a5507fb Ruby: build packages for Ruby 2.4. 2017-03-15 14:16:49 -07:00
Josh Haberman
324a299a55 Made formatting more consistent. 2017-03-15 10:35:15 -07:00
Josh Haberman
9c6b8cb9bf Ruby: fixed Message#to_h for map fields. 2017-03-14 14:27:16 -07:00
Ewout
008dc92c9d Ruby version optionally emits default values in JSON encoding.
Usage: Message.encode_json(m, emit_defaults: true)
Message fields that are nil will still not appear in the encoded JSON.
2017-03-09 20:47:56 +01:00
Adam Cozzette
9fa40314fc Ruby: wrap calls to memcpy so that gem is compatible with pre-2.14 glibc
This commit adds a __wrap_memcpy function and a linker flag to use that
in place of memcpy for our Ruby gem C extension. This allows us to
always use the 2.2.5 version of memcpy, making it possible to use the
gem on distributions with pre-2.14 versions of glibc.

Before this change:
$ objdump -T protobuf_c.so | grep memcpy
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __memcpy_chk
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.14  memcpy

After:
$ objdump -T protobuf_c.so | grep memcpy
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.2.5 memcpy
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.3.4 __memcpy_chk
0000000000042450 g    DF .text  0000000000000005  Base __wrap_memcpy

This is based on gRPC's solution to a similar problem:
5098508d2d/src/core/lib/support/wrap_memcpy.c

This fixes issue #2783.
2017-03-09 10:03:22 -08:00
Feng Xiao
8610d0a9dd Merge pull request #2755 from xfxyjwf/rubycomp
Add Ruby compatibilty test against 3.0.0.
2017-03-02 14:33:02 -08:00
Sebastian Schuberth
902af0816e Prefer the term "3-Clause BSD License" over "New BSD License"
The first is the newer name, which is also more telling.
2017-02-28 09:58:24 +01:00
Sebastian Schuberth
6395a1cbd9 Fix links to the New BSD License in meta-data
The "New BSD License" is the "3-Clause BSD License", but the links were
pointing to the "2-Clause BSD License".
2017-02-28 09:54:21 +01:00
Feng Xiao
9118ad659b Add Ruby compatibilty test against 3.0.0. 2017-02-27 17:38:54 -08:00
Paul Yang
7f3e237071 Merge 3.2.x branch into master (#2648)
* Down-integrate internal changes to github.

* Update conformance test failure list.

* Explicitly import used class in nano test to avoid random test fail.

* Update _GNUC_VER to use the correct implementation of atomic operation
on Mac.

* maps_test.js: check whether Symbol is defined before using it (#2524)

Symbol is not yet available on older versions of Node.js and so this
test fails with them. This change just directly checks whether Symbol is
available before we try to use it.

* Added well_known_types_embed.cc to CLEANFILES so that it gets cleaned up

* Updated Makefile.am to fix out-of-tree builds

* Added Bazel genrule for generating well_known_types_embed.cc

In pull request #2517 I made this change for the CMake and autotools
builds but forgot to do it for the Bazel build.

* Update _GNUC_VER to use the correct implementation of atomic operation on Mac.

* Add new js file in extra dist.

* Bump version number to 3.2.0

* Fixed issue with autoloading - Invalid paths (#2538)

* PHP fix int64 decoding (#2516)

* fix int64 decoding

* fix int64 decoding + tests

* Fix int64 decoding on 32-bit machines.

* Fix warning in compiler/js/embed.cc

embed.cc: In function ‘std::string CEscape(const string&)’:
embed.cc:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 0; i < str.size(); ++i) {
                                ^

* Fix include in auto-generated well_known_types_embed.cc

Restore include style fix (e3da722) that has been trampled by
auto-generation of well_known_types_embed.cc

* Fixed cross compilations with the Autotools build

Pull request #2517 caused cross compilations to start failing, because
the js_embed binary was being built to run on the target platform
instead of on the build machine. This change updates the Autotools build
to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for
the build machine and always use that when building js_embed.

* Minor fix for autocreated object repeated fields and maps.

- If setting/clearing a repeated field/map that was objects, check the class
  before checking the autocreator.
- Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated
  classes to ensure there is less chance of issues if someone does something
  really crazy threading wise.
- Some more tests for the internal AutocreatedArray/AutocreatedDictionary
  classes to ensure things are working as expected.
- Add Xcode 8.2 to the full_mac_build.sh supported list.

* Fix generation of extending nested messages in JavaScript (#2439)

* Fix generation of extending nested messages in JavaScript

* Added missing test8.proto to build

* Fix generated code when there is no namespace but there is enum definition.

* Decoding unknown field should succeed.

* Add embed.cc in src/Makefile.am to fix dist check.

* Fixed "make distcheck" for the Autotools build

To make the test pass I needed to fix out-of-tree builds and update
EXTRA_DIST and CLEANFILES.

* Remove redundent embed.cc from src/Makefile.am

* Update version number to 3.2.0-rc.1 (#2578)

* Change protoc-artifacts version to 3.2.0-rc.1

* Update version number to 3.2.0rc2

* Update change logs for 3.2.0 release.

* Update php README

* Update upb, fixes some bugs (including a hash table problem). (#2611)

* Update upb, fixes some bugs (including a hash table problem).

* Ruby: added a test for the previous hash table corruption.

Verified that this triggers the bug in the currently released
version.

* Ruby: bugfix for SEGV.

* Ruby: removed old code for dup'ing defs.

* Reverting deployment target to 7.0 (#2618)

The Protobuf library doesn’t require the 7.1 deployment target so
reverting it back to 7.0

* Fix typo that breaks builds on big-endian (#2632)

* Bump version number to 3.2.0
2017-01-31 09:17:32 -08:00
@rubynerd
f3e86fd26a handle sanity check for repeating enums correctly 2016-12-30 02:26:25 +00:00
@rubynerd
c64830bbca unwrap descriptor class before comparison of RepeatedField types
self->field_type_class returns the correct Ruby class, get_def_obj
returns the Descriptor object used to generate the Ruby class via
msgclass, so to compare the two types we get the msgclass from the
descriptor.
2016-12-19 23:49:16 +00:00
Joshua Haberman
057389cae3 Ruby: removed redundant RepeatedField#slice. (#2449) 2016-12-07 13:39:09 -08:00
Joshua Haberman
f1ce60e7b4 Factored Conformance and Benchmark test messages into shared test schema. (#1971)
* Factored Conformance test messages into shared test schema.

* Updated benchmarks to use new proto3 message locations.

* Fixed include path.

* Conformance: fixed include of Python test messages.

* Make maven in Rakefile use --batch-mode.

* Revert changes to benchmarks.

On second thought I think a separate schema for
CPU benchmarking makes sense.

* Try regenerating C# protos for new test protos.

* Removed benchmark messages from test proto.

* Added Jon Skeet's fixes for C#.

* Removed duplicate/old test messages C# file.

* C# fixes for test schema move.

* Fixed C# to use the correct TestAllTypes message.

* Fixes for Objective C test schema move.

* Added missing EXTRA_DIST file.
2016-12-03 11:51:25 -05:00
Adam Cozzette
65479cb7b1 Fixed Ruby tests for JRuby 1.7
This makes a couple of changes to fix the tests for JRuby 1.7:
- Avoid using assert_false since that assertion seems not to exist in
  older versions
- Disable a test related to respond_to? for JRuby. It's hard to tell
  what is going wrong here but it looks like probably a JRuby bug that
  has been fixed in more recent versions.
2016-11-23 08:57:27 -08:00
Marcin Wyszynski
74a636a7a2 Move variable declarations before actual code 2016-11-14 21:45:37 +01:00
Marcin Wyszynski
cb81314b1b Fix copy pasta in test 2016-11-03 15:00:40 +01:00
Marcin Wyszynski
3bdaaa5dda More Ruby-eqsue interface 2016-11-03 14:19:10 +01:00
Jason Lunn
9ec7a47ee8 Use git clean before installing via bundler 2016-10-14 01:01:08 -04:00
Feng Xiao
f933d10fbe Update version number.
[skip ci]

Change-Id: I1ba6f6372a08b5796570851336e1a548602f60da
2016-10-10 11:44:21 -07:00
Bo Yang
89d8e43428 Fix travis, jenkins environment issues. 2016-10-10 11:43:48 -07:00
Bo Yang
15f4db6cb1 Bump version number to 3.1.0-alpha-1. 2016-10-10 11:24:31 -07:00
Jason Lunn
6005648c2c Add development dependency requirements
Uses values from the removed `Gemfile.lock` as a baseline for version requirements, though it has been observed to work with the latest versions of all the referenced gems - see https://travis-ci.org/google/protobuf/builds/163625616 for details
2016-09-29 17:31:11 -04:00
Jason Lunn
d94ff4142a Delete Gemfile.lock
Avoid [failures in travis](https://travis-ci.org/google/protobuf/jobs/163611664) under jruby
2016-09-29 02:18:32 -04:00
Jason Lunn
07f3cab3dd Set platform to "java" under JRuby
Proposed fix for #1594
2016-09-29 00:18:55 -04:00
Brendan Ribera
05aa0df532 Fix hash computation for JRuby's RubyMessage
`System.identityHashCode` returns a hash that does not consider a
Message's values. This means two Messages with identical values will not
have identical hashCodes.

This patch uses the pattern from RubyMap to combine the hashCodes from
all values in a given message and produce a unique, consistent,
value-based hash.
2016-09-20 11:07:42 -07:00
Joshua Haberman
b5bbdb0967 Merge pull request #2037 from abscondment/fix-2036-ruby-hash
Fix #2036 (Ruby `hash` broken for Messages with repeated fields.)
2016-09-18 21:38:51 -07:00
Jisi Liu
58860c021f Merge remote-tracking branch 'origin/3.0.x' into merge 2016-09-14 09:37:48 -07:00
Jisi Liu
6e11540b32 Bump version number to 3.0.2 2016-09-02 11:57:49 -07:00
Brendan Ribera
de028631fc fix #2036: use rb_hash_* to accumulate hashes
Instead of shifting/xoring the hash at each field, use the built-in ruby
apis for generating a hash from multiple input values.

Now returns a Fixnum.
2016-08-30 16:22:49 -07:00
Brendan Ribera
047419a172 failing test for #2036:
* add a repeated field to the tested hash
* also assert that two messages with identical values produce identical hashes
2016-08-30 16:21:33 -07:00
Joshua Haberman
dd45c0b9fd Merge pull request #2012 from haberman/rubymapgcfix
Ruby: make sure map parsing frames are GC-rooted.
2016-08-30 09:57:50 -07:00
Josh Haberman
3a674ffe05 upb bugfix: JSON map entry keys were passing the wrong closure. 2016-08-29 15:28:59 -07:00
Josh Haberman
d4213d839f Ruby: make sure map parsing frames are GC-rooted. 2016-08-26 09:03:55 -07:00
Nicolas Noble
866d3e5327 Fixing regular expression...
This will allow loading the extension for Ruby 2.1.10...
2016-08-23 22:46:26 -07:00
Joshua Haberman
8d8115bf52 Merge pull request #1878 from haberman/rubywkt
Ruby: added API support for well-known types.
2016-08-01 17:31:00 -07:00
Josh Haberman
3cec2ea8d6 Ruby: added custom Struct exception type and fixed Makefile.am. 2016-08-01 14:34:54 -07:00
Josh Haberman
a207a2bd00 Fix for JRuby (assert_true is not present). 2016-07-28 17:54:16 -07:00
Josh Haberman
e3094a8d80 Ruby: added API support for well-known types. 2016-07-28 17:02:33 -07:00
Joshua Haberman
234ec01795 Merge pull request #1847 from haberman/GAfixes
GA fixes
2016-07-26 10:55:34 -07:00
Josh Haberman
6d92233e72 Added unit test for PascalCasing package names in Ruby. 2016-07-25 15:16:23 -07:00
Joshua Haberman
b1cecb6762 Merge pull request #1837 from haberman/rubygencodename
Ruby: generated foo.proto -> foo_pb.rb instead of foo.rb.
2016-07-25 14:58:41 -07:00
Jisi Liu
0973822d03 remove extra zeros. 2016-07-25 14:14:44 -07:00
Jisi Liu
5a6c921217 Make jruby still depend on beta-4 2016-07-25 13:19:52 -07:00
Jisi Liu
fb7a7c5f1f Bump version number for GA 2016-07-25 12:07:56 -07:00
Josh Haberman
4f19797baf Ruby: generated foo.proto -> foo_pb.rb instead of foo.rb.
This brings us more into line with other langauges, and makes it more
obvious when we are requiring protobuf generated code.
2016-07-25 11:09:23 -07:00
Joshua Haberman
44bd6bda58 Merge pull request #1821 from haberman/rubyfreezestr
Ruby: encode and freeze strings when the are assigned or decoded.
2016-07-25 10:09:15 -07:00
Josh Haberman
d07a9963df Ruby: fixed string freezing for JRuby. 2016-07-25 01:26:14 -07:00
Feng Xiao
20fbb357d0 Add more tests to jenkins.
1. Added ruby22 and jruby tests to jenkins.
2. Added javascript tests to jenkins.
3. Added golang tests to jenkins.
4. Removed ruby19/ruby20 tests from travis. Support for ruby 2.0 has
   ended since 2016/02/24.
   https://www.ruby-lang.org/en/news/2016/02/24/support-plan-of-ruby-2-0-0-and-2-1/

Change-Id: Ie984b06772335352a4be7067ab2485f923875685
2016-07-21 18:11:12 -07:00
Josh Haberman
ff7f68ae9f Ruby: encode and freeze strings when the are assigned or decoded. 2016-07-21 11:37:54 -07:00
Feng Xiao
932f94e16e Update version number to 3.0.0-beta-4 2016-07-13 16:08:47 -07:00
Otto Kekäläinen
3808d091f8 Fix spelling in strings and comments 2016-07-03 15:26:04 +03:00
Josh Haberman
2d514ce2d8 Fixed oneof behavior for enums and fixed JRuby. 2016-05-18 15:39:29 -07:00
Josh Haberman
545527e8cf Ruby oneofs: return default instead of nil for unset fields. 2016-05-18 10:58:02 -07:00
Jisi Liu
5dea2017db Update version numbers for other languages 2016-05-10 15:43:39 -07:00
Nicolas "Pixel" Noble
edd29498f4 Properly generating well known proto files for the macos build. 2016-05-04 02:40:25 +02:00
Joshua Haberman
7dda312224 Merge pull request #1473 from nicolasnoble/rake-tweaks
Few tweaks to the rakefile to permit native gems compilation with the proto files generation.
2016-05-03 13:10:02 -07:00
Nicolas "Pixel" Noble
236b93937f Addressing concerns. 2016-04-30 02:15:15 +02:00
Nicolas "Pixel" Noble
1f8b6da920 Few tweaks to the rakefile to permit native gems compilation with the proto files generation. 2016-04-29 20:00:43 +02:00
Adam Cozzette
b53417c735 Merge pull request #1462 from acozzette/ruby-2.3
Added dig and bsearch_index to RepeatedField methods forwarded to array
2016-04-28 08:26:26 -07:00
Adam Cozzette
bbb68fe63d Added dig and bsearch_index to RepeatedField methods forwarded to array
This fixes the test_acts_likes_an_array test in RepeatedFieldTest, which
checks that repeated fields respond to the same methods as regular Ruby
arrays. The bsearch_index and dig array methods seem to be new in Ruby
2.3 and so we should support those.
2016-04-27 10:51:22 -07:00
Josh Haberman
d419ca10b4 Updated upb and simplified ruby code a bit with new upb method. 2016-04-22 14:12:10 -07:00
Josh Haberman
e67ef3d449 Bugfix for JSON error case. 2016-04-14 20:27:45 -07:00
Josh Haberman
800e986012 Remove no longer applicable documentation from README.md. 2016-04-14 18:42:22 -07:00
Josh Haberman
194ad621bb Ruby JSON: always accept both camelCase and original field names.
For JSON encoding we provide a new option to decide at
encode time whether to use camelCase or original proto field
names:

  json = MapMessage.encode_json(m, :preserve_proto_fieldnames => true)
2016-04-14 18:33:17 -07:00
Josh Haberman
90c7f6e55e Documented the JSON change and compatibility flags. 2016-04-14 12:48:41 -07:00
Josh Haberman
94e54b39c8 Updated upb: picked up legacy JSON flags to help Ruby users migrate.
The flags are:

  UPB_JSON_ACCEPT_LEGACY_FIELD_NAMES
  UPB_JSON_WRITE_LEGACY_FIELD_NAMES

The first just allows the parser to accept the old field names.
The second makes the printer print the old field names.

These flags are intended to be temporary, as a migration aid
for users.
2016-04-14 12:06:09 -07:00
Joshua Haberman
e70f9256af Merge pull request #1139 from haberman/rubyjsoncamel
Changed Ruby to properly camelCase its JSON by default.
2016-03-04 17:31:11 -08:00
Josh Haberman
513875da77 Generate well-known types in Ruby extension and prune unneeded proto2 dependencies. 2016-03-03 14:08:54 -08:00
Josh Haberman
f654d49dd6 Updated upb from latest changes. 2016-02-18 11:48:54 -08:00
Josh Haberman
78da66698b Changed Ruby to properly camelCase its JSON by default. 2016-02-18 10:50:14 -08:00
Joshua Haberman
8fc045d8d2 Merge pull request #1224 from google/rubysentinel
Removed 'optional' from proto3 syntax file.
2016-02-16 15:43:21 -08:00
Joshua Haberman
3ee2e20539 Merge pull request #1144 from dongjoon-hyun/remove_redundant_the
Remove redundant `the`.
2016-02-11 17:17:48 -08:00
Joshua Haberman
caf1fb7197 Merge pull request #997 from anderscarling/better_errors
ruby: Better exception text for common cases
2016-02-11 12:41:34 -08:00
Josh Haberman
69ac430c02 Removed 'optional' from proto3 syntax file. 2016-02-10 14:16:49 -08:00
Nicolas "Pixel" Noble
bbb188acdd Actually enabling cross compilation. 2016-02-06 00:55:45 +01:00
Nicolas "Pixel" Noble
4e141bb3b8 Removing usage of git - not everyone grabs the gem using it. 2016-02-06 00:55:28 +01:00
Josh Haberman
70a4b03086 Add rake-compiler-dock as a dep. 2016-02-04 14:18:14 -08:00
Josh Haberman
af4aa9bd64 Added support for binary gems. 2016-02-04 10:44:22 -08:00
Dongjoon Hyun
7a9040fe7f Remove redundant the in comments. 2016-02-03 15:27:27 -08:00
Josh Haberman
fc7f8d9cd0 Fixed Ruby conformance tests by running them under rvm Ruby. 2016-01-11 21:16:42 -08:00
Josh Haberman
bf50ec4ac9 Added debugging output to debug type= problem on Travis. 2016-01-11 16:15:46 -08:00
Josh Haberman
e891c29f9b Allow conformance test runner to tolerate crashes, and re-enable conformance tests. 2016-01-11 16:15:46 -08:00
Feng Xiao
8675989bf7 Disable conformance tests for csharp and ruby.
The testee program of these two languages crashes on some test input.
2015-12-21 13:22:21 -08:00
Feng Xiao
aa7e17a6f6 Update version numbers.
Version number for beta languages is updated to v3.0.0-beta-2.
Version number for alpha languages is updated to v3.0.0-alpha-5.
2015-12-21 11:31:51 -08:00
Anders Carling
3a5f213cca Invoke super implementation instead of raising error 2015-11-23 14:53:33 +01:00
Anders Carling
0559f3ee9e Add field name to initialization map exceptions 2015-11-20 21:57:28 +01:00
Anders Carling
8bcd0d7fc7 Use same exception class in ruby and jruby 2015-11-20 21:56:04 +01:00
Anders Carling
0df1e398eb Raise NoMethodError for unknown fields
More informative and more ruby-like
2015-11-20 21:55:18 +01:00
Josh Haberman
14e2b4fa51 A very small fix to silence some warnings.
Also updated the Gemfile.lock since alpha-4 has been
pushed to RubyGems.

Change-Id: I8ddc5f125f28aa9a33c88dfe48251a75a877e1d3
2015-09-28 08:56:14 -07:00
Feng Xiao
1942a2bd2e Make jruby use Java 3.0.0-alpha-3. 2015-08-26 21:20:59 -07:00
Feng Xiao
ffe9215140 Update version number.
Protoc, C++ runtime and Java runtime are updated to v3.0.0-beta-1, other
languages are updated to v3.0.0-alpha-4.
2015-08-26 15:11:43 -07:00
Joshua Haberman
eb65c69e14 Merge pull request #584 from haberman/cwarnings
Ruby: Conform to C89/C90 variable declaration rules.
2015-08-21 09:00:40 -07:00
Josh Haberman
d61e6adfcc Return TypedData_Wrap_Struct directly.
Change-Id: I6cf77f01370204ad4bc7b345a040a9a3de1706a0
2015-08-20 16:41:32 -07:00
Josh Haberman
5bdf4a4271 Fixed several Ruby conformance test cases through upb update.
Change-Id: Ief77de7134e05e07b1a7e3970d49880c2d5e6fe9
2015-08-12 18:50:15 -07:00
Josh Haberman
c2c43a4917 Fixed lint errors and responded to CR comments.
Change-Id: If7b1cc0f03f609a7f43ddafc8509b44207c60910
2015-07-17 16:29:10 -07:00
Josh Haberman
95ee8fb88e Exclude JRuby from conformance tests for now.
Change-Id: Id008ebac5159f773e1bde8b85acb2626cbd16de8
2015-07-17 16:20:01 -07:00
Josh Haberman
181c7f2636 Added Ruby to conformance tests.
This involved fixing a few important bugs in the
Ruby implementation -- mostly cases of mixing
upb field types and descriptor types (upb field
types do not distinguish between int/sint/fixed/sfixed
like descriptor types do).

Also added protobuf-specific exceptions so parse
errors can be caught specifically.

Change-Id: Ib49d3db976900b2c6f3455c8b88af52cfb86e036
2015-07-16 12:25:55 -07:00
Josh Haberman
a1daeaba80 Conform to C89/C90 variable declaration rules.
While we are C99 in general, the Ruby build system
for building C extensions enables several flags that
throw warnings for C89/C90 variable ordering rules.
To avoid spewing a million warnings (or trying to
specifically override these warnings with command-line
flags, which would be tricky and possibly fragile)
we conform to Ruby's world of C89/C90.

Change-Id: I0e03e62d95068dfdfde112df0fb16a248a2f32a0
2015-07-10 12:05:14 -07:00
Josh Haberman
8c717ad530 Worked around memory leak bug in Ruby interpreter.
Change-Id: I8e2b425f9008e6b82d41d59783bb8b04af1f886f
Fixes: https://github.com/google/protobuf/issues/474.
2015-07-08 14:14:58 -07:00
Josh Haberman
fb8ed707a2 Update upb to fix two bugs in the Ruby library.
Fixes:
  https://github.com/google/protobuf/issues/502
  https://github.com/google/protobuf/issues/425
2015-06-22 17:23:55 -07:00
Josh Haberman
e3ce451b60 Fixed compiler warnings and added -std=c99.
upb no longer requires -std=c99 but the Ruby/C
code still uses C99 features.
2015-06-09 11:08:25 -07:00
Josh Haberman
e8ed021ee7 Updated upb to latest version (C89).
Since this version of upb supports C89, all of the
extra compiler flags are no longer required.
2015-06-08 17:56:03 -07:00
Bo Yang
e107e2d68e Update version number to 3.0.0-alpha-4 2015-05-29 11:00:57 -07:00
teboring
9839c0c2c9 Update version number to 3.0.0-alpha-3 2015-05-23 09:20:23 -07:00
Bo Yang
5db217305f down-integrate internal changes 2015-05-21 19:32:02 -07:00
Chris Fallin
231886f632 Ruby C extension speedup: don't re-intern constant string needlessly.
Also fixed lines with > 80 char length.
2015-05-19 16:19:00 -07:00
Joshua Haberman
202f87f8de Merge pull request #387 from cfallin/ruby-upb-update
Update MRI C Ruby extension to use new version of upb (with upb_env).
2015-05-18 14:07:21 -07:00
Tamir Duberstein
e54c14552f Don't hardcode bash 2015-05-15 17:41:04 -04:00
Chris Fallin
d326277397 Update MRI C Ruby extension to use new version of upb.
- Alter encode/decode paths to use the `upb_env` (environment)
  abstraction.
- Update upb amalgamation to upstream `93791bfe`.
- Fix a compilation warning (void*->char* cast).
- Modify build flags so that upb doesn't produce warnings -- the Travis
  build logs were pretty cluttered previously.
2015-05-15 11:36:12 -07:00
Chris Fallin
a526605aec Merge pull request #338 from skippy/encode-decode-helpers
ruby: Encode decode cleanup and behavior normalization
2015-05-15 10:52:56 -07:00
Chris Fallin
e96b5b6b7b Merge pull request #385 from cfallin/travis-refactor
Refactor Travis tests: split configs and run in parallel.
2015-05-14 15:05:08 -07:00
Chris Fallin
20e94b24dd Refactor Travis tests: split configs and run in parallel. 2015-05-14 11:48:21 -07:00
Adam Greene
cd7ebbe54f make repeated_field quack like an array 2015-05-14 10:38:11 -07:00
Chris Fallin
eb37551ae4 Added Ruby to Travis testing.
- Added RVM-based Ruby test driver that tests MRI and JRuby.
- Fixed JRuby compilation (at least in my current setup): force source
  version to 1.6 (Java 6) to allow generics and annotations.
- Modify the skipped JRuby JSON tests so that the exit code is 0 (skip()
  results in a failing exit code from `rake test`). An upcoming PR
  should fix JSON under JRuby in general soon.
2015-05-13 14:58:48 -07:00
Adam Greene
d1b52a00e0 adding and simplifying encoders/decoders
* make consistent between mri and jruby
* create a #to_h and have it use symbols for keys
* add #to_json and #to_proto helpers on the Google::Protobuf message classes
2015-05-13 10:03:56 -07:00
Chris Fallin
16a283f794 Merge pull request #334 from skippy/allow-msg-to-accept-nil
ruby: allow a message field to be unset
2015-05-02 19:02:08 -07:00
Adam Greene
64678265c5 allow a message field to be unset 2015-05-02 13:48:23 -07:00
Adam Greene
d55733c76e return nil if array index indicie is out of bounds
ruby arrays don't throw an exception; they return nil.  Lets do the
same!

this fix also includes the ability to use negative array indicies
2015-05-01 22:50:57 -07:00
Adam Greene
c70b6058ea add size alias for length
starting to make `RepeatedField` quack like an array

additional changes:
* make sure gemspec gets all ruby code files
* add homepage in gem spec removes one of the warnings, and the gem spec authors are pushing
everyone to include a homepage in the gem
* remove excess whitespace in test suite to bring formatting inline with the rest of the file
2015-05-01 11:48:04 -07:00
Adam Greene
761cfa08e6 build cleanups
* update docs to simplify build steps
* Gemfile.lock seemed to have an older version specified
* do not check in the pkg dir
2015-05-01 08:48:56 -07:00
Chris Fallin
14fd96224c Bump gem version to release bugfix. 2015-04-13 14:04:12 -07:00
Chris Fallin
e9abbd23fb Fixed issue #283: crash in JSON handler cleanup.
Includes repro test case from @wfarr.
2015-04-13 14:02:43 -07:00
Isaiah Peng
27e2b57830 add jruby support by protobuf-java reflection API 2015-03-10 23:14:08 +01:00
Chris Fallin
dfdec3b654 Updated Ruby gem version and added note to ruby/README.md regarding version number scheme.
Change-Id: Idb29077c153530de78ce28c094442aa8f51ddd25
2015-03-03 10:56:23 -08:00
Jisi Liu
40f2df3c16 Bump the version number to 3.0.0-alpha-3-pre
Change-Id: I33479e529b060e4fed532a827a386d3baecc835e
2015-03-02 19:31:31 -08:00
Chris Fallin
21fb217e6a Updated Ruby README with more details on getting started.
Change-Id: I54df314660cdb861ad8c4da75a08d4cb97faf638
2015-02-23 12:28:43 -08:00
Chris Fallin
11ad1bd277 Update Ruby gem version to 3.0.0.alpha.2.0.
This update conforms to our two-numbers-after-alpha scheme that allows
us to bump the last number if we need to re-upload a gem. (Rubygems does
not allow re-use of a version number once a gem is uploaded.)

Change-Id: Ia8e7c129d19800afd66f8052785cf5a00462c7ba
2015-02-20 18:06:31 -08:00
Chris Fallin
6ad8f547fe Updated Ruby README.
Change-Id: I8c3717f549c9b4e9d07c77ec5875c9cd62b296ac
2015-02-20 17:49:14 -08:00
Chris Fallin
db87a9c07a Merge pull request #211 from isaiah/map_inspect
Ruby implementation Map#inspect should be consistent with Hash#inspect
2015-02-17 13:02:32 -06:00
Isaiah Peng
4502626fa7 Google::Protobuf::Map#inspect should be consistent with Hash#inspect 2015-02-14 22:15:12 +01:00
Chris Fallin
315b93fdcc Addressed code-review comment. 2015-02-13 14:32:09 -08:00
Chris Fallin
a2bea0a001 Properly support maps in Ruby protoc and another bugfix.
Previously, we supported map fields in the Ruby DSL. However, we never
connected the final link in the chain and generated `map` DSL commands
for map fields in `.proto` files. My apologies -- I had been testing
with the DSL directly so I missed this.

Also fixed a handlerdata-setup-infinite-loop when a map value field's
type is its containing message.
2015-02-12 16:08:01 -08:00
Joshua Haberman
20490e33ca Merge pull request #189 from cfallin/update-ruby-upb
Updated to latest upb and added test for JSON map operation.
2015-02-05 15:22:17 -08:00
Chris Fallin
06bf6308ea README.md update for Ruby gem. 2015-02-05 14:58:57 -08:00
Chris Fallin
e7e79a43ed Merge pull request #190 from isaiah/to_ary
add #to_ary to RepeatedField
2015-02-03 09:57:13 -08:00
Isaiah Peng
ee5f6e9a35 add #to_ary to RepeatedField 2015-02-03 16:45:12 +01:00
Chris Fallin
a50759254f Updated to latest upb and added test for JSON map operation. 2015-02-02 15:07:34 -08:00
Chris Fallin
a3953da536 Updated based on code-review comments. 2015-02-02 13:16:57 -08:00
Chris Fallin
eb33f9d3d6 Updated based on code-review comments. 2015-02-02 13:03:08 -08:00
Chris Fallin
07b8b0f28d Addressed code-review comments. 2015-01-26 13:52:51 -08:00
Chris Fallin
9de35e7421 Addressed code-review comments. 2015-01-26 11:23:19 -08:00
Chris Fallin
e2debef5d8 Ruby extension: added oneof accessor. 2015-01-14 18:02:27 -08:00
Chris Fallin
e1b7d38d9a Addressed code-review comments. 2015-01-14 17:14:05 -08:00
Chris Fallin
3f3820d8f8 Two tests for Ruby code generator:
- A golden-file test that ensures protoc produces known-valid output.
- A Ruby test that loads that golden file and ensures it actually works
  with the extension.

This split strategy allows us to test end-to-end without needing to
integrate the Ruby gem build system and the protoc build system. This is
desirable because we do not want a gem build/install to depend on
building protoc, and we do not want building protoc to depend on
building and testing the gem.
2015-01-14 15:44:46 -08:00
Chris Fallin
fcd8889d5b Support oneofs in MRI Ruby C extension. 2015-01-14 14:35:57 -08:00
Chris Fallin
ace4212e60 Line-wraps at 80 chars. 2015-01-13 13:47:58 -08:00
Chris Fallin
addd26cbb3 Addressed code-review comments. 2015-01-12 16:09:35 -08:00
Chris Fallin
97b663a8be Update upb amalgamation. 2015-01-09 16:15:22 -08:00
Chris Fallin
4c92289766 Addressed code-review comments. 2015-01-09 15:37:55 -08:00
Chris Fallin
80276ac021 Addressed code-review comments. 2015-01-06 18:01:32 -08:00
Chris Fallin
fd1a3ff11d Support for maps in the MRI C Ruby extension.
This adds the Map container and support for parsing and serializing maps
in the protobuf wire format (as defined by the C++ implementation, with
MapEntry submessages in a repeated field). JSON map
serialization/parsing are not yet supported as these will require some
changes to upb as well.
2015-01-06 15:44:09 -08:00
Chris Fallin
91473dcebf Rename protobuf Ruby module to google/protobuf and rework its build
system. The Ruby module build now uses an amalgamated distribution of
upb, and successfully builds a Ruby gem called 'google-protobuf' with
module 'google/protobuf'.
2014-12-12 15:58:26 -08:00
Chris Fallin
973f425725 Provide a Ruby extension.
This adds a Ruby extension in ruby/ that is based on the 'upb' library
(now included as a submodule), and adds support for Ruby code generation
to the protoc compiler.
2014-12-09 16:55:59 -08:00