Commit Graph

253 Commits

Author SHA1 Message Date
Alexey Edelev fea7b514a3 Move the list iterating logic when deserializing message using QProtobufJsonSerializer
Move the list iterating logic to the deserializeValue method. We
may detect the list type at the point when deserializing the
JSON-encoded repeated field. So it doesn't make sense to hold
this logic in list item deserializer, we may simply iterate over
list value there.

Pick-to: 6.7
Change-Id: I413993aed14971c8a1bc2c7bfd04aed6ad1cacda
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-03-08 14:16:32 +01:00
Alexey Edelev 6ba67dc89e Remove message registration in serialization handler map
QProtobufMessage::propertyOrdering now provides information
about the message property ordering. This allow us to use
the pointers to QProtobufMessage but not to the exact class
when (de)serializing messages.

This commit makes all private getter of message fields mutable.
If the message field is not initialized it will be initialized
at first access, like it's done in public getters.

This mechanism allows to hold the field allocation inside message
but not in the type deserializer. All serializers no should expect
that the message pointer that is passed to the deserialization
is valid message pointer.

To avoid unwanted message field allocation when using property
getter, QProtobufMessage::property method now accepts an extra argument.

If allowInitializeOptional is set to true, it skips checking the
'has<MessageField>' property before accessing the message field it self.

Protobuf messages that are used in oneof fields now require explicit
definition of operator=, since it's used when copying the data in
QVariant. Otherwise the warning related to the implicit definition of
operator= is produced.

Task-number: QTBUG-120931
Change-Id: I1b816295297e7ef8cd6d3f0abdcbe1e670597fd0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-08 14:16:29 +01:00
Alexey Edelev 0e95509104 Remove the redundant property ordering forwarding from all interfaces
QProtobufMessage::propertyOrdering now allows accessing the message
property ordering. So we can remove extra arguments from all interfaces
where the pointer or the reference to the related QProtobufMessage
is used as argument too.

[ChangeLog][Protobuf][QAbstractProtobufSerializer] The following
interfaces do not accept the QProtobufPropertyOrdering as an argument
anymore:
 - serializeObject
 - deserializeObject
 - serializeListObject
 - deserializeListObject
 - serializeMessage
 - deserializeMessage

Task-number: QTBUG-120931
Change-Id: I55cb8d3ceddd56751d542869e26aa0de73c22ebb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-03-08 14:16:22 +01:00
Alexandru Croitor 93a3c6b5ae CMake: Don't build benchmark if qtprotobufgen is missing
Amends ed50bef7d1

Change-Id: I74e82a0b686aa5efb737202305801a49f5b811e4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-03-04 10:47:00 +01:00
Mårten Nordheim ed50bef7d1 Protobuf: Add basic deserialize benchmark
Change-Id: I382269cd59c4f96f3f8e1956b8a1a97836e5b057
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-03-01 11:36:32 +00:00
Tatiana Borisova 5f11f7fee6 Add the missing QGrpcCall/ChannelOptions properties to QML
- added format serialization property

Task-number: QTBUG-120940
Change-Id: Ibf6486c9702c39c57f985ebbd22deb027463b5d1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-29 15:47:22 +01:00
Alexey Edelev 56f7edbe26 Extract wrapping namespace from package but not from messages/enums/services
Use the package defined in a .proto file when generating the wrapping
namespace statements. This fixes the crash when .proto file contain no
message definitions.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-122816
Change-Id: I0eb474217eb0126dee5919bbd7b12a20f8078124
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-29 12:19:27 +01:00
Mårten Nordheim e532fdaa7c Fix cmake config failure when grpc is missing
Because we back out and do not create the testserver target when we
don't find the grpc dependency we fail during the genex further down.

Pick-to: 6.7
Change-Id: Ia0415dc7ae09933503dabd2882b4643f087943ff
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-02-26 18:21:01 +01:00
Alexey Edelev 5dfafece5a Generate the explicit presence flag for protobuf message fields
Protobuf messages should have the explicit presence according to the
field presence specs. We should mark them with the respective field
flag to enable QProtobufMessage::property logic that verifies the
field presence according to the 'has<FieldName>' property value.

Add the ExplicitPresence field flag that now is generated for all
optional, message, and oneof fields.

[ChangeLog][Protobuf] All fields that have the message type now
generate the has<FieldName> property that indicates whether the field
is intialized or not.
[ChangeLog][Protobuf] All fields that have explcit presence now set
the 'ExplicitPresence' flag in their property ordering structures.

Task-number: QTBUG-120931
Change-Id: I962c38e1ebde04d393cafaa8b512a277d660b5fa
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-25 18:37:59 +01:00
Alexey Edelev 2cb4aafacd Add the missing serialization result check to the deserializeList handler
We should check whether the serialization was successful before
appending the value to the repeated field.

Fixes: QTBUG-121560
Pick-to: 6.7
Change-Id: I56583826ffc97e503348b0f8b86245f49b7f076e
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-24 01:24:00 +01:00
Alexey Edelev 889a91c1b4 Introduce QGrpcSerializationFormat
The QGrpcSerializationFormat class allows using either predefined
QAbstractProtobufSerializers(Protobuf/Json) or user-defined
serializers.

The serialization format is the part of QGrpcChannelOptions.
gRPC channel implementations should rely on respective value provided
by QGrpcChannelOptions when choosing the serialization format for
protobuf messages.

QGrpcHttp2Channel got full support of QGrpcSerializationFormat. It's
still possible to set the serialization format using the
QGrpcChannelOptions metadata, but QGrpcSerializationFormat is
considered with higher priority.

[ChangeLog][GRPC][QGrpcChannelOptions] Added the
withSerializationFormat and serializationFormat methods. These methods
allow to set/get the QGrpcSerializationFormat that should be used by
gRPC channel.

[ChangeLog][GRPC] Added the QGrpcSerializationFormat class.
QGrpcSerializationFormat allows customizing the serialization format
that is used in QAbstractGrpcChannel implementations.

Task-number: QTBUG-113777
Change-Id: Id9c802d08fb325a5bd09e603bd0d505a85f1d80d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-21 14:30:10 +01:00
Alexey Edelev 5b84714ac3 Rewrite the test server in golang
The server requires JSON serialization support for our testing purposes,
C++ API doesn't allow using JSON serialization in gRPC channels, but
the golang one allows. This introduces the different gRPC server
implementation that serve out needs. golang-base server only available
for the host Qt builds if QT_ALLOW_DOWNLOAD is enabled.

The reference C++ server is still used for cross-compiled Qt and
for the cases when go is not present in the system.

Task-number: QTBUG-113777
Change-Id: I9d821d56e5da629604e197707dbead2d5367f844
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-02-21 14:30:06 +01:00
Alexey Edelev 76c05ac9d5 Add JSON serialization support to QGrpcHttp2Channel
It's now possible to preselect the serialization format when creating
the channel using the 'Content-Type' metadata. Supported values for the
header:
 - application/grpc(default)
 - application/grpc+protobuf
 - application/grpc+json

Note: Not all servers and clients support JSON serialization format.

Task-number: QTBUG-113777
Change-Id: Ia25b3382e3addb2306acce112489ea3427687c0d
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-21 14:30:03 +01:00
Alexey Edelev cc54dccb64 End the native gRPC channel support
Remove the native gRPC channel implementation, respective feature and
tests.

Pick-to: 6.7
Change-Id: I71ef99746bb842d24f634ad52c77fee94edbe86f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-12 12:23:40 +01:00
Alexey Edelev ad6c1128c0 Implement unix:// sockets support
Add the support for the UNIX sockets to QGrpcHttp2Channel. The channel
only supports the non-encrypted communicatoin.

Pick-to: 6.7
Task-number: QTBUG-119074
Change-Id: Ie404999d7511a783e4d1504a0ac51e5fc97f23ba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-12 08:28:01 +01:00
Alexey Edelev 316de69d70 Enable client and bidir gRPC streaming
Enable the client and bidirectional gRPC streaming in gRPC HTTP/2
channel.

Pick-to: 6.7
Fixes: QTBUG-105494
Change-Id: I49c9a21cb118565bbf0c27add92fd7021e9f0d19
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-12 08:27:57 +01:00
Alexey Edelev cdb7696b36 Reimplement QGrpcHttp2Channel using QHttp2Connection
The implementation uses the gRPC HTTP/2 channel private API from the
QtNetwork module. New implementation allows utlizing HTTP/2 streams to
not only receive data from server streams, but also to send data from
client size. This improvement unlocks implementation of client-side
streaming.

Pick-to: 6.7
Task-number: QTBUG-105494
Task-number: QTBUG-105493
Change-Id: Ida8b1b37b7c70f7130b1ff4dcf8d6114b2dfd089
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-12 08:27:53 +01:00
Alexey Edelev b75bc17c33 Add the missing generating of the C++ exports to the qtgrpcgen
Make the generating of C++ exports common for both generators.
The confilicting generation should be resolved by the tools that
running the generators. Qt CMake API handles this situation.

Fixes: QTBUG-121856
Pick-to: 6.7
Change-Id: Ie2452f52d755ade2909107885dac774ff8678daa
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-02-06 17:23:19 +01:00
Tatiana Borisova f1f3f30331 Fix configuration error
- CMake Error: AUTOMOC for target tst_protobuf_optional_gen:
The "moc" executable
".../homebuild/qtbase/libexec/moc" does not exist.

Pick-to: 6.7
Change-Id: Ide8b48713406ddd995acb96ad83f3c830c1aa41d
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-02-06 13:59:08 +00:00
Tatiana Borisova 6b6143cb65 Rename options test to channeloptions
- Rename options test to channeloptions, since the test is testing
QQmlGrpcChannelOptions class.

Pick-to: 6.7
Change-Id: I5b1643dd346fd71e5cecaf417cbb65b3587210a2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-02-06 11:35:15 +01:00
Alexey Edelev ae2f1ed3d3 Fix the generation of the export macro
Consider the EXPORT_MACRO CMake argument of qt_add_<protobuf|grpc>
calls.

Add the support for the EXPORT_MACRO option extras to the
qt<protobuf|grpc>gen generators. The extras now allow setting:
 - export file name
 - boolean flag that indicates if export file needs to be generated

The EXPORT_MACRO option of the generators now has the following format:
   EXPORT_MACRO=<export_name>[:export_filename[:<true|false>]]

If export_filename is not set, then generators fall back to the previos
behavior and use the export_name as the export filename base, the file
will be generated unconditionally. If export_filename is set and the
follow boolean flag is not set or is set to false, generators skip the
generating of the export file.

[ChangeLog][Protobuf][qtprotobufgen] EXPORT_MACRO option now has the
following format:
    EXPORT_MACRO=<export_name>[:export_filename[:<true|false>]]
New option extras allow setting the generated export filename and
control if it should be generated at the generator run.
[ChangeLog][GRPC][qtgrpcgen] EXPORT_MACRO option now has the
following format:
    EXPORT_MACRO=<export_name>[:export_filename[:<true|false>]]
New option extras allow setting the generated export filename and
control if it should be generated at the generator run.

Pick-to: 6.7
Fixes: QTBUG-121854
Change-Id: Ifff6506ab363d18dc417f222e9929d7eba135d8a
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-06 06:59:48 +01:00
Tatiana Borisova d49d7df988 Add possibility to set the property QGrpcMetadata back to empty
- Add testcase for re-setting metadata property to value and back to
null for CallOptions and ChannelOptions

Pick-to: 6.7
Change-Id: I8762da40428c69cebea1c85ca8630d1099ea1be2
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-06 02:16:32 +01:00
Alexey Edelev c0fec0407c Consider the optional fields when comparing messages
Add the missing comparison of the optional fields to the message
operator ==(). The oneof field condition was invalid.

Pick-to: 6.7
Change-Id: I7d6ba076cb44329faa7bf3c3fbf07183cf9dba82
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-05 15:12:09 +01:00
Alexey Edelev 9b1e7f27a7 Fix the copying of the optional fields
Add the missing copying of the optional fields to the message data
structure.

Add the missing tests and reorganize the existing optional tests,
split serialization/deserialization and generic part.

Fixes: QTBUG-121862
Pick-to: 6.7
Change-Id: I73a97481185868ea61615b2c02bada8cb153a8c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-02-05 15:12:04 +01:00
Tatiana Borisova b2d1886b6d Delete setDefaultConfiguration call, since it doesn't exist
- Add ssl property creation that is depended on SSL support

Pick-to: 6.7
Change-Id: I67f66d2aae17f0303559497d5efe578adabc76fb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-02-02 16:58:28 +01:00
Alexey Edelev 3e541cd779 Avoid constructing redundant copies in gRPC calls
Constructing a copy of QJSValue for gRPC callbacks look redundant.
Remove it. Same applicable for the result.

Pick-to: 6.6 6.7
Change-Id: I3b5c81e8373ca85ccd66e65555305c9dba020a6c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2024-01-29 12:20:15 +01:00
Alexey Edelev b9519412ae Move all registration functionality to a separate unit
Move functionality related to the registration of the protobuf messages
to a separate header/source files.

Task-number: QTBUG-120931
Change-Id: I6076b41139d43982148e46f5f315808509c4db65
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-26 20:51:01 +01:00
Alexey Edelev ad3960ae39 Remove the redundant include of QtQml/qqmlengine.h
The include is not used in the generated code.

Pick-to: 6.6 6.7
Change-Id: I94c9649d7f9130b796b44de578b32ae4acd3655e
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-26 20:51:01 +01:00
Alexey Edelev 280a255534 Remove the redundant template arguments from QAbstractGrpcClient
Now we may get the property ordering information from QProtobufMessage
without the need of knowing the exact type of inherited message.
This allows us to remove template arguments from
QAbstractGrpcClient::call and QAbstractGrpcClient::startStream
methods.

Task-number: QTBUG-120931
Change-Id: I497b80f53f5680790211b71a53a9ddc75d113424
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-24 17:36:49 +01:00
Alexey Edelev d737f7a5fc Remove the Q_DECLARE_PROTOBUF_SERIALIZERS macro
Now when we store the pointer to the property ordering in each
QProtobufMessage instance, we may remove generating of redundant
(de)serialize functions from messages.

This adds the generic QProtobufMessage::serialize and
QProtobufMessage::deserialize methods. Also we don't need the
template serialize/deserilze methods in QAbstractProtobufSerializer
since ordering information can be retrieved from the protobuf message
base class.

[ChangeLog][Protobuf][QProtobufMessage] Added the serialize and
deserialize methods.
[ChangeLog][Protobuf][QAbstractProtobufSerializer] The serialize
and deserialize methods are now non-template.
[ChangeLog][Protobuf] The Q_DECLARE_PROTOBUF_SERIALIZERS macro
is removed from the API and is not generated anymore.

Task-number: QTBUG-120931
Change-Id: I8ba8e6bb83728e58f781f42520629e1a9be4f026
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-24 17:36:40 +01:00
Tatiana Borisova e17d28e0d0 qRegisterProtobufTypes() should be called for applications implicitly
- Delete manual qRegisterProtobufTypes() call in QML auto-tests
- Add auto-generation line into qtprotobufgen
*_protobuftyperegistrations.cpp file. Now registration is happening via
static variable.

Pick-to: 6.7 6.6
Task-number: QTBUG-117643
Change-Id: Ic9c7e299fd2cd157ff4f2705d34bc4606a83ddbe
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-24 11:40:14 +01:00
Alexey Edelev 44de19c496 Rename the tst_grpc_unattached_channel to tst_qgrpchttp2channel
The tests is testing QGrpcHttp2Channel functionality. Let's move
it from client tests and rename.

Pick-to: 6.7
Change-Id: Ie21570689ca461e3661db61c0b6d3bf58dce02a1
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-22 06:42:59 +01:00
Alexey Edelev e729e07b67 Rename Any::as to Any::unpack
Change-Id: Ife4c7bf111f494865ceb5df271cdca0e31dd9bed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-19 16:52:26 +01:00
Alexey Edelev 39d27ad73d Add the QProtobufMessage::propertyOrdering method
The method allows accessing the protobuf message property ordering from
the base class.

[ChangeLog][Protobuf][QProtobufMessage] Added the propertyOrdering
method.
[ChangeLog][Protobuf][QProtobufMessage] Added the ordering argument
to the QProtobufMessage constructor.

Task-number: QTBUG-120931
Change-Id: I6fbc664c59ae4ff1da6266ca9e12cef0800c7457
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-19 16:52:21 +01:00
Alexey Edelev de50547f8d Rename 'propertyOrdering' static member of protobuf messages to 'staticPropertyOrdering'
This frees the name for the respective getter function.

[ChangeLog][Protobuf] The 'propertyOrdering' static member is renamed
to 'staticPropertyOrdering'.

Task-number: QTBUG-120931
Change-Id: If5288ac58222529ef870f86dd09e58dce7287f10
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-19 16:52:18 +01:00
Alexey Edelev 52e9819100 Add the server run to tst_grpc_client_unarycall_qml
Make tst_grpc_client_unarycall_qml pass when the test call is finished
with the expected result, but not failed with no connection to server.

This adds the run of the test server int the
tst_grpc_client_unarycall_qml test.

Pick-to: 6.7
Change-Id: Id50dd962cf34325fe208eaa4b1e1147ba0487b22
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-19 08:24:52 +01:00
Tatiana Borisova 6036d99a44 Add 'protobuftyperegistrations.cpp' extension into tst_qtprotobufgen
All files generated by qtprotobuf plugin should be checked by the test
Also, added optional_protobuftyperegistrations.cpp file to expected_result for comparison

Pick-to: 6.6 6.7
Change-Id: I3fc34dd720b845ef870d4694e67133b5932e8838
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-18 16:10:57 +00:00
Tatiana Borisova c56e35275a Delete useless usage of qRegisterProtobufTypes() in auto-tests
It seems the only case when qRegisterProtobufTypes() should be called directly is registration in QML engine.

Pick-to: 6.6 6.7
Change-Id: Ifdd1875cfb10a328580ba4aa94e0af33b9886da5
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-17 10:35:52 +00:00
Alexey Edelev f15db878a1 Require the PROTOC_EXECUTABLE definition in tests
Require the PROTOC_EXECUTABLE definition when compiling
qtprotobufgen/qtgrpcgen tests.

Pick-to: 6.5 6.6 6.7
Change-Id: I5e207c8402dbccd5254d6a9687303e56ff7a4bbb
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-12 14:44:45 +01:00
Alexey Edelev 3089afad19 Attempt to find conformance_test_runner in PATH/CMAKE_PREFIX_PATH
Try to locate conformance_test_runner using the CMake find_programm
command when building the tst_protobuf_conformance manual test.

Pick-to: 6.6 6.7
Task-number: QTBUG-104064
Change-Id: I805d1a43ccd57b78aff1a94ff221e674175956f7
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-12 14:44:45 +01:00
Alexey Edelev bc424839f1 Refactor tst_grpc_client_no_channel test
Rename the test to tst_grpc_client_deadline. Use GrpcClientTestBase
as the test base. Add WithChannelDeadline channel to GrpcClientTestBase.

Pick-to: 6.6 6.7
Change-Id: I6125f68f40b26ba645a97721641123d01a5387b2
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-11 16:25:18 +01:00
Alexey Edelev 5189fddaed Refactor the way gRPC test are running
Add the ssl channels to tests. Run the test server with SSL channel
enabled by default.

Add the --latency option to the test server. Server now uses the value
provided by test runner instead of using the global definition.

Rename the test server-related targets, so the have grpc_ prefix now.
The previous name was too generic.

Adjust SSL tests and use GrpcClientTestBase with SslNoCredentials
channels.

Pick-to: 6.6 6.7
Task-number: QTBUG-119207
Change-Id: Ib5cf9d05db62f542f5fc9bf4de1d5af93e6864e0
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-11 14:29:05 +01:00
Tatiana Borisova 8244da10c0 Add experimental_allow_proto3_optional option into tst_qtprotobufgen
- During generation from command line --experimental_allow_proto3_optional
should be taken into account for versions: 3.12 <= protoc < 3.15

Change-Id: I88f73317c044b985b3f09e676b5bb78b92a37c32
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-01-10 14:42:09 +01:00
Alexey Edelev a026b8177e Avoid deleting oneof pointer if it points to oneof QVariant data
If oneof message field is already present, we return the pointer
to the QVariant internals in the QProtobufOneof::value method. In
this case deserializer accesses the message that is stored in the
oneof field directly. So if pointer received in the oneof field
setter matches the one that is stored in oneof field we should omit
the setter completely, especially the "delete" part since it will
attempt to free the QVariant stored data.

Amends e9c80d43f7

Pick-to: 6.6 6.7
Task-number: QTBUG-118996
Change-Id: I08a3fb0d52cdcd4ed2156b8e2c5e43244394005d
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-10 01:00:32 +01:00
Alexey Edelev cc8d5b012b Add the missing setup of the QProcess readChannel
It should be set to StandardError, since we expect the
'Server listening' log from stderr pipe.

Pick-to: 6.6 6.7
Task-number: QTBUG-119207
Change-Id: If4daadb1a2b4331550329054e7dcd69589e863db
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2024-01-09 12:44:42 +01:00
Alexey Edelev da41805373 Fix the missing registering of nested enums
If enum was not used as the owning message field, its registration
was skipped due to weak logic in the generator. Iterate over enums
but not rely on existing enum field when generating protobuf
registrations of nested enums.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-120432
Change-Id: Ieae54793d872f7500c584b4f241fc4c50fe82cc6
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-29 10:21:52 +01:00
Alexey Edelev 001bcf2f5a Use the QML_NAMED_ELEMENT for the gRPC client in QML context
Register QML gRPC clients using the service specific names, to allow
using multiple clients in a single QML stack. Clients now are
registered in QML context as <ServiceName>Client.

[ChangeLog][QtGRPC][QML] gRPC clients now are registered as
<ServiceName>Client in QML context.

Pick-to: 6.7
Change-Id: I03481df93813309ec586f01999acb6f2da90b347
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2023-12-25 14:35:37 +01:00
Alexey Edelev 2455821cac Rename GrpcQuick tests to match '.+grpc.+' pattern
Rename GrpcQuick tests directory to grpcquick to align the name with
the module name. Also rename test to match the test naming in the C++
module. This also make the test naming less generic.

Pick-to: 6.7
Change-Id: I57ee1a72022de96dffb7a2002cb4fdd56bc13697
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2023-12-25 14:35:23 +01:00
Alexey Edelev 55244a7d5f Fix typo in conformance test
Pick-to: 6.6 6.7
Change-Id: Ia3f02cb72ea974d0b11423e60de925641e30bd7a
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2023-12-20 19:54:35 +01:00
Tatiana Borisova abf70ef72f Add error handling to JSON enum deserialization
- Plus, add malformed JSON error handling to map, enum and repeated
auto-tests

Pick-to: 6.7
Change-Id: I0331474875427696b900ba6a6078b7b0467e839d
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2023-12-20 12:33:39 +01:00