Generate separate from the QtProtobufFieldEnum enum for each Oneof field.
Use that enum in the Oneof field number getter.
Fix formatting in protobuf generator code.
Fixes: QTBUG-109126
Change-Id: Ib889a499b9abdc39ea7416cea008d157881a15fc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Use key-value range when interating over QHash.
Pick-to: 6.5
Change-Id: Ibb4e3aae170184bda1d8d1ec1e058eb8cf396ec4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This fixes the situation when we received the non-packed repeated field
from the wire, but the used protobuf schema specifies the field as
packed. This situation is possible if the protobuf schema mismatches on
on the wire ends. The explicit indication of this situation is the
wiretype mismatch. So if the wiretype differs of the expected one that
means we need to look for the handler with the 'packed' option opposite
to the one is expected by the actual protobuf schema.
Pick-to: 6.5
Change-Id: I57bf613410c4031f638533f092fd8d36c592db32
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The nullptr check is done in property serializer function, skipping
the map value of null before attempt to produce the map pair leads
to the missing map entry after serializing.
Pick-to: 6.5
Change-Id: I6d5e9884b8fda7a7e81cfd99e885564d41aea8ff
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Test for the recursive message support. Check that recurisve messages
can be compiled and serialized/deserialized correctly.
Change-Id: I34e8f60d6e64416a1665742b716356270f7ed085
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The actual protobuf serializer has multiple overheads and code
duplicaiton. Serialization functions use individual ways to
detect if field was initialized or not. This patch adds the
general functions that detect if field was initialized or not.
Also serializers previously juggled the protobuf field number to
conclude the need of field header. Now the header is added under
clear conditions.
For STRING and BYTES lists we should use the same way of
serializing/deserialing as for non-packed lists, since they are
non-packed lists.
Map elements should be serialized even if value is not initialized.
But non-initialized keys should still be present in serialization
stream. Avoid using serializeProperty when serializing the map key
and use integated type serilizers directly.
Pick-to: 6.5
Change-Id: I32b512acdaa9f355eea9c41f735bc9722bed0bba
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This addresses the recent warnings introduced by a change to QDoc:
qtprotobuftypes.h:234: (qdoc) warning: No documentation generated for
function 'qRegisterProtobufTypes' in global scope.
qprotobufserializer.h:319: (qdoc) warning: No documentation generated
for function 'qRegisterProtobufType' in global scope.
qprotobufserializer.h:333: (qdoc) warning: No documentation generated
for function 'qRegisterProtobufMapType' in global scope.
qprotobufserializer.h:361: (qdoc) warning: No documentation generated
for function 'qRegisterProtobufEnumType' in global scope.
Pick-to: 6.5
Change-Id: I694b4a524a31c477bb3e4b52ea89b0c4823c0430
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Use common serialization data for serialization and deserialization
of basic types.
Task-number: QTBUG-111070
Pick-to: 6.5
Change-Id: I2691e50d570a4a7b357f1e1eaea486f606b71bbe
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Refactor tst_protobuf_serialization_basictypes tests to use _data()
methods and extract common data to free functions.
Pick-to: 6.5
Change-Id: I5f42a4056e438501cc6c7bf93a0dc4097845f37c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The build system expects to find a .qhp file with the same base name
as the project .qdocconf file.
Change-Id: I1d60124efecd26282f198aa3cdb9d1c34b5ac7cd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Without it, the documentation for the alias does not appear
anywhere as a type alias must be associated with something
that generates an output page.
Pick-to: 6.5
Change-Id: I5485e31ea75ca6154767531b926e1fba84ba3cd8
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
There were a few iterations of trying to ensure that protobuf and grpc
tools are available when cross-building Qt itself, but do not fail
configuration of a cross-built Qt if the host tools are not present.
The latest iteration ensured that worked fine when it built Qt itself,
but it did not account for still finding tools when cross-building
user projects (iOS / Android).
That was meant to be done by calling qt_internal_add_tool() ->
qt_internal_find_tool(), but the latter exits early if the tool is
already found, which is the case for qtgrpc because it explicitly
looks for tools in the src/tools/host sub-project, and thus
qt_internal_append_known_modules_with_tools is never called and a
dependency on the Tools package is not written into the iOS version
of the Qt6ProtobufDependencies.cmake file.
Until qt_internal_find_tool() learns to deal with that, we can
register a dependency on the Tools package manually by using
qt_record_extra_qt_main_tools_package_dependency() similar to how we
do it in qtwayland.
We only register the dependency if we the tools are not being built in
the current build (which implies a cross-build and that the
tools are already found).
Amends 0ae19cc745
Amends 39f2a1e64a
Fixes: QTBUG-111983
Change-Id: I2c37b89fd960aa142b8c4a5f150ad2067501f78c
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 07db4d5599)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Handle MODULE_LIBRARY target type in the qt6_add_grpc() CMake method.
The same behavior exists in the qt6_add_protobuf() and it seems missing
int the GRPC counterpart.
It fixed calls to the method in the Android environment, for example
building GRPC examples.
Pick-to: 6.5 6.5.0
Change-Id: I947587f8942dcfcced62029e39b3385e842d7933
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Add protobufgen output files to the grpcgen test for auto checking
them up to date
Pick-to: 6.5
Change-Id: Ia7c3fcedfc9b3a4f0e66e748db8d5d818b4fb069
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Instead of the output parameter, use the return parameter
to return shared pointer to the started stream.
Remove the mechanism for reusing already started streams,
which is not specified by gRPC standard.
Removing it provides better isolation between individual
streams and simplifies the logic in the QAbstractGrpcClient.
Task-number: QTBUG-108833
Change-Id: I5c0aece8ff9c3774352c87309b1f9e7b7f62097b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Remove url.examples key from QtGRPC and QtProtobuf .qdocconf files,
because qtgrpc repository doesn't exist in code.qt.io/cgit/qt.
This patch can be reverted once the qtgrpc.git is available there.
Pick-to: 6.5 6.5.0
Change-Id: Ifa77a42373cd03c2faf6fc36e9b494e0af87a431
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
QtGRPC generated client classes are base of QAbstractGrpcClient,
thus users of those classes should have access to documentation.
Remove \internal commands from documentation in QAbstractGrpcClient.
Update formating of \fn command parameters.
Task-number: QTBUG-103235
Pick-to: 6.5 6.5.0
Change-Id: I6654a0f5d47e4e6a7341fff779fadc8517e93cec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Fix qdoc warnings with missing module header, for example QtGrpcDoc,
by removing moduleheader variable from the .qdocconf files.
Initially that was resolving issues when building documentation on macOS.
Fix the root cause of the problem by changing capitalization of the project
from QtGRPC, to QtGrpc (inspired by the QtNfc module).
Pick-to: 6.5
Change-Id: I3b9cc408235b191bbf1350a18bdd91ae45327e41
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
qRegisterProtobufTypes needs to be called explicitly if test never
uses methods that call qRegisterProtobufTypes implicitly.
Pick-to: 6.5
Change-Id: I98552ed6ca364a7620c69d4fdd3d84a635d318c0
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Enumerators are classified as 32-bit integers and should be supported
by oneof too.
Amends 2e3fdd5c05
Change-Id: I71a0d5d6aff4e6bd7a76952c2b4d2ffa1f1b9174
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
If TIFF format is available and the image is in floating point format,
then save the image as a TIFF. Otherwise, save the png.
Fixes: QTBUG-110897
Change-Id: Id4122dcc8f7555bd51607d2a4f21c798eac2cfc4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This reverts commit 272957831e.
Reason for revert: This can be re-enabled since we enabled PIC/PIE in provisioning.
Change-Id: I181ab2b258c0751f8379877584dac03772601240
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
QByteArray and QString have the LengthDelimited wiretype, but they
should not be handled as the repeated fields. Exclude them in
isRepeatedField check.
Amends 2e3fdd5c05
Change-Id: If683afe3d16fd7ce039e6c7443a76386e7a0fced
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Look for protoc as a program-only when crosscompiling. This avoids
exposing host protobuf libraries to CMake, when looking for host tools.
Pick-to: 6.5 6.5.0
Change-Id: I622a21d422989b4f00a399fad56f4832dc99c536
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
The example server uses the c++17 standard but doesn't require it in
CMake. Add the missing requirement.
Amends fdd1d0339f
Pick-to: 6.5
Change-Id: I84f10ec22198cb50a8f393036382021ad5bf39e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
If we were unable to read the unknown length-delimited field size we
need to invalidate the further deserializing procedure, since the buffer
is malformed.
Pick-to: 6.5 6.5.0
Change-Id: I6bbc3ed99b8390435aefbee15eefa3dc6a3a2ce9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
When accessing the message field using the private getter we do not
initialize the field. This will avoid serializing uninitialized messages
and unlock recursive message support.
Pick-to: 6.5 6.5.0
Change-Id: I84805952835f071284a55b4f049dfcbb0e27c129
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
All fixed-size fields should not be serialized to the wire if they
are uninitialized(the value is '0'-like).
Amends df8e7e1b8d
Pick-to: 6.5 6.5.0
Change-Id: Iba6b4f742e08ccd204233fcc1fd1cd04a5394032
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>