Commit Graph

7382 Commits

Author SHA1 Message Date
Jan Tattermusch
638a0813b4 increase coverage of GeneratedMessageTest 2020-04-14 18:04:47 +02:00
Jan Tattermusch
c2925d5b93 fix C# compatibility tests 2020-04-14 13:06:45 +02:00
Jan Tattermusch
0df7ddc805 regenerate 2020-04-14 12:47:32 +02:00
Jan Tattermusch
92076f7007 codegen: InternalMergeFrom 2020-04-14 12:47:32 +02:00
Jan Tattermusch
d7e2c8387a change MergeFrom_Internal to InternalMergeFrom 2020-04-14 12:47:32 +02:00
Jan Tattermusch
3936114642 remove newline 2020-04-14 10:44:55 +02:00
James Newton-King
18bfd9e2e5 Fix net45 tests 2020-04-14 10:37:30 +02:00
Jan Tattermusch
07182a843c optimize initialization of ParseContext 2020-04-14 09:37:59 +02:00
Jan Tattermusch
d17b5115d2 faster initialization of ParserInternalState 2020-04-14 09:37:59 +02:00
Jan Tattermusch
42eff9d640 ParseMessageBenchmark: parsing from ReadOnlySequence 2020-04-14 09:37:59 +02:00
Jan Tattermusch
5f836193c7 ParseRawPrimitivesBenchmark: compare CodedInputStream vs ParseContext 2020-04-14 09:37:59 +02:00
Jan Tattermusch
b2d2915439 make Google.Protobuf internals visible to benchmarks 2020-04-14 09:37:59 +02:00
Jan Tattermusch
3196ef9b5c regenerate C# protos 2020-04-14 09:37:59 +02:00
Jan Tattermusch
f6bdd7d479 codegen changes 2020-04-14 09:37:58 +02:00
Jan Tattermusch
220e7be708 make things build after codegen change 2020-04-14 09:37:58 +02:00
Jan Tattermusch
6d5bc90d48 add ParseFrom(ReadOnlySequence) methods 2020-04-14 09:37:58 +02:00
Jan Tattermusch
ea605381e6 make everything build 2020-04-14 09:37:58 +02:00
Jan Tattermusch
175c96565f bring in new files 2020-04-14 09:37:57 +02: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
James Roper
ab968155e5 Add Cloudstate extensions 2020-03-19 08:40:39 -07:00
Joshua Haberman
4567a21004
Removed unnecessary includes of well-known types from PHP generator. (#7311)
* Removed unnecessary includes of well-known types from PHP generator.

* Changed some split calls to work properly with the Copybara import rewrites.
2020-03-18 16:29:29 -07:00
Rafi Kamal
53128559ae
Update missing/renamed kernel files (#7310) 2020-03-17 12:16:12 -07:00
Adam Cozzette
a80775c391 Allocated extension number 1079 for grpc-graphql-gateway
Fixes issue #7302.
2020-03-17 08:27:19 -07:00