Commit Graph

1477 Commits

Author SHA1 Message Date
Dennis Oberst 1800de75c3 QGrpcStatus: polish documentation
To conform with the style used in other docs in Qt GRPC.

Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: Icfc62bf0c5f3a739262fafebb539a63344380f5c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:13:15 +01:00
Dennis Oberst 150100f3f9 QGrpcClientBase: rework documentation
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I14d5a88e67bca2461598331b5d3255d0bd902894
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:13:12 +01:00
Dennis Oberst db9ca6f955 qgrpcstream: rework documentation
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I3daedf68d7c0200de327adaabbbf22d1db9d7f0b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:13:09 +01:00
Dennis Oberst cccade80c1 QGrpcCallReply: rework documentation
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I373c39f99ee7ed00ebd9a84c29876d9131790a52
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:13:05 +01:00
Dennis Oberst 95b5e52f3f QGrpcOperation: rework documentation
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: Iaa74617fa808dadb3c4427303c58d4bd8ce9b51c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:13:02 +01:00
Dennis Oberst 93284dd9fb QGrpcChannelOptions: rework documentation
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I7662e374aa9e0514fa1238f8cc8909f3ede76317
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:12:58 +01:00
Dennis Oberst 58ea8af944 QGrpcCallOptions: rework documentation
This patch also adds qtgrpc-shared.qdoc - a place to shared common
documentation snippets.

Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I31e7cd3a254f91df19c0e7b5df4cdfac770c4388
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:12:53 +01:00
Dennis Oberst dedd3edd3f Add the clientguide example
It contains in depth documentation to get started with Qt GRPC
and replaces the 'Client Methods of the Qt GRPC Service' guide.

This will enable users to also run the code, experiment with it and
show us the error directly in case they fail to compile.

Task-number: QTBUG-125406
Fixes: QTBUG-129588
Pick-to: 6.9 6.8
Change-Id: I8f16156a13da1683bce0e31001ee6b2ff57b1824
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 15:12:50 +01:00
Dennis Oberst 298f6666fa Docs: improve qtgrpc index page
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I0873879e4014eb6aa455c6bc1bb107cc000eb56d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-12-17 11:08:04 +01:00
Dennis Oberst 6ab4321ccc Docs: create and distribute the \gRPC macro for adding trademarks
It will add the 'tm' logo to the first occurrence in the document. We
still add it to any mention of it since this will protect against
copy-paste issues when borrowing chunks of the documentation.

Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: I099633bcda78a1940c65c379328539190833d6f9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 11:08:01 +01:00
Dennis Oberst 2123274862 Docs: simplify qt-add-grpc-example.cmake
This is one of the first introductions in how to use the cmake api. Try
to start teaching the most simplest way: reusing the application target.

Pick-to: 6.9 6.8
Change-Id: I94c070bde4dec5adf33f4f244cad0ed105c4d510
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 11:07:58 +01:00
Dennis Oberst ec8afcaca5 Docs: enforce zero warning policy
Task-number: QTBUG-125406
Pick-to: 6.9 6.8
Change-Id: Iefd0140f24ec9be66ff3655f8817ffa02ccd8dc3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-17 11:07:55 +01:00
Alexey Edelev bb0eb679b7 Collect the .proto files in the related targets
Collect .proto files in the targets that use them in generating process.

Pick-to: 6.8 6.9
Change-Id: Iaeb6f520051fabe7b188e4f758671ca0bdaa3645
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-12-16 12:12:51 +01:00
Alexey Edelev f78028cea3 Protobuf: Add JSON deserializer benchmark
Add the benchmark of the JSON deserialzer. Re use the common
functionality in both JSON and protobuf deserializer benchmarks.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I34befe253d076793228f660b24a9983af0fbc780
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:35 +01:00
Alexey Edelev 0ef57fd3ad Deduplicate preserveUnknownFields variable
Remove the duplicated preserveUnknownFields variable in
QProtobufSerializerImpl, use the parent pointer to acquire its
value instead.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I8c81e5ea6565f056756703d5ca989b67d163dd19
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:31 +01:00
Alexey Edelev 4018090d1e Avoid looking for scalar type deserializer twice
When looking for non-packed deserializer we may make the lookup only
once, since we may predict the non-packed field from the wire type.
If it differs from the Length Delimited type and the field is Repeated
according to the stored meta info, we may conclude that the received
data is non-packed and use the corresponding deserializer.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I3ead7e8b64cda26179c7b5fc9917737b41e22882
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:28 +01:00
Alexey Edelev 0e63212ddc Avoid potential runtime stack allocation of variable in deserializeBasic
Make 'size' static constexpr. It can be calculated compile time and
stored the binary data.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I39abf998d2fdc825b6ffd0c0783ee9321dc338db
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:24 +01:00
Alexey Edelev 9bd150899f Simplify deserializeBasic for signed varints
Squash the redundant variable definitions.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I4c107896a6d57cf7df418b2bd0b19cb1ce4b965d
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:22 +01:00
Alexey Edelev 17c85b1a29 Replace std::optional::value with std::optional::operator *
'value' excepts, 'operator *' usage is preferable.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I4297e6566b147f527cc5233f5bc4ac285e36fdef
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:18 +01:00
Alexey Edelev dd77a03b0f Deduplicate the iterator increasing in deserializeVarintCommon
We may move the iterator forward right in condition. When checking
for the end of varint mask.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: Ib0893a80c29752176e9e300e05cd5ea007a58e0f
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:13 +01:00
Alexey Edelev d575f3e07b Reuse the serializedList variable in serializeListType
We may reuse the variable instead of instantiating the empty
QByteArray.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I4c0b92926af6904f5003f3511f6dcf0e89c1e42f
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:10 +01:00
Alexey Edelev dcaf650f2f Remove the useless variable initialization when serializing zigzag int
The uValue variable can be intialized by real value in place. It's zero
initialization is pointless.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I515f2f7e35c092b87c140ff95df8e4ee3a92d03a
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:07 +01:00
Alexey Edelev bbdb324316 Pass the argument of serializeVarintCommon by value
All types that the function accepts, are unsigned ints.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I3e9d07eaa6e5476a32ad889b6c8f51a3430e5a52
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:04 +01:00
Alexey Edelev e2ef159b2e Make serializeVarintCommon SCARY
Move the part that doesn't depend on template arugment to a
serializeVarintCommonImpl function. Also it makes sense to make it
out of line.

Use the impl function but not the template one when serializing
the size of length delimited fields. We trust out selves that this
type is compatible with serializeVarintCommon.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: Ifcda7ebf7b2dee209c258d64724908022cf66de9
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:01:00 +01:00
Alexey Edelev a938e362c8 Use the if_json_floating_point as isPresent trait
Compile time checks unification.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I869f13e4a8770c60d605649d8304898449ab1d69
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 12:00:56 +01:00
Alexey Edelev ff1431771f Tune the WrapProtoc lookup
Add the upper and lower case protobuf package names explicitly and keep
the protobuf package lower case for the variables consistency.

Pick-to: 6.9
Change-Id: Id8acf1d986e0274f99587d554e5dc5308f15a31d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-12-16 12:00:46 +01:00
Alexey Edelev d288a077f5 Add the missing autotools setup for protobuf_invalid-identifier
Pick-to: 6.8 6.9
Change-Id: I51e9ed9a80d817184f2ef52c72974292b745b5c1
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 10:40:42 +01:00
Alexey Edelev fdbbe0b349 Make QProtobufJsonSerializerPrivate ctor out-of-line
Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: I8b1755108781510cc770e0e7b5ba6a6a4d0e3a15
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:59 +01:00
Alexey Edelev 6a1012792c Move the scalar protobuf type serializer to a seprate TU
Move the scalar type serializers to a separated translation units. This
make code more readable. Adjust constraints to follow common project
coding standards and make constrains compilation faster. Make complex
functions out-of-line to avoid unwanted binary expansion.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: Ib5311f392e32e5f31416448d2f306ae91155f873
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:54 +01:00
Alexey Edelev 3df9d285da Generalize deserializer in protobuf and JSON serializers
Move the generic logic of serializer to a separate class and
use this class to implement the protobuf and JSON deserialization.

This also fixed one of the conformance usecases since related
to invalid enum handling.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Fixes: QTBUG-112423
Fixes: QTBUG-112425
Fixes: QTBUG-112424
Change-Id: I400303a8666df90050a54bd7036daa0107adcce5
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:48 +01:00
Alexey Edelev 27b618fcc4 Generalize serialization in protobuf and JSON serializers
Move the generic logic of serializer to a separate class and
use this class to implement the protobuf and JSON serialization.

This also fixed one of the conformance usecases since related
to invalid enum handling.

Pick-to: 6.8 6.9
Task-number: QTBUG-128812
Change-Id: Ie78da9103e68e7701b36f7d4e4c8e83f38d3c5c2
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:44 +01:00
Alexey Edelev 76684a5ae7 Make deserialization benchmark more complicated
Use more complicated data structure when benchmarking the protobuf
deserialzer. This allows also to identify changes that have
performance impact onto the deserialization.

Pick-to: 6.8 6.9
Change-Id: Ibf3a312c18edb86d383d5e236f3dad47e8581532
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:40 +01:00
Alexey Edelev b614b9dc26 Document the QT_USE_PROTOBUF_LIST_ALIASES cmake property
Add documentation for the QT_USE_PROTOBUF_LIST_ALIASES cmake property.
The property controls the \c QT_USE_PROTOBUF_LIST_ALIASES definition,
which enables/disables the type aliases for the QLists of protobuf
messages.

Task-number: QTBUG-129652
Pick-to: 6.9
Change-Id: Ib4feb4e641386f0bfce61ab9ed06709c019ab1f0
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:37 +01:00
Alexey Edelev 4b778a70d0 Avoid generating QList aliases for the protobuf messages
Generating the aliases for protobuf QList types leads to the name
clashing when users want ot introduce messages that have name
consisting of previously defined message name and Repeated suffix,
e.g.:
  message MyMessage {
  }
  message MyMessageRepeated {
  }

We shouldn't prohibit the above scheme in our generators and generate
the respective messages correctly. The only possible solution -
complete removal of the protobuf messages QList aliases.

Generator still generates the aliases guarded by the
QT_USE_PROTOBUF_LIST_ALIASES macro. The macro is enabled by
Qt::Protobuf when building using CMake, but can be disabled at any
time by setting QT_USE_PROTOBUF_LIST_ALIASES property on protobuf
target to avoid name clashing.

[ChangeLog][Protobuf] qtprotobufgen doesn't generate protobuf message
QList aliases. All usages of aliases should be replace by respective
QList types. Aliases are still generated and are guarded by the
QT_USE_PROTOBUF_LIST_ALIASES macro in the generated code. The macro
is enabled by default and can be disabled using
QT_USE_PROTOBUF_LIST_ALIASES target property.

Fixes: QTBUG-129652
Pick-to: 6.8 6.9
Change-Id: I026755b36985eef01a6851156d9c9cfff141d247
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-16 09:57:33 +01:00
Qt Submodule Update Bot b669d73025 Update dependencies on 'dev' in qt/qtgrpc
Change-Id: I92002246f45b65f69fc1f04c987f7c1f54954cc4
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-12-08 17:02:27 +00:00
Qt Submodule Update Bot 59157d01d8 Update dependencies on 'dev' in qt/qtgrpc
Change-Id: Id8a224d255d0904053502e658a43c97a8c88e6cf
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-12-08 03:30:12 +00:00
Dennis Oberst 4410e9c7a9 Docs: Add missing doc for HEADER_GUARD option
Amends f3125dd7a3.

Task-number: QTBUG-125406
Change-Id: Id0000d8a0d1481334cd7c24df504c269dd0d046a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-06 18:14:35 +01:00
Dennis Oberst 995012aa82 qtprotobufgen: add QVariant operator for value-type messages
Value type classes in Qt usually contain an implicit QVariant opeartor.
Add it to comply with idiomatic Qt patterns.

Task-number: QTBUG-129161
Change-Id: Ib9ccd0cdfa7d6d6c2440323d1cc9b6088ea554c6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-06 18:14:16 +01:00
Dennis Oberst 4a3fc66b89 generator: handle invalid identifier(s) in filename
The generation was broken for proto filenames, which where
invalid identifier, since the filename is used at several places in the
generation process.

This became evident for the protobuftyperegistrations and traditional
filename header guards.

Solve this by transforming the basename into a valid identifier.
Also add a testcase on the highest point of abstraction for the
generators (qtgrpcgen).

Fixes: QTBUG-131417
Pick-to: 6.8
Change-Id: I492907881913f8b43ebf365a9e1fe38062113c3c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-06 18:13:44 +01:00
Dennis Oberst aa70a1099c gitignore: add qmlls.ini files
These files are autogenerated in the source directory when enabling
QT_QML_GENERATE_QMLLS_INI

Pick-to: 6.8.1 6.8
Change-Id: Iaa136e91b9a7d9c4d4ed881285a35967881153f5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-12-06 14:02:16 +01:00
Ulf Hermann 2da5a76d45 Use the upper-case Protobuf module name also in configure.cmake
Amends commit b6f0fdc89a

Change-Id: I20435b5cf2afd334fb31200e180dd34f4f303110
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-12-06 11:32:42 +01:00
Alexey Edelev b6f0fdc89a Use the upper-case Protobuf module name when looking it
This will work around the issue in debian-like platforms, where
relatively new protobuf doesn't deliver the proper config files.

The lookup still prefers looking for the config files, but not
the deprecated CMake module.

Change-Id: Ie1d5217e9023022976dd058be9dd7fd1ce37e39f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-12-03 16:18:57 +01:00
Qt Submodule Update Bot bfd24967bc Update dependencies on 'dev' in qt/qtgrpc
Change-Id: Ib91330abf1264a66b253050e4e8314e081b7e29e
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-12-03 13:50:03 +00:00
Qt Submodule Update Bot f3edd0dd0a Update dependencies on 'dev' in qt/qtgrpc
Change-Id: Id8ff39787398a6df97b5cdaec07e059f88633473
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-12-02 13:50:39 +00:00
Jaime Resano 524ba1e4d0 Rework vehicle example
Improve QML UI, simplify server logic, add documentation

Task-number: QTBUG-129571
Task-number: QTBUG-128468
Pick-to: 6.8
Change-Id: I46d04a033a7301b9c98a3e03861b9212e7a2378d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jaime Resano <Jaime.RESANO-AISA@qt.io>
2024-11-29 13:53:37 +01:00
Qt Submodule Update Bot 5242c14faf Update dependencies on 'dev' in qt/qtgrpc
Change-Id: Id9ca1d18debbadb68876f3c03cf885482b7cc8c5
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-11-28 12:18:15 +00:00
Ulf Hermann 0707390862 Revert "Disable QML Protobuf tests in Android"
This reverts commit 3d6c2827a0.

Disabling the tests was a temporary measure taken to buy us time to fix
the underlying issues. Since commit
80c6d3c08b593471f3279f45c54fdd85222072eb in qtdeclarative the particular
code exercised by these tests is fixed. Therefore, we can re-enable
them.

Pick-to: 6.8
Task-number: QTBUG-127174
Change-Id: I304dc0318be50cdf2fded34bd33d9e3ba568089c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-11-27 20:14:23 +01:00
Alexey Edelev 0f2c3c516e Add the missing initializer for the google::protobuf:Any field
Use the empty initialization for the google::protobuf:Any when it's
used as the oneof field.

Fixes: QTBUG-131415
Pick-to: 6.8
Change-Id: Ib2e9d9234b9cf90dce3c72b85001fa1b62a501e8
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-11-27 16:34:10 +01:00
Qt Submodule Update Bot 56a67f9c67 Update dependencies on 'dev' in qt/qtgrpc
Change-Id: I9f5e51aed786ea5ba88e1cb3ea27330ca3290ec4
Reviewed-by: Qt Submodule Update Bot <qt_submodule_update_bot@qt-project.org>
2024-11-26 15:29:16 +00:00
Alexey Edelev 2c6ea3fb35 Fix the testComplexField initializing in tst_repeated
Fix the invalid assignment of the string to an object. Assing
string values to the inner message field instead.

Pick-to: 6.8
Fixes: QTBUG-131577
Change-Id: I52dd735c0ffd3a00ac5f95f090c03b7ca3172081
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-11-26 11:36:25 +01:00