Skip to content

Commit e10d663

Browse files
committed
Update cpp-protobuf to 22.5
Привет!\ Этот PR переключат cpp & python библиотеки protobuf на версию 22.5 Если у вас возникли проблемы после влития этого PR: 1. Если начали падать канон тесты, то проведите их переканонизацию 2. Прочитайте <https://wiki.yandex-team.ru/users/nechda/obnovlenie-cpp-protobuf-22.5/> страничку с основными изменениями 3. Если страничка в вики не помогла, то пишите в [DEVTOOLSSUPPORT](https://st.yandex-team.ru/DEVTOOLSSUPPORT) 7fecade616c20a841b9e9af7b7998bdfc8d2807d
1 parent e79b38f commit e10d663

File tree

580 files changed

+71989
-56511
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

580 files changed

+71989
-56511
lines changed

build/sysincl/misc.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,17 @@
526526
- contrib/libs/glibcasm/glibc/include/stdint.h
527527
- contrib/libs/cxxsupp/libcxx/include/stdint.h
528528

529+
# protoc uses raw string literals with #include statements, which drive our include parser crazy
530+
- source_filter: "^contrib/libs/protoc"
531+
includes:
532+
- "$base$google/protobuf/$path$"
533+
- "google/protobuf/$path$"
534+
- "$fwd_to$.$fwd_to_suffix$.h"
535+
- "$fwd_to$.proto.h"
536+
- "$name$.proto.h"
537+
- "$path$"
538+
- "$h_include$"
539+
529540
- source_filter: "^contrib/tools/bison/data"
530541
includes:
531542
- "]b4_location_include["

build/ymake.core.conf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,10 @@ module _BASE_UNIT: _BARE_UNIT {
625625
PROTOBUF_INCLUDE_PATH=${ARCADIA_ROOT}/contrib/libs/protobuf_std/src
626626
_PROTO_CMDLINE=$_CPP_VANILLA_PROTO_CMDLINE
627627
}
628-
when ($PROTOC_TRANSITIVE_HEADERS == "no") {
629-
CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
630-
CPP_PROTO_OUTS+=${output;main;norel;nopath;noext:File.deps.pb.h}
631-
}
628+
#when ($PROTOC_TRANSITIVE_HEADERS == "no") {
629+
# CPP_PROTO_PLUGINS=transitive_pb_h=false:${CPP_PROTO_PLUGINS}
630+
# CPP_PROTO_OUTS+=${output;main;norel;nopath;noext:File.deps.pb.h}
631+
#}
632632
}
633633

634634
SANITIZER_DEFINED=no

contrib/libs/grpc/include/grpcpp/impl/codegen/config_protobuf.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@
6868
#ifndef GRPC_CUSTOM_JSONUTIL
6969
#include <google/protobuf/util/json_util.h>
7070
#include <google/protobuf/util/type_resolver_util.h>
71+
#include <y_absl/status/status.h>
7172
#define GRPC_CUSTOM_JSONUTIL ::google::protobuf::util
72-
#define GRPC_CUSTOM_UTIL_STATUS ::google::protobuf::util::Status
73+
#define GRPC_CUSTOM_UTIL_STATUS y_absl::Status
7374
#endif
7475

7576
namespace grpc {

contrib/libs/protobuf/CHANGES.txt

Lines changed: 0 additions & 3413 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This project is governed by
2+
[Protobuf's Code of Conduct](https://github.com/protocolbuffers/.github/blob/main/profile/CODE_OF_CONDUCT.md).
3+

contrib/libs/protobuf/README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Protocol Buffers - Google's data interchange format
33

44
Copyright 2008 Google Inc.
55

6-
https://developers.google.com/protocol-buffers/
6+
[Protocol Buffers documentation](https://developers.google.com/protocol-buffers/)
77

88
Overview
99
--------
@@ -24,26 +24,21 @@ the [C++ Installation Instructions](src/README.md) to install protoc along
2424
with the C++ runtime.
2525

2626
For non-C++ users, the simplest way to install the protocol compiler is to
27-
download a pre-built binary from our release page:
28-
29-
[https://github.com/protocolbuffers/protobuf/releases](https://github.com/protocolbuffers/protobuf/releases)
27+
download a pre-built binary from our [GitHub release page](https://github.com/protocolbuffers/protobuf/releases).
3028

3129
In the downloads section of each release, you can find pre-built binaries in
32-
zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary
33-
as well as a set of standard .proto files distributed along with protobuf.
30+
zip packages: `protoc-$VERSION-$PLATFORM.zip`. It contains the protoc binary
31+
as well as a set of standard `.proto` files distributed along with protobuf.
3432

3533
If you are looking for an old version that is not available in the release
36-
page, check out the maven repo here:
37-
38-
[https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/)
34+
page, check out the [Maven repository](https://repo1.maven.org/maven2/com/google/protobuf/protoc/).
3935

4036
These pre-built binaries are only provided for released versions. If you want
4137
to use the github main version at HEAD, or you need to modify protobuf code,
4238
or you are using C++, it's recommended to build your own protoc binary from
4339
source.
4440

45-
If you would like to build protoc binary from source, see the [C++ Installation
46-
Instructions](src/README.md).
41+
If you would like to build protoc binary from source, see the [C++ Installation Instructions](src/README.md).
4742

4843
Protobuf Runtime Installation
4944
-----------------------------
@@ -63,22 +58,25 @@ how to install protobuf runtime for that specific language:
6358
| Go | [protocolbuffers/protobuf-go](https://github.com/protocolbuffers/protobuf-go)|
6459
| PHP | [php](php) |
6560
| Dart | [dart-lang/protobuf](https://github.com/dart-lang/protobuf) |
61+
| Javascript | [protocolbuffers/protobuf-javascript](https://github.com/protocolbuffers/protobuf-javascript)|
6662

6763
Quick Start
6864
-----------
6965

70-
The best way to learn how to use protobuf is to follow the tutorials in our
71-
developer guide:
72-
73-
https://developers.google.com/protocol-buffers/docs/tutorials
66+
The best way to learn how to use protobuf is to follow the [tutorials in our
67+
developer guide](https://developers.google.com/protocol-buffers/docs/tutorials).
7468

7569
If you want to learn from code examples, take a look at the examples in the
7670
[examples](examples) directory.
7771

7872
Documentation
7973
-------------
8074

81-
The complete documentation for Protocol Buffers is available via the
82-
web at:
75+
The complete documentation is available via the [Protocol Buffers documentation](https://developers.google.com/protocol-buffers/).
76+
77+
Developer Community
78+
-------------------
79+
80+
To be alerted to upcoming changes in Protocol Buffers and connect with protobuf developers and users,
81+
[join the Google Group](https://groups.google.com/g/protobuf).
8382

84-
https://developers.google.com/protocol-buffers/

contrib/libs/protobuf/src/README.md

Lines changed: 31 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,31 @@ Copyright 2008 Google Inc.
55

66
https://developers.google.com/protocol-buffers/
77

8-
C++ Installation - Unix
8+
CMake Installation
9+
-----------------------
10+
11+
To compile or install protobuf from source using CMake, see
12+
[cmake/README.md](../cmake/README.md).
13+
14+
C++ Protobuf - Unix
915
-----------------------
1016

1117
To build protobuf from source, the following tools are needed:
1218

13-
* autoconf
14-
* automake
15-
* libtool
16-
* make
19+
* bazel
20+
* git
1721
* g++
18-
* unzip
1922

20-
On Ubuntu/Debian, you can install them with:
23+
On Ubuntu/Debian, for example, you can install them with:
2124

22-
sudo apt-get install autoconf automake libtool curl make g++ unzip
25+
sudo apt-get install g++ git bazel
2326

2427
On other platforms, please use the corresponding package managing tool to
25-
install them before proceeding.
28+
install them before proceeding. See https://bazel.build/install for further
29+
instructions on installing Bazel, or to build from source using CMake, see
30+
[cmake/README.md](../cmake/README.md).
2631

27-
To get the source, download one of the release .tar.gz or .zip packages in the
32+
To get the source, download the release .tar.gz or .zip package in the
2833
release page:
2934

3035
https://github.com/protocolbuffers/protobuf/releases/latest
@@ -41,79 +46,23 @@ if you are using a release .tar.gz or .zip package):
4146
git clone https://github.com/protocolbuffers/protobuf.git
4247
cd protobuf
4348
git submodule update --init --recursive
44-
./autogen.sh
45-
46-
To build and install the C++ Protocol Buffer runtime and the Protocol
47-
Buffer compiler (protoc) execute the following:
48-
4949

50-
./configure
51-
make -j$(nproc) # $(nproc) ensures it uses all cores for compilation
52-
make check
53-
sudo make install
54-
sudo ldconfig # refresh shared library cache.
50+
To build the C++ Protocol Buffer runtime and the Protocol Buffer compiler
51+
(protoc) execute the following:
5552

56-
If "make check" fails, you can still install, but it is likely that
57-
some features of this library will not work correctly on your system.
58-
Proceed at your own risk.
53+
bazel build :protoc :protobuf
5954

60-
For advanced usage information on configure and make, please refer to the
61-
autoconf documentation:
55+
The compiler can then be installed, for example on Linux:
6256

63-
http://www.gnu.org/software/autoconf/manual/autoconf.html#Running-configure-Scripts
57+
cp bazel-bin/protoc /usr/local/bin
6458

65-
**Hint on install location**
66-
67-
By default, the package will be installed to /usr/local. However,
68-
on many platforms, /usr/local/lib is not part of LD_LIBRARY_PATH.
69-
You can add it, but it may be easier to just install to /usr
70-
instead. To do this, invoke configure as follows:
71-
72-
./configure --prefix=/usr
73-
74-
If you already built the package with a different prefix, make sure
75-
to run "make clean" before building again.
59+
For more usage information on Bazel, please refer to http://bazel.build.
7660

7761
**Compiling dependent packages**
7862

79-
To compile a package that uses Protocol Buffers, you need to pass
80-
various flags to your compiler and linker. As of version 2.2.0,
81-
Protocol Buffers integrates with pkg-config to manage this. If you
82-
have pkg-config installed, then you can invoke it to get a list of
83-
flags like so:
84-
85-
86-
pkg-config --cflags protobuf # print compiler flags
87-
pkg-config --libs protobuf # print linker flags
88-
pkg-config --cflags --libs protobuf # print both
89-
90-
91-
For example:
92-
93-
c++ my_program.cc my_proto.pb.cc `pkg-config --cflags --libs protobuf`
94-
95-
Note that packages written prior to the 2.2.0 release of Protocol
96-
Buffers may not yet integrate with pkg-config to get flags, and may
97-
not pass the correct set of flags to correctly link against
98-
libprotobuf. If the package in question uses autoconf, you can
99-
often fix the problem by invoking its configure script like:
100-
101-
102-
configure CXXFLAGS="$(pkg-config --cflags protobuf)" \
103-
LIBS="$(pkg-config --libs protobuf)"
104-
105-
This will force it to use the correct flags.
106-
107-
If you are writing an autoconf-based package that uses Protocol
108-
Buffers, you should probably use the PKG_CHECK_MODULES macro in your
109-
configure script like:
110-
111-
PKG_CHECK_MODULES([protobuf], [protobuf])
112-
113-
See the pkg-config man page for more info.
114-
115-
If you only want protobuf-lite, substitute "protobuf-lite" in place
116-
of "protobuf" in these examples.
63+
To compile a package that uses Protocol Buffers, you need to setup a Bazel
64+
WORKSPACE that's hooked up to the protobuf repository and loads its
65+
dependencies. For an example, see [WORKSPACE](../examples/WORKSPACE).
11766

11867
**Note for Mac users**
11968

@@ -127,64 +76,16 @@ To install Unix tools, you can install "port" following the instructions at
12776
https://www.macports.org . This will reside in /opt/local/bin/port for most
12877
Mac installations.
12978

130-
sudo /opt/local/bin/port install autoconf automake libtool
79+
sudo /opt/local/bin/port install bazel
13180

13281
Alternative for Homebrew users:
13382

134-
brew install autoconf automake libtool
83+
brew install bazel
13584

13685
Then follow the Unix instructions above.
13786

138-
**Note for cross-compiling**
139-
140-
The makefiles normally invoke the protoc executable that they just
141-
built in order to build tests. When cross-compiling, the protoc
142-
executable may not be executable on the host machine. In this case,
143-
you must build a copy of protoc for the host machine first, then use
144-
the --with-protoc option to tell configure to use it instead. For
145-
example:
146-
147-
./configure --with-protoc=protoc
148-
149-
This will use the installed protoc (found in your $PATH) instead of
150-
trying to execute the one built during the build process. You can
151-
also use an executable that hasn't been installed. For example, if
152-
you built the protobuf package for your host machine in ../host,
153-
you might do:
154-
155-
./configure --with-protoc=../host/src/protoc
156-
157-
Either way, you must make sure that the protoc executable you use
158-
has the same version as the protobuf source code you are trying to
159-
use it with.
160-
161-
**Note for Solaris users**
162-
163-
Solaris 10 x86 has a bug that will make linking fail, complaining
164-
about libstdc++.la being invalid. We have included a work-around
165-
in this package. To use the work-around, run configure as follows:
166-
167-
./configure LDFLAGS=-L$PWD/src/solaris
168-
169-
See src/solaris/libstdc++.la for more info on this bug.
17087

171-
**Note for HP C++ Tru64 users**
172-
173-
To compile invoke configure as follows:
174-
175-
./configure CXXFLAGS="-O -std ansi -ieee -D__USE_STD_IOSTREAM"
176-
177-
Also, you will need to use gmake instead of make.
178-
179-
**Note for AIX users**
180-
181-
Compile using the IBM xlC C++ compiler as follows:
182-
183-
./configure CXX=xlC
184-
185-
Also, you will need to use GNU `make` (`gmake`) instead of AIX `make`.
186-
187-
C++ Installation - Windows
88+
C++ Protobuf - Windows
18889
--------------------------
18990

19091
If you only need the protoc binary, you can download it from the release
@@ -220,15 +121,15 @@ That is, if you linked an executable against an older version of
220121
libprotobuf, it is unlikely to work with a newer version without
221122
re-compiling. This problem, when it occurs, will normally be detected
222123
immediately on startup of your app. Still, you may want to consider
223-
using static linkage. You can configure this package to install
224-
static libraries only using:
124+
using static linkage. You can configure this in your `cc_binary` Bazel rules
125+
by specifying:
225126

226-
./configure --disable-shared
127+
linkstatic=True
227128

228129
Usage
229130
-----
230131

231132
The complete documentation for Protocol Buffers is available via the
232133
web at:
233134

234-
https://developers.google.com/protocol-buffers/
135+
https://protobuf.dev/

contrib/libs/protobuf/src/google/protobuf/any.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2929
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3030

31-
#include <google/protobuf/any.h>
31+
#include "google/protobuf/any.h"
3232

33-
#include <google/protobuf/arenastring.h>
34-
#include <google/protobuf/descriptor.h>
35-
#include <google/protobuf/generated_message_util.h>
36-
#include <google/protobuf/message.h>
33+
#include "google/protobuf/arenastring.h"
34+
#include "google/protobuf/descriptor.h"
35+
#include "google/protobuf/generated_message_util.h"
36+
#include "google/protobuf/message.h"
3737

3838
// Must be included last.
39-
#include <google/protobuf/port_def.inc>
39+
#include "google/protobuf/port_def.inc"
4040

4141
namespace google {
4242
namespace protobuf {
@@ -47,7 +47,7 @@ bool AnyMetadata::PackFrom(Arena* arena, const Message& message) {
4747
}
4848

4949
bool AnyMetadata::PackFrom(Arena* arena, const Message& message,
50-
StringPiece type_url_prefix) {
50+
y_absl::string_view type_url_prefix) {
5151
type_url_->Set(
5252
GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena);
5353
return message.SerializeToString(value_->Mutable(arena));
@@ -79,4 +79,4 @@ bool GetAnyFieldDescriptors(const Message& message,
7979
} // namespace protobuf
8080
} // namespace google
8181

82-
#include <google/protobuf/port_undef.inc>
82+
#include "google/protobuf/port_undef.inc"

0 commit comments

Comments
 (0)