The variable is used unconditionally.
Amends c91d02c007
Pick-to: 6.10 6.9 6.8
Change-Id: I36910a7b40f16a5a13bf2839a2e6c27aec5e7b26
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
We store the host protoc and generator paths from crosscompiling
environment when building generator tests. The test is supposed to
run on target meanwhile, which surely will lead to an issue if
paths to the tools on target platform differ. This particulary happens
on windows arm64 machine when we copy the cross-compiled tests.
Pick-to: 6.10 6.9 6.8
Change-Id: I85971da1b429383cae0f842306629355fc5833c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
qmatrix4x4.h will lose its qquaternion.h include, so include
qquaternion.h explicitly in all files that mention 'QQuaternion',
unless, for a foo.cpp, the own foo.h has already included it.
Amends 6637773cbd.
Pick-to: 6.10 6.9 6.8
Change-Id: I114f58d1d443164eb419dab98623d06044419a81
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Decouples our public API from the implementation. This is also slightly
superior as potential duplicates will not be copied on function call.
Discovered during the 6.10 API review.
Pick-to: 6.10
Change-Id: I78bc123cf4db034ce12f62a5a4576c8e0d0d64f3
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The prefix was wrongly added to the parent directory but not to the
actual file name.
Amends d4e8ef8942
Fixes: QTBUG-137313
Pick-to: 6.8 6.9 6.10
Change-Id: I1e907e7be26048174899855efc6a9ed661a1e4d0
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
The existing benchmarks were not optimal: bidirectional streaming wasn’t
fully asynchronous, limiting channel performance. Introduce a
`BenchmarkData` type to collect detailed metrics and print richer
results at the end. Also add latency measurements for unary READ and
WRITE operations.
As a drive-by add cxx20 checks in cmake.
Pick-to: 6.9 6.8
Change-Id: I56d61e4712b7fe9e5b8b52a14f84b0583094e373
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Currently we only provide `setMetadata(~)` as a way for users to
supply their metadata. However, certain code paths would benefit from
having an `add` functionality as well, without requiring the user to
create a temporary object.
[ChangeLog][GRPC][QGrpc*Options] Added support for incrementally adding
metadata via `addMetadata()`.
Change-Id: Ibc5d721850745df5f171b9126b595ca9c6b0c319
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Even though gRPC provides some leeway, as "Access to metadata is
language dependent", we have yet to see an implementation which doesn't
support multiple values per key.
Common implementations like grpc-c++, grpc-go or grpc-java provide this
and we should do it aswell.
Ref: https://grpc.io/docs/what-is-grpc/core-concepts/#metadata
Ref: https://github.com/grpc/grpc-go/blob/master/Documentation/grpc-metadata.md#constructing-metadata
Use a base class to implement common functionality for the options
classes. Also use a new common class in the tests.
The QMultiHash overload is selected when the 'QtGrpc::MultiValue'
argument is used in 'metadata' calls. We update the documentation
accordingly.
Deprecation is scheduled for Qt 6.13
Users with a custom Qt build - those who care - should be rewarded with
minimal traces of this "accident" and should not suffer from potential
performance/storage overhead. Therefore we deprecate QtGrpc::MultiValue
for those builds, effectively providing Qt 7 behavior.
[ChangeLog][Deprecation Notice]
Deprecate the metadata()/setMetadata() methods on QGrpcCallOptions and
QGrpcChannelOptions that use QHash in favor of the new overloads that
use QMultiHash. This is more in line with the gRPC specification.
Fixes: QTBUG-136471
Change-Id: I58d14d2c304c06de269c99ba5383beee86d12f77
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It was missing for the grpc reference client. It's used in both clients
so simply add it to the shared header
Pick-to: 6.8 6.9
Change-Id: I568aa92f50c7b4c7a94d0226a7d4e4672863fac8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The functionality is desirable by some users, we re-enable it.
New API addresses the core issue that is partially related to
QTBUG-119912, but has wider concequences in blind use in user
projects. We add the 'mut' prefix to all mutable getters to make
the mutable access explicit. Overload approach leads to unwanted
detaches not only whe is used be moc-generated code, but also
in user projects if developers do not pay enough attention to
const modifiers of their variables/references. We declined to
restore it, dispite it was the better looking API, in favor to
the code safety.
This also reveals the code clashing scenario, when the overload
might happen if the message has both 'a' and 'mutA' fields in
its definition. This scenario is kindly forbidden by our generator,
and sanitized at very early stages. We expect that it won't happen
in user projects, but even if it will, the solution is to rename
the field when generating Qt code. The serialization/deserialization
do not depend on field naming directly. json_name attribute also
will help to workaround this.
The undocumented ALLOW_MUTABLE_GETTER_CONFLICTS option allows clashing
the mutable getter names, but its usage currently limited by our
internal code only. The reason unfixed QTBUG-119912 issue in moc.
Once the issue is fixed, the moc version check should get the proper
version, but not '99' as for now and the ALLOW_MUTABLE_GETTER_CONFLICTS
will become public.
Another design solution is the use of overloaded functions that
return pointers, like it's done it the reference protobuf. But this
kind of API leaves the pointer ownership undefined and decided to
not be used.
[ChangeLog][Protobuf] The generated messages now have the mutable
getters for the fiels of the message type. The getters have 'mut'
prefix and implicily allocate the respective fields if needed, so the
use of intermediate message objects is not required.
Task-number: QTBUG-119913
Change-Id: I09b9ee37e1fbbe37b9c3cb501e92442da8ad3e4b
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
gRPC doesn't provide the smart tool lookup when crosscompiling.
So gRPC lookup is unable to find the grpc_cpp_plugin plugin when
crosscompiling examples. Use find_program to find the plugin in
host paths.
Pick-to: 6.8 6.9
Fixes: QTBUG-134647
Change-Id: I961b180b348dee4f1b2f2523be225d3003847e4c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
The test was faulty positive because of invalid command line.
The input file name was missing there, so protoc was failing to
generate code, but didn't test the actual invalid EXPORT_MACRO name.
Pick-to: 6.8 6.9
Change-Id: Ib57235fb22c740dc30aec58076833c8f6de4a250
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
* grpc async client now properly drains the completion queue upon
finishing
* server and clients now use the 'transport' option for setting up the
communication. The server now supports multiple listening addresses.
* Fix a "off by one" mismatch for the client RPC calls
Task-number: QTBUG-133254
Pick-to: 6.9 6.8
Change-Id: Iccbec72f77adb374f144c7cc1b9a8072fef00b5e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
find_package with NAMES argument forces the CONFIG mode look up.
We accidentally looked for Protobuf uppercase in MODULE mode in
configure.cmake which allowed Protobuf targets be found for tests
and tools. Make this double lookup procedure explicit. All efforts
to support ubuntu/debian platforms, that decline to deliver protobuf
Config files.
Drive-by, use the correct variable to check that Protobuf is found
in golang grpc test server.
Pick-to: 6.9
Change-Id: I50d17aec72540a472bff30782d83e4555c51604a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
- add rvalue tests for message types, repeated and map types, oneof,
other non-trivially copyable types(QString QByteArray and QDatetime)
Note, skipping optional, since it is already implemented in
void QtProtobufOptionalTest::move().
Task-number: QTBUG-128388
Change-Id: If36d05de659181c547a836aeb84d5f9da38709bd
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
As it's defined as [[nodiscard]].
Pick-to: 6.8 6.9
Change-Id: I849922ed7bd64a4f67e6da0e11b1d6b4ad38deb7
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
We should aim to have the attributions as close as possible to the
actual sources. The old 'combined' attribution also did mix up the
in-source copy of some protobuf files, compared to the dependency
that is provided by provisioning.
This also fixes an issue in our documentation infrastructure, where
we remove tests/ directory before building the Qt Framework
attributions. This generated a warning so far:
File ./qtgrpc/qt_attribution.json: Directory '/home/vagrant/qt-everywhere-src-6.8.1/qtgrpc/tests/auto/protobuf/conformance/data' does not exist.
Pick-to: 6.8 6.9
Change-Id: I26c8483737ab6a6e863b3ee4a683c77cb9af5c0a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Use shorter protobuf registration file name.
Rename '_protobuftyperegistrations' suffix to '_qtprotoreg'. It helps
to bypass windows long path issues.
Pick-to: 6.8 6.9
Change-Id: Ide40ad2942135c08a06097269ef2f2a4718b1e09
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Consider that some well-known repeated types should be encoded as
atomic JSON types in array too.
Task-number: QTBUG-120214
Pick-to: 6.8 6.9
Change-Id: I57d98bb8584183f98882db64ab5612315887397d
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Consider that well-known repeated Value types may be encoded as
atomic JSON types in array too.
Task-number: QTBUG-120214
Pick-to: 6.8 6.9
Change-Id: I9fa332571728089788ed5acc5f0b62fc9ec6f306
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Add the support for the optional deserializers of the well-known
Value types.
Generalize the approach so Timestamp, Duration, and BoolValue have
the common implementation.
Task-number: QTBUG-120214
Pick-to: 6.8 6.9
Change-Id: I0e835e6f0be3e45b525b310e2fb38dfec60911f3
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Validate the integer values that are packed to string when
deserializing numbers from JSON.
Task-number: QTBUG-120214
Pick-to: 6.8 6.9
Change-Id: I6324caa0e3c75cb96c89a523db478229d59958fe
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Add custom JSON serializer for google.protobuf.Duration.
The serializer should serializer the number to the following
format: '<seconds>.<nanos>s' by default. Deserializer meanwhile
supports both object and short string JSON representations.
Add the respective tests.
As driven-by change replace qWarning with the proper QtProtobuf
module specific qProtoWarning in the
(de)serializeProtobufWellKnownTimestamp functions.
Task-number: QTBUG-120214
Pick-to: 6.8 6.9
Change-Id: I328c647a2e1de53d6ee9d94e655f953b53aef03f
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The qt_autogen_tools_initial_setup was called with the wrong target.
Pick-to: 6.8 6.9
Change-Id: Ied10a04745a75d5894fc8f04243e75f04c0c8390
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Added support for encoding google::protobuf::Timestamp in the [RFC 3339]
format in JSON. The Timestamp message has seconds and nanos fields
which were serialized as is previously. After the fix, the Timestamp is
serialized in a "field-name":"2024-11-14T06:20:11.530Z" format in JSON.
Pick-to: 6.8 6.9
Fixes: QTBUG-130555
Change-Id: I7372e541faccdb7dec9083e36b673013a9a4ce5e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
When using the nested Qt types from either QtCore or QtGui packages
protobuf generator doesn't consider these types when generating the
includes.
Fixes: QTBUG-132182
Pick-to: 6.8 6.9
Change-Id: I6f0de0119ff9f8fd8109dd621a0d20f5dca31003
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Protoc disallows using the <field name>Entry if the respective
<field name> map field is defined. But meanwhile it allows using
<field name>_Entry as the field name, which ends up as
<field name>Entry in the generated code. The difference is in the
letter case is used for the alias we add for map entries and the
actual field name.
As the conclusion - test passes, but we should keep it in our test
suite to ensure we compliant with the protoc rules.
Pick-to: 6.8 6.9
Change-Id: I8a8d6796b6c5564b211bd11fdd23102b0031031e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
The channel options test should not check the SSL configuration when
SSL has not been configured
Fixes: QTBUG-131134
Pick-to: 6.8
Change-Id: I6356d0e7b9330a6b5d6830da93d4bb0958f6dcf7
Reviewed-by: Jaime Resano <Jaime.RESANO-AISA@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
These modules are not relevant anymore. After porting Qt::Grpc
relied on native gRPC implementation. But since we migrated to the
fully functional Qt HTTP/2 the need of reference gRPC and protobuf
gone.
Remove the WrapgRPC and WrapProtobuf modules, use the protobuf
gRPC modules directly in tests examples and tools. Since non of
those never add the build-time depdendcy on reference libraries,
we don't need to add the respective dependencies in Qt packages.
The only thing we still wrap is protoc. We either look for executable
but we never propagate it as the reference target, but utilize the
path from there.
Fixes: QTBUG-128809
Change-Id: Id5008f8dd935288cbaa8a9abb88d485824099d46
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Move the common logic of two tests to the base class. Adjust the
implementation of the qtgrpcgen test to the recent changes in
the qtprotobufgen test.
Pick-to: 6.8
Task-number: QTBUG-128753
Change-Id: I946cd132c6850ce56d8c3217169bb5c4e335e969
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
MacOS provisioning is fixed long time ago. Remove leftovers from
tests.
Pick-to: 6.8
Taks-number: QTBUG-109130
Change-Id: I4565ffecfd49ac7f6c56045027a6f564d0547e3e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Add the protocplugintestcommon static library that contains a common
code for both tests.
Reuse the library in tests instead of code duplication.
Pick-to: 6.8
Task-number: QTBUG-128753
Change-Id: Ib56861462635d6a0fff0f1add9b2cd7765316e09
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add the missing tests for the HEADER_GUARD. The test was not
provided by functional change, since it required the refactoring
in qtprotobufgen test kit.
Change-Id: I1e14ba29c61adb80d5af3775c7c729f1ab508448
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Use the common .proto scheme for all testcases, that defined lot of
message variants, so we can see how changes in generator affect
various types but not only restricted subset.
Rearrange the test cases according to the generator options.
Change the verification process for command line tests. Consider not
only some files but all generated files, so we can see if some new
file is added or some files are remove/renamed.
Simplify tests.
Add the COPY_TEST_RESULTS environment variable support. This variable
now allows copying test results to the source directory. The introduced
functionality is very handy when need update expected results after the
major changes in generator.
Add the respective feature guards for the QProcess usage. In case if
the feature is disabled in QtCore.
Pick-to: 6.8
Task-number: QTBUG-128753
Change-Id: I5ac33684c8cf4fd5dd133b404061db4435a87344
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>