Commit Graph

7823 Commits

Author SHA1 Message Date
Joshua Haberman
f1256df893 Created Options struct for PHP codegen options. 2020-09-29 16:43:38 -07:00
Joshua Haberman
b414077041 Added an anonymous namespace and removed unused code. 2020-09-29 15:57:45 -07:00
Joshua Haberman
a0eef68bbd Regenerated well-known types and moved hand-written messages into base classes. 2020-09-29 15:47:47 -07:00
Vlad Vesa
d16bf914bc Fix: gcc 9 -Warray-bounds warnings about memset() in generated code 2020-09-29 14:58:28 -07:00
Adam Cozzette
3d8943fea9
Work around Codespell false positive (#7924)
The Codespell checker is saying we should replace "files'" with
"file's", but this is not a real issue since the single-quote on the end
is being used as a quote and not an apostrophe. Let's tell Codespell to
ignore this.
2020-09-28 18:35:23 -07:00
Joshua Haberman
d90f3b8b17 Fixed build failure in conformance tests. 2020-09-28 14:40:09 -07:00
Joshua Haberman
a633ad452d Ran update_file_lists.sh to pick up arenastring.cc. 2020-09-28 12:19:39 -07:00
Joshua Haberman
2181e8cb3f Fixed undeclared variable errors. 2020-09-28 12:04:15 -07:00
Joshua Haberman
0eb317c36d Updated Changelog. 2020-09-28 11:55:27 -07:00
Joshua Haberman
aefc1e7670 Merge tag 'refs/tags/sync-piper' into sync-stage
# Conflicts:
#	conformance/failure_list_js.txt
#	src/google/protobuf/generated_message_reflection.h
2020-09-28 11:55:10 -07:00
Joshua Haberman
38d6de1eef Sync from Piper @334206209
PROTOBUF_SYNC_PIPER
2020-09-28 11:54:54 -07:00
Robin Linden
40f5b0b30f Fix undef warning when building w/ clang or gcc on Windows 2020-09-28 11:15:17 -07:00
Robert Yokota
300dfcc5bf Reserve 1088 for Confluent Schema Registry 2020-09-25 11:12:03 -07:00
David L. Jones
02955622cc
[bazel/py] Omit google/__init__.py from the Protobuf runtime. (#7908)
Since `google` is a Python namespace package, the google/__init__.py
file should be omitted to avoid collisions. For example, its presence
may cause other Pip packages in the google namespace not to be found.

This change narrows which __init__.py files are included in the
`//:protobuf_runtime` target to include only those under
`google/protobuf`. It also moves their canonical inclusion to the
internal `//:python_srcs` rule, eliminating the dual specification in
`python_protobuf.extra_srcs`.

This is the difference in files, lexicographically ordered:

```
$ bazel cquery 'labels(srcs, kind(py_library, deps(:protobuf_python)))' | sort > /tmp/deps-{before,after}.txt
$ diff /tmp/deps-{before,after}.txt
1,5d0
< //:python/compatibility_tests/v2.5.0/tests/__init__.py (null)
< //:python/compatibility_tests/v2.5.0/tests/google/__init__.py (null)
< //:python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py (null)
< //:python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py (null)
< //:python/google/__init__.py (null)
51d45
< //:python/protobuf_distutils/protobuf_distutils/__init__.py (null)
```

This seems like a desirable change, since it avoids polluting other
packages, too.

This change is conceptually similar to #7877, but for Bazel.
2020-09-23 15:20:38 -07:00
David L. Jones
66e3562aaf
Remove uses of pkg_resources in non-namespace packages. (#7902)
In #713 and #1296, the `google` package in protobuf sources was found
to cause conflicts with other Google projects, because it was not
properly configured as a namespace package [1]. The initial fix in
786f80f addressed part of the issue, and #1298 fixed the rest.

However, 786f80f (the initial fix) also made `google.protobuf` and
`google.protobuf.pyext` into namespace packages. This was not correct:
they are both regular, non-namespace, sub-subpackages.

However (still), the follow-up #1298 did not nominate them as
namespace packages, so the namespace registration behavior has
remained, but without benefit.

This change removes the unnecessary namespace registration, which has
substantial overhead, thus reducing startup time substantially when
using protobufs.

Because this change affects the import internals, quantifying the
overhead requires a full tear-down/start-up of the Python interpreter.
So, to capture the full cost for every run, I measured the time to
launching a _fresh_ Python instance in a subprocess, varying the
imports and code under test. In other words, I used `timeit` to
measure the time to launch a _fresh_ Python subprocess which actually
performs the imports.

* Reference: normal Python startup (i.e., don't import protobuf at all).
  ```
   % python3 -m timeit -s 'import subprocess' -r 3 -n 10 'subprocess.call(["python3", "-c", "pass"])'
  10 loops, best of 3: 27.1 msec per loop
  ```

* Baseline: cost to import `google.protobuf.descriptor`, with
  extraneous namespace packages.
  ```
  % python3 -m timeit -s 'import subprocess' -r 3 -n 10 'subprocess.call(["python3", "-c", "import google.protobuf.descriptor"])'
  10 loops, best of 3: 133 msec per loop
  ```

* This change: cost to import `google.protobuf.descriptor`, without
  extraneous namespace packages.
  ```
  % python3 -m timeit -s 'import subprocess' -r 3 -n 10 'subprocess.call(["python3", "-c", "import google.protobuf.descriptor"])'
  10 loops, best of 3: 43.1 msec per loop
  ```

[1]:  https://packaging.python.org/guides/packaging-namespace-packages/
2020-09-22 20:46:07 -07:00
Joshua Haberman
cae85a9f11
PHP: Added == operators for Map and Array. (#7900) 2020-09-22 11:44:52 -07:00
Fabrice Fontaine
3abbbd8870 python/setup.py: remove unneeded wheel dependency
wheel is required since version 3.13.0 and
ff92cee10b

This will result in the following build failure when cross-compiling:

Download error on https://pypi.org/simple/wheel/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'wheel' (maybe misspelled?)
Download error on https://pypi.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or working download links found for wheel

Remove wheel requirement from setup.py as it is only needed by
release.sh, not by setup.py

Fixes:
 - http://autobuild.buildroot.org/results/371c686a10d6870933011b46d36b1879d29046b9

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-09-21 12:25:14 -07:00
James Brock
c2d089e413 Add Purescript protobuf to third-party list 2020-09-18 10:26:39 -07:00
David L. Jones
f4aa17b28a Update documentation for protobuf_distutils Python package.
This updates README.md to use an example with pip instead of setup.py.
The README.md is then used as the long_description argument to setup(),
so that the doc shows up on pypi.
2020-09-14 20:14:32 -07:00
Joshua Haberman
f0942fb0a2
Equals passes tests in both pure-PHP and the C extension. (#7883) 2020-09-14 13:40:07 -07:00
Yuriy Chernyshov
2361b1960f Fix more -Wunused-parameter warnings 2020-09-09 16:57:49 -07:00
xiaahui
5ecb4ab4cd remove GetArena in _InternalParse 2020-09-09 16:47:00 -07:00
Keith Smiley
cdf5022ada Use {} 2020-09-08 15:49:54 -07:00
Keith Smiley
8f2ae3a0fc Fix -Wmissing-field-initializers warning 2020-09-08 15:49:54 -07:00
Keith Smiley
0110ff5659 Update rules_proto
This was pretty behind 97d8af4dc4...4029855629
2020-09-03 09:23:28 -07:00
Romain Geissler
76f9074c1c Fix some -Wunused-parameter warnings which appeared in release 3.13.0. 2020-09-03 09:11:11 -07:00
Masaki Hara
f5bdd7cd56
JS: parse (un)packed fields conditionally (#7379) 2020-08-31 13:30:23 -07:00
David L. Jones
ff06e23d23
Add a setuptools extension for generating Python protobufs (#7783)
This extension allows Python code to be generated from setup.py files, so they
are created as part of a normal Python build. The extension uses an already-existing
protoc binary, which can be explicitly specified if needed.
2020-08-31 10:40:57 -07:00
Joshua Haberman
70b02861f8
Merge pull request #7845 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-08-25 21:33:27 -07:00
Joshua Haberman
5c26cae18c Re-add change that was somehow lost. 2020-08-25 14:42:47 -07:00
Joshua Haberman
e1ee430d16 Re-add fix that somehow was lost pushing back to Piper. 2020-08-25 14:28:24 -07:00
Joshua Haberman
28d6aa04f6 Merge tag 'refs/tags/sync-piper' into sync-stage 2020-08-24 15:48:44 -07:00
Joshua Haberman
f3cf99c0fb Sync from Piper @328224070
PROTOBUF_SYNC_PIPER
2020-08-24 15:48:43 -07:00
Adam Cozzette
1b18833f4f Tweaked update_version.py to leave PHP notes blank
Until now update_version.py has copied the notes from the previous PHP
release, which is not very useful.
2020-08-21 16:33:52 -07:00
Adam Cozzette
6da79e94b0 Fixed VERSION_SUFFIX logic in update_version.py
This commit makes a couple of fixes:
- Make sure we always update the suffix, since even for a non-RC release
  we need to clear the suffix.
- Make sure the suffix is properly quoted and begins with -rc
2020-08-21 16:33:52 -07:00
Lőrinc Pap
4b93993ac7 Update Gradle dependency reference format
See https://docs.gradle.org/current/userguide/java_library_plugin.html
> The compile, testCompile, runtime and testRuntime configurations inherited from the Java plugin are still available but are deprecated. You should avoid using them, as they are only kept for backwards compatibility.
2020-08-20 15:13:03 -07:00
CauhxMilloy
090d28e8f7
Null Check in UnknownField::AddAll() (#7328)
UnknownField::AddAll() is called (multiple times) from UnknownField::MergeFrom(). The `extras` parameter is one of: `varintList`, `fixed32List`, `fixed64List`, `lengthDelimitedList`, or `groupList`. All of these members can be null, and are appropriately checked in other usage. If attempting to parse a proto with unknown extensions, and exception is thrown (NRE).
This adds the appropriate null check inside UnknownField::AddAll().
2020-08-20 14:42:53 -07:00
Misha Seltzer
223e89157a Removed test files from pypi distribution generation code.
Fixes #7493

By removing all test files from the distribution, we've reduced the .whl
file size from 1259808B (1.2MB) to 996042B (973K), which is 21% reduction,
And reduced the unpacked size from 5317178B (5.1MB) to 3251811B (3.2MB),
which is 39% reduction.

Size was measured for the protobuf-3.11.3-cp35-cp35m-manylinux1_x86_64.whl release.
2020-08-19 17:16:36 -07:00
Afshin Pir
a446e6472b Previously, I had incorrectly used some newer features of CMake(version 3.14). But Now I have updated this code to work with older versions of CMake too. 2020-08-19 17:03:36 -07:00
Adam Yi
88f3ef7d1d [bazel] Add default shell env to gen_well_known_protos_java
We may need the shell environment (potentially augmented with
`--action_env`) to invoke protoc on Windows. If protoc was built with
mingw, it probably needs .dll files in non-default locations that must be
in PATH. Previously with `--compiler=mingw-gcc`,
`bazel build //:gen_well_known_protos_java` would fail on Windows. This
CL fixes the issue.

Also we have `default_shell_env` set to True for `ProtoCompile`, this makes
the behavior consistent.

See #2933, and
585a27ad0a/proto/compiler.bzl (L130)
2020-08-19 17:01:40 -07:00
Mathijs Vogelzang
543817295e Add R8 rule to documentation
Using default production Android build and protobuf-lite leads to RuntimeExceptions. The workarounds are documented in issues and I took those discussions and summarized them in the lite.md file.
2020-08-19 15:44:57 -07:00
Saurabh Singhal
7db720e075 Modify update_version.py to update the version suffix as well. 2020-08-19 11:31:50 -07:00
Saurabh Singhal
b970be43ff Display beta version in "protoc --version"
Display the beta version when "protoc --version" is executed. Use
PROTOBUF_VERSION_SUFFIX for this purpose.
2020-08-19 11:31:50 -07:00
Adam Cozzette
7e787e091e Made the Codespell check skip protobuf generated code 2020-08-19 10:31:31 -07:00
Adam Cozzette
e5fe9b8cbd Updated CHANGES.txt
Now that 3.13.0 has been released, this commit updates CHANGES.txt to
mention 3.13.0 instead of 3.13.0-rc1 and to include the recent PHP
changes. I also added a short explanation of the 3.12.4 release.

Fixes #7820.
2020-08-19 10:31:31 -07:00
Joshua Haberman
214c77e1b7
Merge pull request #7698 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-08-18 09:29:35 -07:00
Joshua Haberman
59d3966b1f Updated failure list for the PHP C implementation. 2020-08-17 17:55:16 -07:00
Joshua Haberman
492d0b543e Added new failing conformance tests to failure list. 2020-08-17 17:15:34 -07:00
Joshua Haberman
b3cdd40ef0 Added new map.cc file to Bazel BUILD file. 2020-08-17 17:12:44 -07:00
Joshua Haberman
82bad2e1eb Fixed uninitialized variable warning.
Unfortunately there's not an easy way to annotate that the
"unexpected mode" case is unreachable (even GOOGLE_LOG(FATAL)
in a default: case doesn't do it).
2020-08-17 17:09:56 -07:00