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>
This is not a library. The tool should not recover here. Print the error
and exit the program.
Coverity-Id: 479436
Pick-to: 6.9 6.8
Change-Id: I97c24b325a037e19de17af9b246ba2bb2be76d78
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Restructure the limits check to be more compact by separating the
invariant from the variant. The latter is extracted into a constexpr
lambda check.
Fix the overflow by checking the ok flag and return a default
initialized T.
Coverity-Id: 479421
Change-Id: Ia50fcba5de1335c2a26478d10f89b2d9c5696c4b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This is the only logical solution for this code...
As a drive-by make asciiSpacing constexpr and adjust capitalization.
Change-Id: I2cda5006a9eec94b80701d71e5c4000c3c852bf3
Pick-to: 6.9 6.8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
When the string is entirely whitespace all characters except one gets
erased. Rather use size() to denote the end of the string.
Change-Id: I80bf92319d4725b9400e0f67e968e3cb8c27dd86
Pick-to: 6.9 6.8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Coverity noticed inefficiencies of unneeded copies. Fix this by using
std::filesystem for these operations.
Coverity-Id: 479416
Pick-to: 6.9 6.8
Change-Id: I44666f4ca791763c13152c4861e78a122b8cfc50
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Coverity rightfully complained about dead code in the char_data
method, as ... % alignof(char) will never be non zero.
Fix this by removing the superfluous check.
As a drive-by remove unused parameters - they can be added if needed.
Coverity-Id: 479414
Pick-to: 6.9 6.8
Change-Id: Ie3f2b14cbf3e18c76deae491c099ccf7ec8b7716
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The newer protobuf version uses string_views as the return value.
Wrap the respecitive API with constructing std::string and update
some of the util functions to accept std::string_view arguments
but not plain std::string.
Fixes: QTBUG-134885
Pick-to: 6.8 6.9
Change-Id: I8bc06c46167a8b1bc0dca36242249e672ffcccd3
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Sanitize proto includes to ensure the generated
<Module>ProtobufProperties.cmake is fully relocatable.
Drive-by, ensure that includes do not contain duplicates.
Task-number: QTBUG-130113
Change-Id: I64f56d497d412705f174a027f711b90ad7614abf
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Ensure we store values correct way.
Pick-to: 6.8 6.9
Change-Id: I89ec10e41969a001d34a73a0fdd77a661b7c9506
Reviewed-by: Alexandru Croitor <alexandru.croitor@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>
A QUIP 18[1] update sets git files, REUSE.toml and licenseRule.json
as infrastructure type files. They are licensed with:
LicenseRef-Qt-Commercial OR BSD-3-Clause
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.9 6.8
Change-Id: Ib3bbda05a9b150dc9f7da564cd3bdc2691a749cc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The previous approach was error-prone, as using TARGET_FILE_DIR
hard-coded the path to the build directory and ignored install locations
entirely.
Fix this by using a more reliable approach: embedding the certificate
strings directly into the application.
Pick-to: 6.9 6.9.0 6.8 6.8.3
Change-Id: Ifb883891fd55bb023e7f9828f9c422ea3e5d1c3e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Ensure that we received the connection SETTINGS from server before
sending the very first HEADER/DATA frame using the stream.
It's the expected flow for HTTP/2 communication, we are lucky that gRPC
servers accept us.
Drive-by change the way we handle the missing HTTP/2 connection. It's
the exceptional situation, when we failed to acquire the connection
using QHttp2Connection::createDirectConnection call, so make assertion
at this point.
Dive-by fix the "dead" Http2Handlers in m_activeHandlers, which were
eaten by "expired" pointer state(Users declined to keep QGrpcOperation
pointers alive).
Task-number: QTBUG-133254
Pick-to: 6.8 6.9 6.9.0
Change-Id: Icb19d12c54662a3b13e080da5cece5885fd767d9
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Use the vcpkg manifest to configure and build QtGRPC the example.
This allows to automate the dependency installation using vcpkg.
Pick-to: 6.9
Task-number: QTBUG-132738
Change-Id: I7ba9d5a2c1186d1a70f3dc3a39117d86f2269271
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use the vcpkg manifest to configure and build QtGRPC chat example.
This allows automating the dependency installation using vcpkg.
Pick-to: 6.9
Task-number: QTBUG-132738
Change-Id: Iafcb8e144d51f1af0d775869550f003c997d106a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use the vcpkg manifest to configure and build QtProtobuf sensors
example. This allows automating the dependency installation using
vcpkg.
Pick-to: 6.9
Task-number: QTBUG-132738
Change-Id: Icae7acf46d97d834a064d7663623757a7ec35742
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use the vcpkg manifest to configure and build QtGRPC Magic 8 Ball
example. This allows automating the dependency installation using
vcpkg.
Pick-to: 6.9
Task-number: QTBUG-132738
Change-Id: Idaf8ee948a0a304633e1fe9f63327391adec96d8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QHttp2 implementation will make this favor for us, in general the
header is not mandatory for communication with gRPC server, but can
be used by other members of the network communication. Anyway it's
not the level of the gRPC channel where the header should be defined.
Pick-to: 6.9.0 6.9 6.8 6.8.3
Change-Id: I73fe3c780bfa373a724255dd26accf37f8a8ff50
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
We should be clearer about what transportation is used and when.
Otherwise, our users are left in the dark.
Task-number: QTBUG-134273
Change-Id: Ice58e2cd496fad472761bdb9022f0fd3280c265c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
We should be clearer about what transportation is used and when.
Otherwise, our users are left in the dark.
Task-number: QTBUG-134273
Pick-to: 6.9 6.9.0 6.8 6.8.3
Change-Id: I6d1da9236447521a53b197808c55c89c49fbd4c2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
QLocalSocket supports abstract namespaces. Grpc also supports it. Simply
make it available through the 'unix-abstract' scheme.
Ref: https://grpc.github.io/grpc/core/md_doc_naming.html
Ref: https://doc.qt.io/qt-6/qlocalsocket.html#SocketOption-enum
[ChangeLog][GRPC][QGrpcHttp2Channel] Added abstract namespace support
for QLocalSocket communication through the "unix-abstract" scheme.
Fixes: QTBUG-134273
Change-Id: Iea2b608478e00504d7cdbdff735fcbfb618529d7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
The protocol does not require a user-agent, but it is recommended to
provide a structured user-agent string. This helps diagnose issues more
effectively in heterogeneous environments.
Ref: https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#user-agents
[ChangeLog][GRPC][QGrpcHttp2Channel] Added a structured user-agent
string to the request headers.
Task-number: QTBUG-133254
Change-Id: Ic312f2a3754108798bb7acc70e2d8bed4a891401
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
It doesn't make sense to use a view in this context. This would also be
more performant since it enables implicit sharing for the headers.
As a drive-by fix the Literals namespace usage to align what current
documentation says.
Pick-to: 6.9 6.9.0 6.8 6.8.3
Task-number: QTBUG-133254
Change-Id: I89be231de4b902d56d65d1729816681ce84ce90e
Reviewed-by: Alexey Edelev <alexey.edelev@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>
Reference gRPC channel does this, to disable the Nagle's algorithm
and reduce the latency for the small flow control frames like
WINDOW_UPDATE and PING.
TODO: We should probably allow to opt out this behavior using
QGrpcChannelOptions. See QTBUG-134428.
Task-number: QTBUG-134428
Task-number: QTBUG-133254
Pick-to: 6.8 6.8.3 6.9 6.9.0
Change-Id: I96efac97077c7e527198bae9ca00500629bd4800
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
This patch fixes Q_ASSERT comparison between unsigned
integer and integer types on Android x86 build by using
C++20 compare function.
Fixes: QTBUG-134439
Pick-to: 6.9 6.9.0 6.8
Change-Id: I89e9a7384aad0fe908f4dd12680d3bf4770e6915
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Remove deployment of the now static proto lib.
Amends 9437a1f2bd
Pick-to: 6.9
Change-Id: I5bdda6157842c665165ae9b14255778ce2ac0bc9
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
This patch adds HttpsScheme variable definition behind
same ssl config where it is used in the source. This
fixes compile error on developer build for Android.
Fixes: QTBUG-134309
Pick-to: 6.9 6.9.0
Change-Id: I4d4425baa63f33724aff14b144339fb171e741d7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
The deployment was incomplete. Fix it by:
* Building the dependent qtgrpc_chat_client_proto library as
a static library
* Add the server directory path for reading credentials universally
Amends: cb35d20adb.
Fixes: QTBUG-134266
Pick-to: 6.9.0 6.9 6.8.3 6.8
Change-Id: I0666c445fbce159436c5b084ffd77d4191e04213
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Remove \fn comments for QAbstractProtobufSerializer::(de)serializeObject().
These functions were dropped in 8ec55cb0cf.
Remove \fn for non-existent QProtobufRepeaterIterator constructor.
Remove unnecessary \fn commands from QAbstractProtobufSerializer, let QDoc
auto-tie the documentation instead.
Pick-to: 6.9 6.8
Task-number: QTBUG-134250
Change-Id: If49049a33a307a522b3275b114e879442432e4c4
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>