Commit Graph

7286 Commits

Author SHA1 Message Date
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
e164e15027 Merge branch 'sync-piper' into sync-stage 2020-04-19 18:01:44 -07:00
Joshua Haberman
bb30225f06 Sync from Piper @307316823
PROTOBUF_SYNC_PIPER
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
Daniel G. Taylor
97f5f649a4 docs: add python-betterproto
Adds the `betterproto` Python module to the list of implementations.
2020-04-16 09:22:52 -07:00
Thomas Van Lenten
7b8a241b57 [ObjC] Improve validation on public apis. 2020-04-15 13:22:05 -04:00
Thomas Van Lenten
95282469eb [ObjC] Remove helper to avoid extra lookups.
Skip the helper that fetches the desc again since these methods already
collected it.
2020-04-15 13:22:05 -04:00
Elliotte Rusty Harold
62832897c3 deps: update Guava to 29.0
@rafi-kamal
2020-04-14 15:19:40 -07:00
Joshua Haberman
88529f5017
Merge pull request #7378 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-14 14:04:23 -07:00
Joshua Haberman
74ad62759e Sync from Piper @306496510
PROTOBUF_SYNC_PIPER
2020-04-14 12:55:41 -07:00
Joshua Haberman
83ccdfc78d Merge branch 'sync-piper' into sync-stage 2020-04-14 12:55:41 -07:00
Thomas Van Lenten
6f3bda22f4 [ObjC] Fix some tests checking the wrong Message class. 2020-04-14 12:15:23 -04:00
Thomas Van Lenten
24dda9e233 Update the build/test script for newer Xcode 11 versions
Apple stopped really supporting the 32bit simulators, so don't try
running those any more.
2020-04-14 12:15:23 -04:00
Jan Tattermusch
50e03cdde3
Merge pull request #7360 from jtattermusch/refactor_googlebenchmark
Refactor some Protobuf C# microbenchmarks
2020-04-13 17:34:22 +02:00
Joshua Haberman
0d43ba41ee
Update to new upb version (#7372) 2020-04-11 09:46:20 -07:00
Joshua Haberman
fb32b5a343 Sync from Piper @305960231
PROTOBUF_SYNC_PIPER
2020-04-10 15:57:18 -07:00
Joshua Haberman
3be9322e28
Merge pull request #7368 from haberman/sync-integrate
Integrate from Piper @305505267 for C++, Java, and Python
2020-04-08 13:19:02 -07:00
Joshua Haberman
fb12ad7a7f Fixed compile errors from lack of "override" keyword. 2020-04-08 12:35:30 -07:00
Joshua Haberman
b7742c51fd Sync from Piper @305505267
PROTOBUF_SYNC_PIPER
2020-04-08 10:30:17 -07:00
Joshua Haberman
b606264771 Merge branch 'sync-piper' into sync-integrate 2020-04-08 10:30:17 -07:00
afshinpir
c91ab40081 Correcting import path selection for protoc
When there are multiple proto file inputs, they are matched with the provided proto directories (-I option). These directories are tested sequentially for each input proto file and if input file is in a subdirectory of provided proto directories, this directory is considered as base for calculating output directory. This update provides same manner and removes limitations imposed by using `${CMAKE_CURRENT_SOURCE_DIR}` as main proto import directory.
1- `${CMAKE_CURRENT_SOURCE_DIR}` is only added to include directories if no import directory is provided and we are not in `APPEND_PATH` mode. In addition it is added as last possible directory to decrease its priority in searching.
2- Each directory is checked against `${_protobuf_include_path}` to find first possible directory which is parent directory of input proto file. If a directory is found, `${_rel_dir}` is calculated based on its value. If no suitable folder is found, an error will be generated.
2020-04-07 10:27:11 -07:00
afshinpir
c62ffaa539 Incorrect selection of base name
protoc just changes last extension. We need this change to support files like a.b.proto in the path.
2020-04-07 10:27:11 -07:00
Jan Tattermusch
c762a3bb2a update Makefile.am 2020-04-07 12:01:29 +02:00
Jan Tattermusch
4116e65984 improve ParseMessageBenchmark maintainability 2020-04-07 11:56:37 +02:00
Joshua Haberman
df6e3a2f54
Merge pull request #7361 from haberman/sync-integrate
Integrate from Piper @305053102 for C++, Java, and Python
2020-04-06 10:56:49 -07:00
Joshua Haberman
503a2116aa Sync from Piper @305053102
PROTOBUF_SYNC_PIPER
2020-04-06 09:57:03 -07:00
Joshua Haberman
4692661ee4 Merge branch 'sync-piper' into sync-integrate 2020-04-06 09:57:03 -07:00
Jan Tattermusch
79cfc73293 refactor WrapperBechmark 2020-04-06 18:24:13 +02:00
Penelope Phippen
c558aa75a3
Call "Class#new" over rb_class_new_instance in decoding (#7352)
This patch has almost no change in behaviour where users have not
patched the implementation of new on either a specific proto object
class, or `Google::Protobuf::MessageExts::ClassMethods`. The default
implementation of `new`, and `rb_class_new_instance` have the same
behaviour.

By default when we call `new` on a class in Ruby, it goes to the `Class`
class's implementation:

```ruby
class Foo
end

>> Foo.method(:new).owner
=> Class
```

the `Class` implementation of `new` is (pseudocode, it's actually in c):

```ruby
class Class
  def new(*args, &blk)
    instance = alloc
    instance.initialize(*args, &blk)
    instance
  end
end
```

`rb_class_new_instance` does the same thing, it calls down to
[`rb_class_s_new`](https://github.com/ruby/ruby/blob/v2_5_5/object.c#L2147),
which calls `rb_class_alloc`, then `rb_obj_call_init`.

`rb_funcall` is a variadic c function for calling a ruby method on an object,
it takes:

* A `VALUE` on to which the method should be called
* An `ID` which should be an ID of a method, usually created with `rb_intern`,
  to get an ID from a string
* An integer, the number of arguments calling the  method with,
* A number of `VALUE`s, to send to the method call.

`rb_funcall` is the same as calling a method directly in Ruby, and will perform
ancestor chain respecting method lookup.

This means that in C extensions, if nobody has defined the `new` method on any
classes or modules in a class's inheritance chain calling
`rb_class_new_instance` is the same as calling `rb_funcall(klass,
rb_intern("new"))`, *however* this removes the ability for users to define or
monkey patch their own constructors in to the objects created by the C
extension.

In Ads, we define [`new`](https://git.io/JvFC9) on
`Google::Protobuf::MessageExts::ClassMethods` to allow us to insert a
monkeypatch which makes it possible to assign primitive values to wrapper type
fields (e.g. Google::Protobuf::StringValue). The monkeypatch we apply works for
objects that we create for the user via the `new` method. Before this commit,
however, the patch does not work for the `decode` method, for the reasons
outlined above. Before this commit, protobuf uses `rb_class_new_instance`.

After this commit, we use `rb_funcall(klass, rb_intern("new"), 0);` to construct
protobuf objects during decoding. While I haven't measured it this will have
a very minor performance impact for decoding (`rb_funcall` will have to go to the
method cache, which `rb_class_new_instance` will not). This does however do
the "more rubyish" thing of respecting the protobuf object's inheritance chain
to construct them during decoding.

I have run both Ads and Cloud's test suites for Ruby libraries against this
patch, as well as the protobuf Ruby gem's test suite locally.
2020-04-06 08:33:50 -07:00
Jan Tattermusch
a2cbd5a824 serialization benchmark improvements 2020-04-06 17:32:50 +02:00
Adam Cozzette
cf601047eb Allocated option number 1086 for ADLINK EdgeSDK
Fixes #7339.
2020-04-02 09:07:16 -07:00
Joshua Haberman
c649397029
Set execute bit on files if and only if they begin with (#!). (#7347)
* Set execute bit on files if and only if they begin with (#!).

Git only tracks the 'x' (executable) bit on each file. Prior to this
CL, our files were a random mix of executable and non-executable.
This change imposes some order by making files executable if and only
if they have shebang (#!) lines at the beginning.

We don't have any executable binaries checked into the repo, so
we shouldn't need to worry about that case.

* Added fix_permissions.sh script to set +x iff a file begins with (#!).
2020-04-01 15:28:25 -07:00
Joshua Haberman
e667bf6eaa
Merge pull request #7344 from haberman/sync-integrate
Integrate from Piper @304070343 for C++, Java, and Python
2020-04-01 09:42:57 -07:00
Joshua Haberman
462b928d63 Fixed build errors on MacOS. 2020-03-31 20:34:36 -07:00
Joshua Haberman
243558921f Some fixes to make the tests pass on Bazel. 2020-03-31 17:31:32 -07:00
Joshua Haberman
6e229f124e Revert mistake in the previous integration. 2020-03-31 17:08:31 -07:00
Joshua Haberman
9c676d83ea Regenerated protos with ./generate_descriptor_proto.sh 2020-03-31 16:35:09 -07:00
Joshua Haberman
b99994d994 Sync from Piper @304070343
PROTOBUF_SYNC_PIPER
2020-03-31 16:25:37 -07:00
Jie Luo
dec4939439
Update README.md (#7329) 2020-03-25 15:59:46 -07:00
Charlie Jiang
70fc0f0275 Force to use U.S. English for Win32 error messages (#4317) 2020-03-20 08:49:47 -07:00
Robert Morris
a015ca8cf8
Request SummaFT extension (#7314)
SummaFT develops a protoc plugin for both internal and external use that allows specific extensions to be made to extend the platform for GraphQL and OpenAPI 3.
2020-03-19 14:20:01 -07:00