QGrpcOperation name is more matching the implementation,
because is no longer thread safe and does not implement any of
async methods.
Task-number: QTBUG-108833
Pick-to: 6.5
Change-Id: I926dc651b2c3daa58429bcb358a827bd398cee46
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Minimize incrementing and check of the iterator variables. Replaces
hardcoded test values with constants.
Change-Id: I5ae4c5e1ab8db62b5744e62f62a5124536686342
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>
Reduce the base latency to 300ms since this should be good enough for
tests on localhost. Also replace all 'QT_TRY_<>' test calls with the
'QT_TRY_<>_WITH_TIMEOUT' calls to reduce the execution time.
Add signal spies for the 'finished' signal, to make sure that client
completed the communication with server, before checking messages
that were received from server and ensure that 'errorOccured' signal
is not called where it shouldn't.
Fixes: QTBUG-108212
Change-Id: I45338ad0495d77e461d96d2dd4193f1337dfbb3c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Check required dependencies for gRPC, which are linked as
INTERFACE_LINK_LIBRARIES which results in error when trying to use
gRPC library.
Fixes: QTBUG-109372
Pick-to: 6.5
Change-Id: Ib1adb7f9aff3041c50fabaa47bf269081342a639
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add the missing call of the finished() signal to the native-based
implementation of gRPC stream. Emit both errorOccured and finished
when the stream is finished with error. This behavior is aligned
with the behavior of QNetworkReply.
Task-number: QTBUG-108212
Change-Id: I3f45e33c89aca1cd258066a9f7b3df846ceeccc2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Look for the gRPC libraries using PkgConfig module. This helps to
find gRPC on systems that don't have CMake packages installed.
Task-number: QTBUG-108833
Change-Id: Iaaa9d38facd6490c3d96d9eb30b0cdddde46edde
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
QtGrpc provides support for serializing and deserializing
gRPC services using Qt.
The tool was originally written by Alexey Edelev, along with various
contributors, on GitHub. Originally under MIT license, but major
contributors have agreed to relicense the code under GPL/commercial for
inclusion in tools for Qt. Their copyright notice is retained and
the original source code, still licensed as MIT, can be found in its
original repository[0].
[0]: https://github.com/semlanik/qtprotobuf
Change-Id: Id29e70df1249e9369fbfaa2c543f3ff29efbdbea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Rename:
FOLDER option to GENERATE_PACKAGE_SUBFOLDERS
COMMENTS option to COPY_COMMENTS
OUT_GENERATED_HEADERS option to OUTPUT_HEADERS
OUT_GENERATED_TARGETS option to OUTPUT_TARGETS
Adjust and cleanup the corresponding documentation.
Change-Id: I2fdeaaba89257c8bbca4389a08119abf3158702f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Oneof fields depend on the enum that contains field numbers. Enable
the option by default.
Change-Id: I4d5dd63f328d26bdce15d6310489c4146fbf5c0d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Use a directory where the test binary is located to generate
the protobuf source files. This avoids polluting the source
directory if test exits with the critical error.
Change-Id: I288b5b3b84b243c28e9dd967e4411a7d4805d1bf
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Use the unknownEntries variable we so cleverly added in
QProtobufMessagePrivate to store the data for the unknown fields.
By using a bytes-to-count mapping we can easily store multiple repeated
entries of a message, which could happen in a repeated list with
multiple identical entries. Since we don't know if a field is actually
marked as _repeated_ or not (since it's an unknown field) we just have
to assume it is.
Fixes: QTBUG-101966
Change-Id: I1ebde5fdaebe2987a68de1632f136bb6606e718a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This allows to create messages using the full protobuf message
name, if the message was registered.
Using this mapping between QMetaType and QProtobufOrdering it's
now possible to serialize and deserialize pointers to QProtobufMessage
without casting QProtobufMessage to the protobuf message type.
This is partially required for conformance testing and Any type
handling.
Change-Id: I58fd2d821b76ce3f59f121b65ad28c2b28a189e7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The <QtTest/QtTest> include is a module-include and includes
_all_ of QtTest + its dependencies (QtCore)
Change-Id: I2a3d04798c259924b462f6e2eaec9d863c6c9edb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Update version to 6.5, since protobuf was not released at 6.4 times.
Change-Id: I1714ca467fb897e9f079cc06cdd94d26b66fe6cb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
And inherit from it instead of QObject in messages.
Messages are inherently value-types. They don't have any logic
associated with them, they simply store some value(s).
Value-types should be copyable and movable but QObject _is not_ because
this would break connections and parenting.
By making the objects Q_GADGETs we can still retain Q_PROPERTY, and by
having a pointer to the object's staticMetaObject we can implement
property/setProperty functionality in QProtobufMessage with minimal
effort.
As a side-effect of this we no longer emit, or even have, signals
when values on a message changes. But, as mentioned previously, messages
don't have any logic associated to them so they would never update
without users either calling an associated setter function or by
deserializing a new message into an already-existing object.
As another side-effect: propertyCount has decreased because we no longer
have QObject's 'name' property.
Fixes: QTBUG-100986
Change-Id: I0366a180bf5aadd4afb075527b80cc0a3e923ab6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Unlock testing on targeting platforms if they do force building tools.
Since the tool package requires the 'protoc' executable we also
need to make sure that 'protoc' could be found using host package
prefix path. This adds QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH to
seach prefixes of the 'protoc' executable.
TODO: We need to add protobuf to the b2qt CI image to build
qtprotobufgen unconditionally.
Change-Id: I29a711fe3c0986d7845d1a0622bc18badfdbd934
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
And store the size of the message name in the Data section.
Adding more meta data can be done in a similar way, adding extra fields
to char_data, bumping the version field and updating char_data() to deal
with new data.
Change-Id: Id7d3d867d74bcc80a05e597a4d0af7056982accb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
There are type checks that are repeated in the QProtobufSerializer
code. It makes sense to generalize them into appropriate structures
for code readability.
Change-Id: Ifb94e4bf1306aacbd2973cf6d88495ed182cf277
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Protobuf allows non-packed way of serialization of the repeated
fields. This is controlled on the protobuf schema level by adding the
'packed' attribute to a message field descriptor. If the attribute is
not set the default value is 'true', so all repeated messages should
use the 'packed' approach when serializing.
Fixes: QTBUG-103979
Change-Id: I078a18734785865a4b7b34190a642b82b7829755
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Add the additional field to the property ordering structure to
indicate the special attributes that the message fields may have,
e.g. the 'packed' attribute.
Task-number: QTBUG-103979
Change-Id: I62c974cc924011956feb7692d6cb4fcd072dc1e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The list of integrated type serializers is predefined and can be
initialized statically. Using std::array allows us to avoid extra
allocations and gives us clean and simple static initialization.
Change-Id: I04290d3b343487d6967341502c893f76a5044139
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Tune namespace related functions to make them pure string to stop
using std::vector to collect strings up, for later joining.
Change-Id: Ibc2dc3250a62dfd0f4db6135fea5f72146b8c552
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Disable the generating of QML code in qtprotobufgen until the QML
part is ported to Qt6 using the modern QML API.
Change-Id: I24bec2ef65fbc6ca9ee28a4cd4253c924c19991c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The protoc tool has the generic mechanisms for plugin option handling.
The plugin-specific options can be specified using the
--<plugin_name>_opt argument or by prepending options to the
--<plugin_name>_out argument with colon separator. In both cases
options need to be separated by semicolon. Add the processing of this
argument to generator and use --<plugin_name>_opt as the default one
in CMake API. Also adjust format of the QT_PROTOBUF_OPTIONS environment
variable to make them consistent.
Change-Id: I269ca7b9b2a952d0d30b18cb57c1465ae261c83a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The code handles serialization and deserialization by itself with no
extra dependencies. It also contains a system for registering converters
specific to Protobuf serialization as well as having the ability to
extend it to handle JSON encoding[0] in the future, using QJson.
This patch is a companion to the patch introducing the qtprotobufgen
tool.
The code was originally written by Alexey Edelev, along with various
contributors, on GitHub. Originally under MIT license, but major
contributors have agreed to relicense the code under LGPL/GPL/commercial
for inclusion in Qt. Their copyright notice is retained and the
original source code, still licensed as MIT, can be found in its
original repository[1].
[0]: https://developers.google.com/protocol-buffers/docs/proto3#json
[1]: https://github.com/semlanik/qtprotobuf
Done-with: Alexey Edelev <alexey.edelev@qt.io>
Change-Id: I8b2e7074a19f39bd52ab263e215d2e99ffaf1162
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
The generator generates Qt-based classes to be used in conjunction with
'QProtobuf' (separate patch).
qtprotobufgen works as an extension to the protoc tool from Google, and
thus also depends on its libraries for building.
The tool was originally written by Alexey Edelev, along with various
contributors, on GitHub. Originally under MIT license, but major
contributors have agreed to relicense the code under GPL/commercial for
inclusion in tools for Qt. Their copyright notice is retained and
the original source code, still licensed as MIT, can be found in its
original repository[0].
[0]: https://github.com/semlanik/qtprotobuf
Done-with: Alexey Edelev <alexey.edelev@qt.io>
Change-Id: I0d5f3d722cb98bca70fc0d4544ed840edb27430c
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>