Commit Graph

7310 Commits

Author SHA1 Message Date
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
Rafi Kamal
da1c46401b Project import generated by Copybara
PiperOrigin-RevId: 301311140
2020-03-16 23:09:45 -07:00
Rafi Kamal
422053f3bc Project import generated by Copybara
PiperOrigin-RevId: 300708221
2020-03-13 00:58:26 -07:00
Jan Tattermusch
f57ae5eac3
Merge pull request #7279 from jtattermusch/ParseRawPrimitivesBenchmark
Add benchmark for measuring raw primitive parsing speed
2020-03-12 19:11:39 +01:00
Protobuf Team
94b39efdf7 Project import generated by Copybara
PiperOrigin-RevId: 300369497
2020-03-11 11:31:16 -07:00
Jan Tattermusch
a0cc0e83cb
Remove unnecessary branch from ReadTag (#7289)
* Remove unnecesary branch from ReadTag

* address comments
2020-03-11 10:29:37 -07:00
Joe Tsai
9bccb253c4 Add license header to benchmark/datasets .proto files 2020-03-11 09:52:33 -07:00
Jan Tattermusch
447b6bbad8 address review comments 2020-03-11 07:08:46 -04:00
Yannic
88a3193f42 Remove check that C++ version is at least C++98 2020-03-10 13:04:59 -07:00
Yannic
edb67ec446 Fix typo 2020-03-10 13:04:59 -07:00
Yannic
8a5a242364 Add compile-time tests for RTTI to port_def.inc
This eliminates an ODR violation where users compile and install
Protobuf's C++ runtime without RTTI but do not define
GOOGLE_PROTOBUF_NO_RTTI when compiling their project with
the generated code.
2020-03-10 13:04:59 -07:00
David L. Jones
6f129c123e
Update docs so we can generate better output from Sphinx. (#7295)
This change updates docstrings and comments so that they will produce nicer
formatting and cross-references from Sphinx. There are a few broad categories of
changes:

- Paramter and attribute docs are updated so that types will be recognized by
  Napoleon (https://sphinxcontrib-napoleon.readthedocs.io/en/latest/) This
  usually just means moving a colon in the docstring, so
  `name: (type) description` becomes `name (type): description`.

- References to other symbols can be cross-references if they have the right
  format. For example, "attr_name" might become ":attr:`attr_name`".
  https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#cross-referencing-python-objects

- For fenced code blocks, adding a double-colon `::` signifies a literal block.
  https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#literal-blocks

- Some bits of docstrings move from docstring to comments. For TODOs, this
  means we won't be putting stale (or otherwise unrelated) noise into the docs.
  For `Message.DESCRIPTOR`, the change means it gets appropriate documentation.

- There are some wording tweaks for consistency, and some new docstrings
  (especially for methods in Message).

For types, I used the convention of `list[Foo]` and `dict(foo, bar)`, which seem
to be common among other Python rst docstrings. Sphinx should generally
recognize both, and cross-links them correctly (both internally and to Python
library documentation). Upgrading to Python3-style type annotations would allow
us to use `sphinx-autodoc-typehints`; the changes in this commit are very
similar to typing-based hints.
2020-03-10 12:57:30 -07:00
Rafi Kamal
637d7eda30 Project import generated by Copybara
PiperOrigin-RevId: 300117791
2020-03-10 10:08:50 -07:00
David L. Jones
228fbf513d Change dependencies in the Conda environment.
We can remove the dependency on sphinxcontrib, since sphinx.ext.napoleon is
already available. This means we can drop conda-forge, which substantially
reduces build memory usage (see: readthedocs/readthedocs.org#6742,
conda/conda#5003, conda/conda#8650, readthedocs/readthedocs.org#6692).

Bump Sphinx to 2.4.0, while we're at it.
2020-03-09 19:55:33 -07:00
Rafi Kamal
4fa3c8e883 Project import generated by Copybara
PiperOrigin-RevId: 299970447
2020-03-09 17:00:42 -07:00
Falko Axmann
460376190b cmake: extended protobuf_generate
Added an optional `PLUGIN` argument to `protobuf_generate` which
will be forwarded to the `--plugin=` argument of `protoc`.
2020-03-09 15:03:07 -07:00
David L. Jones
f130827371 Don't expect to include Python ReadTheDocs metadata in the distribution. 2020-03-06 17:34:07 -08:00
David L. Jones
619a8262aa Make sure setup.py has a valid path.
In some invocation patterns, `os.path.dirname(__file__)` may not return a valid
value. This change defaults to os.curdir in that case.
2020-03-06 17:34:07 -08:00
Jan Tattermusch
b90d3bd854 add benchmark for measuring raw primitive parsing speed 2020-03-05 12:09:11 +01:00
Yannic Bonenberger
723a85f797 [bazel] Remove bootstrap hack from cc_proto_library and add interop with proto_library
Bazel had a native `cc_proto_library` for more than 2 years now.
This is the first step towards removing that rule from the Protobuf
repo.
2020-03-04 09:25:41 -08:00
Yannic
2e51ad6344
[bazel] Update gtest and deprecate //external:{gtest,gtest_main} (#7237)
This change updates the gtest-version used by Bazel.
Also, `//external:{gtest,gtest_main}` is deprecated so we can remove some
of the uses of the discouraged `bind` function.

RELNOTES[bazel]: Starting with Protobuf 3.13.0, building and running
Protobuf tests requires `@com_google_googletest//:{gtest,gtest_main}`
instead of `//external:{gtest,gtest_main}`. Use
`--@com_google_protobuf//:incompatible_use_com_google_googletest=true`
to verify your workspace is not affected by this change.
2020-03-02 15:15:22 -08:00
Rafi Kamal
398b801355
Merge pull request #7275 from protocolbuffers/rafi-kamal-patch-3
Add bazel to the list of acceptable mergeable tags
2020-03-02 15:11:43 -08:00
Rafi Kamal
37934fe46f
Update mergeable.yml 2020-03-02 15:10:49 -08:00