Commit Graph

7323 Commits

Author SHA1 Message Date
Joshua Haberman
73e48b4fb0
Merge pull request #7494 from haberman/3.12.x-202005121247
Update protobuf version to 3.12.0-rc2
2020-05-12 13:38:38 -07:00
Joshua Haberman
f597a24627 Update protobuf version 2020-05-12 12:49:46 -07:00
Joshua Haberman
51199fcba2
Merge pull request #7491 from haberman/cherry
Cherry-pick fixes onto 3.12.x branch for 3.12.0-rc2
2020-05-12 12:45:16 -07:00
Joshua Haberman
01e8c0fa34 Cherry-pick the fix to #7480 from #7485. 2020-05-12 11:34:02 -07:00
Joshua Haberman
c0b1ce00f3 Cherry-pick the fix for https://github.com/protocolbuffers/protobuf/issues/7463. 2020-05-12 11:06:05 -07:00
Jon Skeet
3c3646fa78 Implement HasPresence for C#
FieldDescriptor.HasPresence returns true if both ClearValue and HasValue (on the accessor) can be expected to work. Some fields have a working ClearValue, but no HasValue; HasPresence returns false for those fields.

Generally:

- Extension fields have presence if and only if they're singular
- Repeated fields do not support presence
- Map fields do not support presence
- Message fields support presence
- Oneof fields support presence (this includes synthetic oneof fields, so that covers proto3 optional singular fields)
- Proto2 singular primitive fields support presence
- Proto3 singular primitive fields do not support presence (unless they're in a oneof, covered above)
2020-05-12 10:58:05 -07:00
Jan Tattermusch
fc5ded36bc Merge pull request #7434 from jtattermusch/csharp_expose_options
C#: Get rid of broken GetOption API and expose the "GetOptions()" method on descriptors instead
2020-05-12 10:56:51 -07:00
Jon Skeet
807ea2f352 Fix to C# support library code
(This was the only use of a HasXyz property for a message type.)
2020-05-12 10:54:45 -07:00
Jon Skeet
13df985bff Regenerate C# code based on the previous commit
(This removes the Has/Clear members for message types in proto2.)
2020-05-12 10:54:45 -07:00
Jon Skeet
6a84e31818 Don't generate Has/Clear members for proto2 message fields.
This is a breaking change in terms of proto2 code generation: users who were previously using these members will have to change to null checks for message fields.
After toying with removing Has/Clear for proto2 oneof fields, I've left them alone in this commit, for consistency with other languages. The inconsistency between proto2 and proto3 won't come up here, because proto3 oneof fields can never be explicitly optional.

Fixes #7395.
2020-05-12 10:54:45 -07:00
Paul Yang
d001f8cee4
Ignore unknown enum value when ignore_unknown specified (#7455) (#7462) 2020-05-05 18:12:27 -07:00
Joshua Haberman
ef7cc81116
Added changelog entry for removing binary gems for Ruby <2.5. (#7454) 2020-05-01 13:10:28 -07:00
Joshua Haberman
e19bfc0e28
Stop building binary gems for ruby <2.5. (#7453)
It is no longer possible to "bundle install" these versions:

$ bundle install
Fetching gem metadata from https://rubygems.org/.................
reline-0.1.3 requires ruby version >= 2.5, which is incompatible with the current version, ruby 2.4.9p362
2020-05-01 12:35:09 -07:00
Joshua Haberman
a9f11d7d64
Updated version to 3.12.0-rc1. (#7449) 2020-04-30 15:34:10 -07:00
Joshua Haberman
26bec4b84c
Added changelog for 3.12.x. (#7442)
* Added changelog for 3.12.x.

* Updated the wording of the changelog for proot3 presence.

Also removed notice for change that was rolled back for
Java enums.

* A bit more teaking of the wording.
2020-04-29 17:16:03 -07:00
Thomas Van Lenten
2db0e9812a Use the new helpers from Descriptor. 2020-04-28 16:22:53 -04:00
Joshua Haberman
4b4e667435
Merge pull request #7435 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-28 09:52:24 -07:00
Nick Presta
75553e9ec8 Update shell format in installation instructions. 2020-04-28 08:51:04 -07:00
Joshua Haberman
140e1bb70e Merge branch 'sync-piper' into sync-stage 2020-04-28 08:40:38 -07:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Greg Steuck
4059c61f27
Typo in 'disciplines' (#7423) 2020-04-27 08:21:52 -07:00
Thomas Van Lenten
dddeed298b [ObjC] Typos and comment improvements. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
7b6016e343 [ObjC] Add tests for proto3 optional behaviors. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
b0e2792842 [ObjC] Generation changes around proto3 optional.
- Bump the version marker in the generated code.
- Set the flag to say clear on zero is known.
- Set clear on zero for proto3 optional fields that aren't tagged as optional.
- Also tweak the call from some C generated code to use different apis with
  better validation.
- Mark the ObjC generator as supporting the proto3 optional feature.
- Regenerate the WKTs to get the new flags.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
3c8e959b60 [ObjC] Update oneof clearing internals.
- Add/document an public api for clearing oneofs.
- Move the current library internals to a new api and keep a shim for old
  generated code.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e1e5b8af79 [ObjC] Update some library internals to not pass syntax versions.
- With the new flags, the syntax isn't needed, so don't pass it.
- To keep library binary compatibility, rename the helpers since one
  "Internal" method was called from generated code. Keep a shim with
  the old signature to support those generated sources.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
8d224b4c48 [ObjC] Runtime support for proto3 optional.
- Add a Descriptor flag to capture if the field should clear on being zeroed.
- Update the runtime to use the new clear on zero flag.
- Add a flag on message initialization to indicate the sources were generated
  with/without this support so the runtime can backfill the flag for older
  generated sources.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e9b0c92659 [ObjC] Update oneof generation for proto3 optional.
- Don't make an OneofGenerator for synthetic oneofs.
- Update the field calculations that determine if hasbits are needed to
  know about synthetic oneofs and ignore them.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
59f8dd5faf [ObjC] Move over some custom logic to Descriptor provided info.
FieldDescriptor::has_presence works as a replacement for the custom logic we
had for FieldGenerator::WantsHasProperty(), and is already proto3 optional
aware.
2020-04-24 16:36:15 -04:00
Masaki Hara
f494cb222d
Test in Ruby 2.7 (#7386)
* Test in Ruby 2.7

* Turn off GC.stress for 'require' in Ruby 2.7

* Backport 2c8364b to compatibility_tests/v3.0.0
2020-04-24 09:50:27 -07:00
Jon Skeet
81c9b85dee Add new files into Makefile.am 2020-04-24 17:39:14 +01:00
Jon Skeet
97737072f9 Add reflection support for proto3 optional fields
This is more involved than might be expected because the synthetic oneofs don't generate the properties we would usually expect to see.
2020-04-24 17:39:14 +01:00
Jon Skeet
bad9d753ae Add unit tests for proto3 optional fields
(This isn't as exhaustive as it might be, but the behavior is basically the same as proto2 optional fields.)
2020-04-24 17:39:14 +01:00
Jon Skeet
b0649a088a Regenerate C# code with the new generator, adding unittest_proto3_optional.proto
The changes in the existing proto2 code are solely around presence bits. The new generator allocated presence bits more efficiently. (Previously bits were sometimes allocated but never used.)
2020-04-24 17:39:14 +01:00
Jon Skeet
4dcafd12cb Support proto3 optional fields in the C# generator
Most changes are:

- Introducing new helpers of SupportsPresenceApi and RequiresPresenceBit. This allows calling code to be a lot clearer about what it's interested in.
- Changing most previous IsProto2 calls to use one of the two new helper methods
- Avoiding treating synthetic oneofs as regular ones
- Some slight refactoring in csharp_primitive_field to avoid code duplication
- Comments explaining what we want when, so the next maintainer doesn't need to do the detective work I did!

This change deliberately doesn't modify the API surface of any
existing code. The only change to previously-generated C# should be
making presence bits more efficient in proto2.

Once proto3 optional fields are supported, we can consider further
changes to make the proto2 and proto3 generated API surface more
consistent (e.g. adding presence API for message fields and oneofs).
2020-04-24 17:39:14 +01:00
Jon Skeet
4c9613f226 Register that the C# compiler supports proto3 presence.
(It doesn't yet, but will in the next commits...)
2020-04-24 17:39:14 +01:00
Joshua Haberman
7eddac7877
Added some info about Reflection, and a note about timeline. (#7416)
* Added some info about Reflection, and a note about timeline.

* Fixed heading levels.

* A bit more info.
2020-04-23 14:33:53 -07:00
Joshua Haberman
fda8544a59
Howto doc for implementing proto3 presence in a code generator. (#7407) 2020-04-23 13:00:30 -07:00
David L. Jones
e48c92952d
Add application note for explicit presence tracking. (#7390)
This includes instructions for enabling explicit presence tracking in proto3, and also explains implicit presence. The language examples were written by inspection, and not individually tested.
2020-04-23 12:59:51 -07:00
Joshua Haberman
6b759688a1
Implemented proto3 presence for Ruby. (#7406)
* WIP.

* WIP.

* Builds and runs. Tests need to be updated to test presence.

* Ruby: proto3 presence is passing all tests.

* Fixed a bug where empty messages has the wrong oneof count.
2020-04-23 12:54:25 -07:00
David L. Jones
94afb8ab36
Add Ruby tests for oneof cases. (#7385)
In Ruby, the oneof case returns a symbol with the name of the field that is set. These were not previously tested.
2020-04-23 12:49:04 -07:00
David L. Jones
c953182fa9
Generate documentation for internal.container. (#7294)
Since our (public) generated APIs document their use of repeated fields, we should probably document its API, too.

This includes some changes to generate_docs.py to explicitly allow named modules, since the repeated field implementation lives in the "internal" tree.
2020-04-22 21:41:12 -07:00
Joshua Haberman
18950451c7
Ruby: assigning 'nil' to submessage should clear the field. (#7397)
Previously if you assigned 'nil' to a submessage in proto2
the field would be set to 'nil' but would still have its hasbit
set. This was a clear bug so I'm fixing it outright, even though
it is an observable behavior change.
2020-04-20 15:51:05 -07:00
Joshua Haberman
81573b9256
Merge pull request #7402 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-20 12:28:08 -07:00
Thomas Van Lenten
a8a400da5d Move to constexpr. 2020-04-20 11:31:04 -04:00
Joshua Haberman
bb30225f06 Sync from Piper @307316823
PROTOBUF_SYNC_PIPER
2020-04-19 18:01:44 -07:00
Joshua Haberman
e164e15027 Merge branch 'sync-piper' into sync-stage 2020-04-19 18:01:44 -07:00
Paul Yang
f15ac4091f
Drop 3.3, 3.4 and use single version docker images for all python tests (#7396)
* Create a new docker image for python 3.6

The previous one cannot build, because python3.6 was removed from
stretch.

* Drop support for 3.3 and 3.4

Also update all docker file to be single version
2020-04-18 14:39:52 -07:00
Eric Walker
2c8364bcd1
Rails2.7 segfaults (#7091)
* Add a test suite for ruby 2.7

* Call BigDecimal() instead of BigDecimal.new()

BigDecimal.new was deprecated in ruby 2.6

* Switch FrozenError expectation to a matcher

The error message for FrozenError changed to include more information
about the mutated object. Switch from an exact match to an aproximate
match (equal => match). This does not change the prefix.

* We can safely ignore newest array methods from ruby 2.7
2020-04-17 10:20:38 -07:00
Masaki Hara
64f6c59ccb
Build extensions for Ruby 2.7 (#7027)
* Build extensions for Ruby 2.7

* Try installing bundler 2.x

* Try bumping rake-compiler-dock

* Use standard RCD images

* Avoid 'rake cross native' with rake-compiler-dock

* Use Ruby 2.5 for building Ruby <= 2.6

* Use rake-compiler 1.1.0

* Specify target

* Don't update Ruby test image for now
2020-04-16 23:31:47 -07:00