Commit Graph

7155 Commits

Author SHA1 Message Date
Joshua Haberman
f2c5ee5117
Fix for JSON serialization of 0/empty-valued wrapper types (#7198)
* Fixed Ruby JSON serialization of 0/empty wrapper fields.

* Removed newly-passing conformance tests from the failure list.
2020-02-11 13:18:32 -08:00
Adam Cozzette
802e1b99b2 Attempt to mitigate "docker pull" failures
Lots of CI tests have been failing recently with error messages like
this from "docker pull":

  Error response from daemon: unexpected EOF

This seems to be an issue affecting other projects as well:
https://forums.docker.com/t/docker-pull-causes-error-response-from-daemon-unexpected-eof/88608

This commit tries to mitigate the problem by periodically retrying
failed Docker pulls.
2020-02-11 12:59:49 -08:00
Tim Swast
29c83baecc
python: add sphinx docs (#6525)
* python: generate documentation with Sphinx and Read the Docs

Background:

Formerly, the Python protobuf reference documentation was built with
[Epydoc](http://epydoc.sourceforge.net/). This package has not been
updated since 2008, and it has inconsistent formatting (see internal
issue 131415575) with most Python documentation. Sphinx is used for the
official docs.python.org docs as well as most other Python packages,
including the Google client libraries and related packages, such as
https://googleapis.dev/python/google-api-core/latest/

To build the docs with Sphinx:

1. Install the needed packages (`sphinx`, `sphinxcontrib-napoleon` for
Google-style docstring support). I've created a conda environment file
to make this easier:

```
conda env create -f python/docs/environment.yml
```

2. (Optional) Generate reference docs files and regenerate index:

```
cd python
python generate_docs.py
cd ..
```

3. Run Sphinx.

```
cd python/docs
make html
```

About this change:

The script at `python/generate_docs.py` creates a ReStructured Text file
for each public module in the protobuf Python package. The script also
updates the table of contents in `python/docs/index.rst` to point to
these module references.

Future work:

Testing the docs build on PRs requires contributors to actually do some
setup work to configure builds on their fork. It'd be better if CI had a
docs build session to verify that the Sphinx docs generation at least
runs.

There are many warnings due to not-quite-correct docstrings in the
actual Python code itself. I'm choosing to ignore these errors to keep
the PR small, but I recommend you fix these and then enable "fail on
warnings" in the docs build on CI.

* add docs to EXTRA_DIST

* add instructions to build documentation to generate_docs.py

* exclude python/odcs from cpp_distcheck
2020-02-11 11:40:17 -08:00
Joshua Haberman
1a74ba4cb4
Fix for wrappers with a zero value (#7195)
* Add failing tests for issues with wrapped values where the value is the default

* Add test for wrapped values without a value set

* Bugfix for wrapper types with default values.

The previous optimizations for wrapper types had a bug that prevented
wrappers from registering as "present" if the "value" field was not
present on the wire.

In practice the "value" field will not be serialized when it is zero,
according to proto3 semantics, but due to the optimization this
prevented it from creating a new object to represent the presence of the
field.

The fix is to ensure that if the wrapper message is present on the wire,
we always initialize its value to zero.

Co-authored-by: Dan Quan <dan@quan.io>
2020-02-11 08:20:00 -08:00
Jan Tattermusch
f20be83927 enforce recursion depth checking for unknown fields 2020-02-10 15:30:47 -08:00
Paul Yang
ac70b7cfb7
Aggregate Metadata Files (#7155)
Instead of calling initOnce of dependencies, initialize metadata of dependencies in the same file.

Needs to pass aggregate_metadata option to protoc to trigger, e.g.:
--php_out=aggregate_metadata=foo#bar:generated_dir
For each input file, transitive dependencies (including itself), whose package name has the prefix of foo or bar, will be aggregated, in which their metadata string will be aggregated in the same internalAddGeneratedFile call. For other dependencies, initOnce is called as before.

This feature is EXPERIMENTAL. DO NOT USE!!!
2020-02-10 11:27:27 -08:00
Thomas Van Lenten
56c48ae592 Revisit how the WKTs are bundled with ObjC.
There are have been a few issues around people using case sensitive file systems
what Xcode/clang does when looking at the paths. In attempts to solve one set of
warnings, new warnings/errors happened in different setup. So, to hopefully put
these problem away for got, move the WKTs to be at the same level as the other
headers.

- Revert "Override CocoaPods module to lowercase (#6464)"
  This reverts commit 479ba8226b.
- Move WKTs to the objectivec directory and make the old headers shim back to
  the new locations.
- Update objectivec/generate_well_known_types.sh to check them one at a time
  and to deal with the new locations for them.

Fixes #6803
2020-02-10 12:20:05 -05:00
Rafi Kamal
7e0a081e78
Add js files added in #7176 to Makefiles (#7189) 2020-02-07 17:14:49 -08:00
Protobuf Team
cc938ea39a Project import generated by Copybara.
PiperOrigin-RevId: 293139128
2020-02-05 17:09:37 -08:00
Rafi Kamal
4cf5bfee95
Install RubyGem bundler version specified in Gemfile.lock to fix release failure (#7144)
* Update Gem version to fix Ruby release failure

Ref: https://bundler.io/blog/2019/05/14/solutions-for-cant-find-gem-bundler-with-executable-bundle.html
2020-01-30 13:08:31 -08:00
Dave MacLachlan
302f3ea1e5 Update GOOGLE_PROTOBUF_OBJC_VERSION to 30003 2020-01-30 13:08:32 -05:00
Elliotte Rusty Harold
5e014c2ddf
Update JUnit and Truth (#7149) 2020-01-29 12:51:46 -08:00
Elliotte Rusty Harold
a62ee83401 deps: update errorprone to 2.3.4 (#7125)
deps: update errorprone to 2.3.4
2020-01-28 12:16:17 -08:00
Dave MacLachlan
f4a6b99339 Block subclassing
Add GPB_FINAL macro to block subclassing of generated ObjC classes.
2020-01-24 11:51:37 -05:00
dmaclach
6f9d488149 Move min Xcode version to 10.3
Xcode 10.1 has a compiler bug that breaks on generated code.
Xcode 10.3+ appear to be fine.
2020-01-23 16:43:00 -05:00
Thomas Van Lenten
effb65d4e3 Move a few more size() > 0 calls over to !empty(). 2020-01-23 12:53:52 -05:00
Thomas Van Lenten
edf69e5858 Make the unittest proto file generation handle additions better.
Didn't really handle when a file was missing, but all the other were up to date,
this handles that case also.
2020-01-23 08:30:51 -05:00
Dave MacLachlan
e3c2af349f Clean up some warning messages.
- size vs empty
- unused decls
2020-01-22 14:42:57 -05:00
Dave MacLachlan
ab48ecf140 Update pddm to work with clang-format
Add clang-format off/on directives around pddm expansions to simplify formatting other code.
2020-01-21 13:14:01 -05:00
Dave MacLachlan
aa1d7e7c48 Change Objective C class references to using macros.
Allows easy replacing of class names in generated code using #define to redefine class names at compile time.
2020-01-21 12:12:11 -05:00
Paul Yang
39f4240856
Maven requires https connection (#7110) 2020-01-20 19:23:06 -08:00
Andres Valdes
35febfc2e9 Correct @return in Any.unpack docblock (#7089)
As per https://docs.phpdoc.org/latest/references/phpdoc/tags/return.html, the first token after the @return tag should be the return type.
2020-01-20 16:32:11 -08:00
Maxime Guerreiro
158b269097 Cleanup the RPC Implementations section
Remove dead links and update the ones that were moved.

Use https when possible.

Isolate inactive projects (not updated in the last few years) in a subsection.

release notes: no
2020-01-17 16:08:02 -08:00
dmaclach
f4b6e4a561 Clean up use of size() > 0 to !empty() 2020-01-15 17:54:53 -05:00
dmaclach
836d81a826 Fix up parameter name so decl matches defn
className -> class_name
2020-01-15 17:53:56 -05:00
Dave MacLachlan
74956e1c15 Use references to Objective C classes instead of looking classes up by name.
This should reduce binary size slightly, small performance improvement, and improve linkage by forcing references to all used classes.

Note that this maintains backwards compatibility for sources generated by older protoc for the time being. If you want the benefits
you will need to recompile your protos with the newer protoc.
2020-01-15 15:01:53 -05:00
Yannic
948740bc9d [bazel] Fix blacklisted_protos in cc_toolchain and add test (#7075) 2020-01-15 10:27:35 -08:00
Scott Hart
2d9b1788e7 bug: #7076 adds OUT and OPTIONAL to windows portability files (#7087) 2020-01-13 15:21:27 -08:00
salamaniibm
c3ffdabed5 correcting the s390x Arch name 2020-01-10 16:07:15 -08:00
Elliotte Rusty Harold
5a578d2a5c deps: update guava to 28.2-android 2020-01-10 10:52:48 -08:00
Yannic
082cc23afd Blacklist .proto source files if Bazel allows us to (#7065)
* Blacklist .proto source files is Bazel allows us to

This is a partial revert of 7b28278c7d to unblock, e.g., https://github.com/grpc/grpc/pull/21590 or https://github.com/lyft/envoy-mobile/issues/617 until Bazel is fixed.

Note: this is a forward-compatible change that automatically switches to the behavior intended by 7b28278c7d when a compatible Bazel is released without requiring users to upgrade Protobuf. We will revert this change when Bazel is fixed.

* Remove trailing ,

* Update BUILD
2020-01-09 10:23:02 -08:00
Rafi Kamal
ed8688de72
Merge pull request #7064 from rafi-kamal/3.11.x-202001071136
Merge branch 3.11.x to master
2020-01-08 12:24:20 -08:00
Brian Wignall
a104dffcb6 Fix typos (#7050)
Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos, with https://github.com/bwignall/typochecker to help automate the checking.
2020-01-08 10:18:20 -08:00
Jesse Wilson
3214d0b0b2 Fix mergeable docs to be consistent with checks (#7021) 2020-01-07 11:57:00 -08:00
Rafi Kamal
4500f31a6a Merge branch 3.11.x to master 2020-01-07 11:52:29 -08:00
Rafi Kamal
80eadc050d
Remove the section for uploading protoc packages to the GitHub release page (#6805)
Currently this is managed by the release script. We should also possibly remove the section for "Push artifacts to Maven Central"
2020-01-07 10:53:17 -08:00
Jie Luo
63cfdafacb
Fix python release breakages by set MB_PYTHON_OSX_VER (#7038) 2019-12-19 14:06:29 -08:00
Jie Luo
03ba4ac171
Add python3.8 in build_artifacts for linux and macos (#7019) 2019-12-19 10:27:39 -08:00
Jesse Wilson
6263268b8c Reserve 1076, 1077 for Wire since and until
release notes: no
2019-12-17 10:27:25 -08:00
Jie Luo
7faab5eeeb add python38 (#7009)
* add python38

* add python3.8

* fix tox
2019-12-13 15:49:18 -08:00
Rafi Kamal
04a11fc916
Remove duplicate license header from test protos (#7011) 2019-12-12 18:23:55 -08:00
Paul Yang
fe1790ca0d
Fix Multiple Request for PHP (#7008)
* Add scripts to test multirequest

* chmod ug+x multirequest.sh

* Add continuous test

* Compile c extension

* Class entry is obsolete in the second request
1) Needes to use class name in persistent map
2) Invalidate class entry stored in descriptor

* Add new files to dist

* Fix compile_extension

* Cleanup outputs for phpize
2019-12-12 13:59:51 -08:00
Jan-Gerd Tenberge
8baf3a4398 Add generate_descriptor_proto.sh output 2019-12-11 11:43:55 -08:00
Jan-Gerd Tenberge
e3ebf0c7e1 Add explicit cast to silence clang warning
Clang currently displays an error if source files generated with protoc are compiled with -Wcomma. This change fixes this as suggested by the compiler itself.
2019-12-11 11:43:55 -08:00
Rafi Kamal
39492b68d8
Update protobuf version to 3.11.2 (#7004) 2019-12-10 17:50:28 -08:00
Thomas Van Lenten
065fa2f395 Remove use of VLA.
VLAs complicate static analysis and bloat stack size. Replace VLA allocation
with calls to malloc and free.  This will alos the code to build with -Wvla.
2019-12-10 17:31:25 -05:00
William A Rowe Jr
53a814a0ee Treat F5-FF octets as single (invalid) characters
This corresponds to the newest reading of RFC 3629, and results
in the largest possible number of character entities by any
valid parser. This may result in a buffer which is oversized,
but never undersized.

This is after further discussion with acozzette in this PR;
https://github.com/protocolbuffers/protobuf/pull/6844

Signed-off-by: William A Rowe Jr wrowe@pivotal.io
Signed-off-by: Yechiel Kalmenson ykalmenson@pivotal.io
2019-12-10 13:35:38 -08:00
William A Rowe Jr
961c0e6b86 Correct interpretation of utf-8 0xf8-0xff
In consuming this useful string utility, it was discovered
that the interpretation of leading byte codes 0xf8-0xff
did not conform to either the RFC 3629 nor ISO/IEC 10646
definitions of utf-8.

The IETF RFC describes only 1-4 byte encodings (a limited
number of 4 byte encodings at that), and plainly states in
section 1. Introduction;
   o  The octet values C0, C1, F5 to FF never appear.

Alternately, the ISO definition "R.2 Specification of UTF-8"
preseented in the original IETF RFC 2279 clearly define the
meaning of leading byte values F5 through FD, and RFC 3629
Section 10. Security paragraph 3 calls out this alternate
reading (alterative to "never appears".) F5-F7 begin an
invalid (in the domain of unicode code points) 4-byte UTF-8
sequence (similar to F0-F4), while F8-FC begin a 5-byte
sequence, FC and FD begin a 6 byte sequence.

The curent code is wrong in that it doesn't treat the codes
F8-FF as invalid 1-byte characters, nor does it treat the
codes F8-FD as the correct number of bytes. No valid parser
will land these lead characters 4 bytes forward. Most will
treat these as the 5 or 6 byte utf-32 character and may then
treat the resulting character as invalid, while some parsers
may reject all leading F5-FF characters as a single byte of
erronious input, followed by each invalid continuation byte.

We propose the conventional reading of F8-FD as 5 and 6 byte
sequences as originally defined, while FE-FF must be read
as single byte invalid code points.

Signed-off-by: William A Rowe Jr <wrowe@pivotal.io>
Signed-off-by: Yechiel Kalmenson <ykalmenson@pivotal.io>
2019-12-10 13:35:38 -08:00
summerCol
6d087c256c fix typos in benchmarks/README.md 2019-12-10 11:32:44 -08:00
Yannic
4447fcc16f Add --<lang>_opt flag for all built-in generators
Plugins (and some built-in generators) have `--<lang>_opt` flag that
allows passing parameters one-by-one instead of passing them as
`--<lang>_out=<params>:<out_base>`. This PR changes protoc to
allow using `--<lang>_opt` for all (built-in) generators.
2019-12-10 11:26:51 -08:00