Commit Graph

417 Commits

Author SHA1 Message Date
Alexey Edelev ee3326e298 Use double lookup for protobuf/Protobuf packages
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>
2025-01-31 15:43:29 +01:00
Tatiana Borisova 81b59d1492 Add tests for rvalue setters in the generated code
- 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>
2025-01-30 17:38:22 +01:00
Dennis Oberst 3dfc6c66b2 grpc benchmarks: add ssl options and capabilities
Task-number: QTBUG-133254
Change-Id: I517d524e1d6c953791a11ba5351cdfd1b433cee2
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-01-30 11:29:04 +01:00
Alexey Edelev dfc3306e1a Check the return value of QFile::open calls
As it's defined as [[nodiscard]].

Pick-to: 6.8 6.9
Change-Id: I849922ed7bd64a4f67e6da0e11b1d6b4ad38deb7
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2025-01-29 17:30:52 +01:00
Kai Köhne a379d0c185 Doc: Split up protobuf attributions between tools and tests
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>
2025-01-28 17:33:28 +01:00
Alexey Edelev b8651f1b87 Shorten the protobuf registration file name
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>
2025-01-28 15:22:02 +01:00
Alexey Edelev c7b78a5cbd Support for custom JSON serializing of well-known repeated types
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>
2025-01-28 15:21:50 +01:00
Alexey Edelev c289974e2c Support for deserializing of well-known repeated Value types
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>
2025-01-28 15:21:47 +01:00
Alexey Edelev 79919ad77b Support deserializing the well-known Value types from atomic values
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>
2025-01-28 15:21:43 +01:00
Alexey Edelev 148145a1a3 Fail when attempting to deserialize malformed integer packed to string
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>
2025-01-28 15:21:36 +01:00
Alexey Edelev 3c2557c2c0 Add custom JSON serializer for google.protobuf.Duration
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>
2025-01-17 18:14:56 +01:00
Alexey Edelev 558130f2fc Add the missing qt_autogen_tools_initial_setup for the well-known type tests
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>
2025-01-16 22:45:59 +01:00
Thiago Macieira 226fff5db7 CMake: Add qt_autogen_tools_initial_setup calls
Add calls to qt_autogen_tools_initial_setup to avoid
'CMake Error: AUTOMOC for target' errors.

Pick-to: 6.9 6.8
Task-number: QTBUG-129918
Change-Id: I4ea262a93d778d0962fcfffd022536358eadf8a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-01-06 15:41:39 -03:00
Alexey Zerkin 4e8dddcb28 JSON serialization of google::protobuf::Timestamp well-known type
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>
2025-01-06 15:18:59 +01:00
Alexey Edelev 9966fdac34 Generate the missing includes for the nested Qt types
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>
2025-01-06 15:18:58 +01:00
Alexey Edelev c42df9cad0 Add the map name clashing syntax test
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>
2025-01-06 15:18:58 +01:00
Alexey Edelev e45334f4a0 Update the test certificate
The old one is expired.

Pick-to: 6.8 6.9
Change-Id: Ice0253383380ea522613a4eb781454dbf65e1464
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2025-01-06 12:34:58 +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 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 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 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
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
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
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
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
Jaime Resano c0599b3840 Fix channel options test when no SSL is configured
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>
2024-11-13 11:33:11 +01:00
Alexey Edelev fa7c4410e8 Remove WrapgRPC and WrapProtobuf modules
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>
2024-10-15 18:12:58 +02:00
Alexandru Croitor 383535496b CMake: Add qt_autogen_tools_initial_setup calls
Add calls to qt_autogen_tools_initial_setup to avoid
'CMake Error: AUTOMOC for target' errors.

Pick-to: 6.8
Fixes: QTBUG-129918
Change-Id: I4d120707b738edfdf37f89228434145b4b1ad75f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2024-10-15 08:24:49 +02:00
Alexey Edelev 032214e322 Complete qtprotobuf qtgprcgen tests refactoring
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>
2024-10-01 18:26:24 +02:00
Alexey Edelev fc773b35a1 Remove the outdated guard for protoc availability in tests
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>
2024-09-30 16:06:25 +02:00
Alexey Edelev 0ae6627df9 DRY qtgrpcgen and qtprotobufgen tests
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>
2024-09-30 16:06:20 +02:00
Alexey Edelev 3f283bd729 Add the qtgrpcgen tests for HEADER_GUARD option
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>
2024-09-30 16:06:13 +02:00
Alexey Edelev ce98c06105 Refactor the qtprotobufgen test
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>
2024-09-30 16:06:05 +02:00
Alexey Edelev 95104b6ac9 Use the correct string literals when serializing (-)Infinity and NaN
Protobuf required the special strings for (-)Infinity and NaN floating
point numbers. Use the valid letter case when serializing those.

Pick-to: 6.8
Change-Id: I45a9190aee8d407eca63fd1b352d041d5063e7ec
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-09-30 12:11:37 +02:00
Alexey Edelev a9bc44e092 Add the result metatype to QGrpcOperationContext
In certain usecases users might need to know the RPC result message
type. Currently we do not store it anywhere, so API users decide
how to deserialize message when calling QGrpcOperation::read method.

Add RCP methods overloads to QGrpcClientBase that accept the meta
types of the RPC result messages. Generate the code that uses these
overloads by default, sot QGrpcClientBase can store the information
about the result type inside the QGrpcOperationContext.

Introduce QGrpcOperation::responseMetaType,
QGrpcOperationContext::responseMetaType and
QGrpcOperationContext::setResponseMetaType methods.

These methods are user-facing API to access or change the result meta
type.

Task-number: QTBUG-128743
Change-Id: Ide0ebc1c935dfbdf0d3b62e05acdf058f95bf367
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-09-27 15:06:08 +02:00
Alexey Edelev c0713d6614 Add the missing guards for QLocalSocket usages
Guard the QLocalSocket implementation in QGrpcHttp2Channel
with the respective feature condition.

Fixes: QTBUG-129204
Pick-to: 6.8 6.8.0
Change-Id: Ie4de6576318305194735d76b46db1475faff3fdb
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2024-09-24 05:33:18 +00:00
Dennis Oberst 19fca04537 Prefer the usage of SingleShotConnection
Currently we're doing something manually, which, since Qt6 is a
dedicated feature. Use that instead for less error-prone disconnections
for our single-shot signals.

Lets not re-invent the wheel for something that has been (potentially
faster rather then slower) invented for this exact usecase.

We will promote the usage of Qt::SingleShotConnection, so as good
teachers we should be using it as well.

Pick-to: 6.8
Change-Id: I3b2b9f176f06d91b4d0946a38c53a4c2614c8a01
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
2024-09-20 15:48:06 +02:00
Alexey Edelev 97a99986c0 Scope QAbstractProtobufSerializer::Error enum
All new enums should be scoped.

Drive-by change: Remove the redundant suffixes of the enum elements.
It's obvious from the scope that those are errors.

Pick-to: 6.8
Task-number: QTBUG-123626
Change-Id: Ided4ab4a1ddb2d14713f876ffe4fe339af39ae6b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-09-05 10:41:03 +02:00
Alexey Edelev 9ea53a4ef8 Remove the redundant QML_URI option from protobuf generators
The option is noop, since the QML URI is not used by generators.
Plain QML option should be sufficient.

Pick-to: 6.8
Change-Id: I3b3c90103799316300ca86f11e5ddcc60e53443d
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-09-03 18:19:15 +02:00
Alexey Edelev a1b5a6dd8f Migrate to std::unique_ptr return value for all RPCs
The use of shared pointers has potential risk of storing the
QGrpcOperation children forever and leaking in user code. The problem
is clearly in the lambda connections that we encourage to use in the
docs and examples:

  auto stream = testStream(...);
  QObject::connect(stream.get(), &QGrpcOperation::finished,
                   ctx, [ctx, stream]{...});

The above code will hold the 'stream' forever, unless user will make
the explicit disconnect in the lambda.

By using std::unique_ptr we partially solve this, or at least convince
user to solve this. When user creates lambda he knows the 'stream'
lifetime and most probably should consider that after the move, lambda
is owning the QGrpcOperation, so the need of disconnect is more clear
in this case:

  auto stream = testStream(...);
  auto *streamPtr = stream.get();
  QObject::connect(streamPtr, &QGrpcOperation::finished,
                   ctx, [ctx, stream = std::move(stream)]{...});

The code becomes a bit more complicated, but it points explicitly to
the potential risk. Also it disallows to make this trick to multiple
lambdas at the same time.

Of course using the lambda context to control the QGrpcOperation
lifetime in this case is not necessary. But even if users will decide
to manage the QGrpcOperation lifetime differently, the use of
std::unique_ptr will clearly point to the ownership.

[ChangeLog][Grpc] All generated RPC methods now return std::unique_ptr
instead of std::shared_ptr. This change explicitly defines that caller
takes the ownership of the returned pointers.

Pick-to: 6.8
Change-Id: I271b91454f0c1b12b77127a7e025fa493367e279
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-08-30 12:08:46 +02:00
Alexey Edelev 62445f15e2 Allow building grpc benchmarks as standalone project
Add missing BuildInternals lookiup for the standalone build of the
gGRPC benchmark project.

Pick-to: 6.8
Change-Id: I4fb423f95743bc67ebca1604bec3756edd521795
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-08-29 13:49:07 +02:00
Alexey Edelev e1291ffb39 Generate the lvalue cref getters for the non-trivially copyable types
Generate the lvalue cref getters for the non-trivially copyable
non-protobuf message types(like repeated fields or QString/QByteArray)

Pick-to: 6.8
Task-number: QTBUG-123626
Change-Id: Idf6e3d372b6473df6c655b9608583effbc1a372b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-08-28 14:47:48 +02:00
Alexey Edelev 9179dafa46 Add ref-qualifiers for the non-trivially copyable type getters
Add the explicit lvalue ref-quialifiers for the non-trivially copyable
type getters in the generated code.

Pick-to: 6.8
Task-number: QTBUG-123626
Change-Id: I06f0dd0dfb8f35e937f21c5e58271fa8d5f76a44
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-08-28 14:47:48 +02:00
Alexey Edelev 6353989f5e Add rvalue setter to the generated messages
Add rvalue setter to the generated messages for the non-trivially
copyable fields. This also implies the change of trivially copyable
type setters. These setters now pass arguments by value, but not
as cref.

Pick-to: 6.8
Task-number: QTBUG-123626
Change-Id: Ic504366b1c7218a9825fff4c74cf694c19d442a7
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-08-28 14:47:48 +02:00
Alexey Edelev c6a9a65f31 Farewell mutable getters
Remove the generating of the mutable getters for protobuf messages.
Since the moc prefers using them as property getters we cannot
continue generating them, because each access to the property detaches,
which has bad consequences for the performance.

Pick-to: 6.8
Fixes: QTBUG-119913
Change-Id: I8cf405f01932174318a5d8c5a251a24272b90629
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-08-28 14:47:48 +02:00
Alexey Edelev 6cf8e05703 React on QQmlGrpcMetadata::dataChanged in QQmlGrpcChannelOptions
It's necessary not only to set the inner metadata when the setMetadata
is called, but also when QQmlGrpcMetadata::data is changed. Otherwise
the internal metadata value will not be in sync.

As drive-by change, fix the usage of channel options in
QGrpcHttp2Channel. Instead of storing the options duplicate in
QGrpcHttp2Channel, use the QAbstractGrpcHttp2Channel copy.
Make QAbstractGrpcHttp2Channel::channelOptions public.

TODO: QGrpcHttp2Channel doesn't consider the changes of ssl
configuration and serialization format when updating the
channelOptions, but it should react respectively or disallow setting
those at runtime.

Pick-to: 6.8
Change-Id: I40cf8476679f83a2925d77bcd1d89f043a0b6e67
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
2024-08-28 14:47:48 +02:00