summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/tools/ivigenerator/generate.py6
-rw-r--r--src/tools/ivigenerator/ivigenerator.pro13
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.h.tpl3
-rw-r--r--src/tools/ivigenerator/templates_generation_validator.yaml19
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl60
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl57
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl74
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/main.qml.tpl100
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl45
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl15
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl194
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl51
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/org-example-echo-noannotation.pro2
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/validator/validator.pro16
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro2
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro17
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro2
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro16
18 files changed, 2 insertions, 690 deletions
diff --git a/src/tools/ivigenerator/generate.py b/src/tools/ivigenerator/generate.py
index 5f7b311..b792797 100755
--- a/src/tools/ivigenerator/generate.py
+++ b/src/tools/ivigenerator/generate.py
@@ -63,7 +63,7 @@ Filters.classPrefix = ''
currentQFaceSrcFile = ''
builtin_config = {}
-IVI_DEFAULT_TEMPLATES = ['frontend', 'qmlplugin', 'backend_simulator', 'generation_validator', 'backend_qtro', 'server_qtro', 'server_qtro_simulator', 'test']
+IVI_DEFAULT_TEMPLATES = ['frontend', 'qmlplugin', 'backend_simulator', 'backend_qtro', 'server_qtro', 'server_qtro_simulator', 'test']
def jinjaTrace():
"""
@@ -848,7 +848,6 @@ def run(format, moduleConfig, annotations, src, dst):
@click.option('--reload/--no-reload', default=False, help='Specifies whether the generator should keep track of the changes in the IDL file and update output on the fly (--no-reload by default).')
@click.option('--format', '-f', multiple=False, help='The format the autogenerator should use for the generation. This can either be one of the builtin formats or a path to a template folder. Builtin formats are: \n' + '\n'.join(IVI_DEFAULT_TEMPLATES))
@click.option('--module', default=False, help='The name of the Qt module the autogenerator is generating. This is automatically used by the qmake integration and passed directly to the qface templates.')
-@click.option('--validation_info', is_flag=True, default=False, help='Annotates every interface with additional JSON code containing all the options used to generate this interface. This can be used to validate the generation of the interface.')
@click.option('--force', is_flag=True, default=False, help='Always write all output files')
@click.option('--annotations', '-A', multiple=True, default=False, help=
'Merges the given annotation file with annotions already in the qface file and the '
@@ -858,7 +857,7 @@ def run(format, moduleConfig, annotations, src, dst):
@click.argument('src', nargs=-1, type=click.Path(exists=True))
@click.argument('dst', nargs=1, type=click.Path(exists=True))
-def app(src, dst, format, reload, module, validation_info, force, annotations):
+def app(src, dst, format, reload, module, force, annotations):
"""
The QtIvi Autogenerator (ivigenerator)
@@ -880,7 +879,6 @@ def app(src, dst, format, reload, module, validation_info, force, annotations):
else:
moduleConfig = {
"module": module,
- "validation_info": validation_info,
"force": force
}
run(format, moduleConfig, annotations, src, dst)
diff --git a/src/tools/ivigenerator/ivigenerator.pro b/src/tools/ivigenerator/ivigenerator.pro
index 0d90346..59784d4 100644
--- a/src/tools/ivigenerator/ivigenerator.pro
+++ b/src/tools/ivigenerator/ivigenerator.pro
@@ -60,17 +60,6 @@ templates_backend_simulator.files += \
templates_backend_simulator/plugin.pro
templates_backend_simulator.path = $$[QT_HOST_BINS]/ivigenerator/templates_backend_simulator
-templates_generation_validator.files += \
- templates_generation_validator/generationstatusitem.cpp.tpl \
- templates_generation_validator/generationstatusitem.h.tpl \
- templates_generation_validator/main.cpp.tpl \
- templates_generation_validator/main.qml.tpl \
- templates_generation_validator/qml.qrc.tpl \
- templates_generation_validator/ui.pri.tpl \
- templates_generation_validator/validationstatus.cpp.tpl \
- templates_generation_validator/validationstatus.h.tpl
-templates_generation_validator.path = $$[QT_HOST_BINS]/ivigenerator/templates_generation_validator
-
templates_backend_qtro.files += \
templates_backend_qtro/backend.cpp.tpl \
templates_backend_qtro/backend.h.tpl \
@@ -111,7 +100,6 @@ generator.files += \
templates_frontend.yaml \
templates_qmlplugin.yaml \
templates_backend_simulator.yaml \
- templates_generation_validator.yaml \
templates_test.yaml \
generator.path = $$[QT_HOST_BINS]/ivigenerator
@@ -132,7 +120,6 @@ INSTALLS += generator \
templates_frontend \
templates_qmlplugin \
templates_backend_simulator \
- templates_generation_validator \
templates_test \
OTHER_FILES += deploy-virtualenv.bat \
diff --git a/src/tools/ivigenerator/templates_frontend/interface.h.tpl b/src/tools/ivigenerator/templates_frontend/interface.h.tpl
index 1007739..e1dc448 100644
--- a/src/tools/ivigenerator/templates_frontend/interface.h.tpl
+++ b/src/tools/ivigenerator/templates_frontend/interface.h.tpl
@@ -77,9 +77,6 @@ class {{exportsymbol}} {{class}} : public {{base_class}}
{{ivi.property(property)}}
{% endfor %}
Q_CLASSINFO("IviPropertyDomains", "{{ interface.properties|json_domain|replace("\"", "\\\"") }}")
-{% if interface.module.tags.config.validation_info %}
- Q_CLASSINFO("IviJson", "{{ module|jsonify|replace("\"", "\\\"")|replace("\n", " \\\n") }}")
-{% endif %}
public:
{% if interface.tags.config.zoned %}
diff --git a/src/tools/ivigenerator/templates_generation_validator.yaml b/src/tools/ivigenerator/templates_generation_validator.yaml
deleted file mode 100644
index aaf598c..0000000
--- a/src/tools/ivigenerator/templates_generation_validator.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-generate_rules:
- module_rules:
- - dest_file: "main.cpp"
- template_file: "main.cpp.tpl"
- - dest_file: "main.qml"
- template_file: "main.qml.tpl"
- - dest_file: "qml.qrc"
- template_file: "qml.qrc.tpl"
- - dest_file: "{{srcBase|lower}}.pri"
- template_file: "ui.pri.tpl"
- - dest_file: "generationstatusitem.cpp"
- template_file: "generationstatusitem.cpp.tpl"
- - dest_file: "generationstatusitem.h"
- template_file: "generationstatusitem.h.tpl"
- - dest_file: "validationstatus.cpp"
- template_file: "validationstatus.cpp.tpl"
- - dest_file: "validationstatus.h"
- template_file: "validationstatus.h.tpl"
- interface_rules:
diff --git a/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl
deleted file mode 100644
index b11f183..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl
+++ /dev/null
@@ -1,60 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% include "common/generated_comment.cpp.tpl" %}
-#include "generationstatusitem.h"
-#include "validationstatus.h"
-{% for iface in module.interfaces %}
-#include "{{iface|lower}}.h"
-{% endfor %}
-
-
-GeneratorValidationStatus::GeneratorValidationStatus(QObject *parent)
-: QObject(parent)
-, m_errorMessage("All data has been successfully generated")
-{
- QString error;
-{% for iface in module.interfaces %}
- {{iface}} {{iface|lowerfirst}};
- checkGeneration(error, {{iface|lowerfirst}});
-{% endfor %}
- if (!error.isEmpty())
- m_errorMessage = error;
-}
diff --git a/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl b/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl
deleted file mode 100644
index a8996df..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl
+++ /dev/null
@@ -1,57 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% include "common/generated_comment.cpp.tpl" %}
-#include <QObject>
-
-
-class GeneratorValidationStatus : public QObject {
- Q_OBJECT
- Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
-public:
- explicit GeneratorValidationStatus(QObject *parent = nullptr);
- ~GeneratorValidationStatus() = default;
-
- QString errorMessage() const { return m_errorMessage;}
-Q_SIGNALS:
- void errorMessageChanged(const QString &errorMessage);
-private:
- QString m_errorMessage;
-};
diff --git a/src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl
deleted file mode 100644
index 7a53225..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl
+++ /dev/null
@@ -1,74 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% include "common/generated_comment.cpp.tpl" %}
-
-#include <QGuiApplication>
-#include <QQmlApplicationEngine>
-#include "generationstatusitem.h"
-#include "validationstatus.h"
-
-#include <{{module.module_name|lower}}module.h>
-{% for iface in module.interfaces %}
-#include "{{iface|lower}}.h"
-{% endfor %}
-
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- QString error;
-{% for iface in module.interfaces %}
- {{iface|upperfirst}} {{iface|lowerfirst}};
- checkGeneration(error, {{iface|lowerfirst}});
-{% endfor %}
-
-
- qmlRegisterType<GeneratorValidationStatus>("org.example.Example", 1, 0, "ValidationStatus");
- {{module.module_name|upperfirst}}Module::registerTypes();
-{#% for iface in module.interfaces %#}
- {{module.module_name|upperfirst}}Module::registerQmlTypes(QLatin1String("{{module.module_name}}"), 1, 0);
-{#% endfor %#}
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- return app.exec();
-}
diff --git a/src/tools/ivigenerator/templates_generation_validator/main.qml.tpl b/src/tools/ivigenerator/templates_generation_validator/main.qml.tpl
deleted file mode 100644
index 02250ec..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/main.qml.tpl
+++ /dev/null
@@ -1,100 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% include "common/generated_comment.cpp.tpl" %}
-
-import QtQuick 2.7
-import QtQuick.Window 2.2
-import QtQuick.Controls 2.1
-import org.example.Example 1.0
-import {{module.module_name}} 1.0
-
-Window {
- visible: true
- width: 640
- height: 480
- title: qsTr("QtIVI {{module.module_name}}")
-
- ValidationStatus {
- id: validationStatus
- }
-
- Column {
- anchors.fill: parent
- anchors.margins: 5
-
- Text {
- text: validationStatus.errorMessage
- }
-
-{% for iface in module.interfaces %}
- {{iface|qml_type}} {
- id: {{iface|lowerfirst}}
- }
-
- Text {
- text: "{{iface}}"
- }
-
- ToolSeparator {
- orientation: Qt.Horizontal
- }
-
-{% for property in iface.properties %}
- Text {
- text: "{{property|upperfirst}}: " + {{iface|lowerfirst}}.{{property}}
- }
-{% endfor %}
-
-{% for signal in iface.signals %}
- Connections {
- target: {{iface|lowerfirst}}
- on{{signal|upperfirst}}: {
- print("{{signal}}")
-{% for parameter in signal.parameters %}
- print({{parameter}})
-{% endfor %}
- }
- }
-{% endfor %}
-
-{% endfor %}
- }
-}
diff --git a/src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl b/src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl
deleted file mode 100644
index 35ffb10..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl
+++ /dev/null
@@ -1,45 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
diff --git a/src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl b/src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl
deleted file mode 100644
index d8a2a71..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl
+++ /dev/null
@@ -1,15 +0,0 @@
-#############################################################################
-## This is an auto-generated file.
-## Do not edit! All changes made to it will be lost.
-#############################################################################
-
-SOURCES += \
- $$PWD/main.cpp \
- $$PWD/validationstatus.cpp \
- $$PWD/generationstatusitem.cpp
-
-HEADERS += \
- $$PWD/validationstatus.h \
- $$PWD/generationstatusitem.h
-
-RESOURCES += $$PWD/qml.qrc
diff --git a/src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl
deleted file mode 100644
index 0a91693..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl
+++ /dev/null
@@ -1,194 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% include "common/generated_comment.cpp.tpl" %}
-
-#include "validationstatus.h"
-
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonArray>
-#include <QDebug>
-#include <QObject>
-#include <QMetaProperty>
-
-QString idlToQtTypeName(const QString& idlTypeName)
-{
- QString result = idlTypeName;
- if (idlTypeName == QLatin1String("string"))
- result = "QString";
- return result;
-}
-
-bool checkProperty(const QMetaProperty& metaProp, const QJsonValue& jValProp, QString& errorMessage)
-{
- bool result = true;
- QJsonObject jObjProp = jValProp.toObject();
- if (metaProp.name() != jObjProp[QLatin1String("name")].toString())
- return false;
- // Anyway it should be readable
- if (!metaProp.isReadable()) {
- errorMessage += QString("Property %1 is not readable\n").arg(metaProp.name());
- return false;
- }
- // Writable only if not readonly
- if (metaProp.isWritable() && jObjProp[QLatin1String("readonly")].toBool()) {
- errorMessage += QString("Property %1 is writable whereas it's defined as read-only\n").arg(metaProp.name());
- return false;
- }
- // Check the property type as well
- QString metaTypeName = metaProp.typeName();
- QString propTypeName = idlToQtTypeName(jObjProp[QLatin1String("type")].toObject()[QLatin1String("name")].toString());
- if (metaTypeName != propTypeName)
- return false;
- return result;
-}
-
-bool checkMethod(const QMetaMethod& metaOp, const QJsonValue& jValOp, QString& errorMessage)
-{
- QJsonObject jObjOp = jValOp.toObject();
- if (metaOp.name() != jObjOp[QLatin1String("name")].toString())
- return false;
-
- // Check the method parameter types and return type as well
- QString metaReturnType = metaOp.typeName();
- QString opReturnType = jObjOp[QLatin1String("type")].toObject()[QLatin1String("name")].toString();
- opReturnType = idlToQtTypeName(opReturnType);
- if (metaReturnType != opReturnType) {
- return false;
- }
- QJsonValue jValParams = jObjOp[QLatin1String("parameters")];
- Q_ASSERT(jValParams.isNull() || jValParams.isArray());
- QJsonArray jArrParams = jValParams.toArray();
- if (jArrParams.size() != metaOp.parameterCount()) {
- errorMessage += QString("Amount of parameters in method %1 differs from its IDL definition (%2 vs %3)\n")
- .arg(metaOp.name().data())
- .arg(metaOp.parameterCount())
- .arg(jArrParams.size());
- return false;
- }
-
- for (int i = 0; i < metaOp.parameterCount(); ++i) {
- QString metaParamType = jArrParams[i].toObject()[QLatin1String("type")].toObject()[QLatin1String("name")].toString();
- metaParamType = idlToQtTypeName(metaParamType);
- QString genParamType = metaOp.parameterTypes().at(i);
- if (genParamType != metaParamType) {
- errorMessage += QString("Method %1: %2-th parameter type differs from IDL definition (%3 vs %4)\n")
- .arg(metaOp.name().data())
- .arg(i)
- .arg(genParamType)
- .arg(metaParamType);
- return false;
- }
- }
- return true;
-}
-
-bool checkGeneration(QString& errorMessage, QObject& obj)
-{
- bool result = true;
- auto* metaObj = obj.metaObject();
- int classInfoCount = metaObj->classInfoCount();
- QMetaClassInfo metaClassInfo;
- const QString META_INFO_NAME = QLatin1String("IviJson");
- for (int index = 0; index < classInfoCount; ++index) {
- metaClassInfo = metaObj->classInfo(index);
- if (metaClassInfo.name() == META_INFO_NAME)
- break;
- }
- if (metaClassInfo.name() != META_INFO_NAME) {
- return false;
- }
- QJsonObject metaDoc(QJsonDocument::fromJson(metaClassInfo.value()).object());
- auto jVal = metaDoc[QLatin1String("interfaces")];
- if (jVal.isNull() || !jVal.isArray()) {
- errorMessage += QString("Interfaces list is empty in the class meta info");
- return false;
- }
-
-
- QJsonArray jArrInterfaces = jVal.toArray();
- QJsonObject jInterface;
- for (auto jValInterface : jArrInterfaces) {
- Q_ASSERT(jValInterface.isObject());
- if (jValInterface.toObject()[QLatin1String("name")] == QLatin1String(metaObj->className())) {
- jInterface = jValInterface.toObject();
- break;
- }
- }
- if (jInterface.empty()) {
- errorMessage += QString("Interface %1 is not implemented!\n").arg(metaObj->className());
- return false;
- }
-
- // Check the properties
- QJsonValue jValProps = jInterface[QLatin1String("properties")];
- auto jArrProps = jValProps.toArray();
- for (auto jValProp : jArrProps) {
- auto propName = jValProp.toObject()[QLatin1String("name")].toString();
- int propIdx = metaObj->indexOfProperty(propName.toLatin1().data());
- if (propIdx == -1) {
- errorMessage += QString("Property %1 has been not generated by the generator!\n").arg(propName);
- result = false;
- } else {
- result &= checkProperty(metaObj->property(propIdx), jValProp, errorMessage);
- }
- }
-
- // Check the methods
- QJsonValue jValOps = jInterface[QLatin1String("operations")];
- auto jArrOps = jValOps.toArray();
- for (auto jValOp : jArrOps) {
- bool opFound = false;
- QString opName = jValOp.toObject()[QLatin1String("name")].toString();
- for (int i = 0; i < metaObj->methodCount(); ++i) {
- if (metaObj->method(i).name() == opName) {
- opFound = true;
- result &= checkMethod(metaObj->method(i), jValOp, errorMessage);
- }
- }
- if (!opFound) {
- errorMessage += QString("Method %1 has been not generated by the generator!").arg(opName);
- result = false;
- }
- }
-
- return result;
-}
diff --git a/src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl b/src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl
deleted file mode 100644
index b6c2ce9..0000000
--- a/src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl
+++ /dev/null
@@ -1,51 +0,0 @@
-{#
-# Copyright (C) 2019 Luxoft Sweden AB
-# Copyright (C) 2018 Pelagicore AG
-# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
-# Contact: https://www.qt.io/licensing/
-#
-# This file is part of the QtIvi module of the Qt Toolkit.
-#
-# $QT_BEGIN_LICENSE:LGPL-QTAS$
-# Commercial License Usage
-# Licensees holding valid commercial Qt Automotive Suite licenses may use
-# this file in accordance with the commercial license agreement provided
-# with the Software or, alternatively, in accordance with the terms
-# contained in a written agreement between you and The Qt Company. For
-# licensing terms and conditions see https://www.qt.io/terms-conditions.
-# For further information use the contact form at https://www.qt.io/contact-us.
-#
-# GNU Lesser General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU Lesser
-# General Public License version 3 as published by the Free Software
-# Foundation and appearing in the file LICENSE.LGPL3 included in the
-# packaging of this file. Please review the following information to
-# ensure the GNU Lesser General Public License version 3 requirements
-# will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-#
-# GNU General Public License Usage
-# Alternatively, this file may be used under the terms of the GNU
-# General Public License version 2.0 or (at your option) the GNU General
-# Public license version 3 or any later version approved by the KDE Free
-# Qt Foundation. The licenses are as published by the Free Software
-# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-# included in the packaging of this file. Please review the following
-# information to ensure the GNU General Public License requirements will
-# be met: https://www.gnu.org/licenses/gpl-2.0.html and
-# https://www.gnu.org/licenses/gpl-3.0.html.
-#
-# $QT_END_LICENSE$
-#
-# SPDX-License-Identifier: LGPL-3.0
-#}
-{% include "common/generated_comment.cpp.tpl" %}
-
-#ifndef VALIDATIONSTATUS_H_
-#define VALIDATIONSTATUS_H_
-
-#include <QObject>
-#include <QString>
-
-bool checkGeneration(QString& errorMessage, QObject& obj);
-
-#endif // VALIDATIONSTATUS_H_
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/org-example-echo-noannotation.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/org-example-echo-noannotation.pro
index 993ce2a..bd2e628 100644
--- a/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/org-example-echo-noannotation.pro
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/org-example-echo-noannotation.pro
@@ -3,11 +3,9 @@ TEMPLATE = subdirs
SUBDIRS = frontend \
qmlplugin \
backend_simulator \
- validator \
test \
backend_simulator.depends = frontend
-validator.depends = frontend
test.depends = frontend
qmlplugin.depends = frontend
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/validator/validator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/validator/validator.pro
deleted file mode 100644
index 09ec4d1..0000000
--- a/tests/auto/core/ivigenerator/projects/org-example-echo-noannotation/validator/validator.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TEMPLATE = app
-TARGET = validator_org-example-echo-noannotation
-QMAKE_PROJECT_NAME = $$TARGET
-LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_noannotation_frontend)
-
-DESTDIR = ..
-
-CONFIG += c++11 ivigenerator
-CONFIG -= app_bundle
-
-INCLUDEPATH += $$OUT_PWD/../frontend
-
-QT += qml quick core ivicore
-
-QFACE_FORMAT = generation_validator
-QFACE_SOURCES = ../../../org.example.echo.noannotation.qface
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro
index c751801..0967ee4 100644
--- a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro
@@ -5,10 +5,8 @@ QT_FOR_CONFIG += ivicore
SUBDIRS = frontend \
qmlplugin \
backend_simulator \
- validator \
test
backend_simulator.depends = frontend
-validator.depends = frontend
test.depends = frontend
qmlplugin.depends = frontend
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro
deleted file mode 100644
index 016c77d..0000000
--- a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = validator_org-example-echo-noprivate
-QMAKE_PROJECT_NAME = $$TARGET
-LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_noprivate_frontend)
-
-DESTDIR = ..
-
-CONFIG += c++11 ivigenerator
-CONFIG -= app_bundle
-
-INCLUDEPATH += $$OUT_PWD/../frontend
-
-QT += qml quick core ivicore
-
-QFACE_FORMAT = generation_validator
-QFACE_SOURCES = ../../../org.example.echo.qface
-QFACE_ANNOTATIONS += ../../../no-private.yaml
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro b/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro
index 38be75d..f6f762c 100644
--- a/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro
@@ -3,10 +3,8 @@ TEMPLATE = subdirs
SUBDIRS = frontend \
qmlplugin \
backend_simulator \
- validator \
test \
backend_simulator.depends = frontend
-validator.depends = frontend
test.depends = frontend
qmlplugin.depends = frontend
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro
deleted file mode 100644
index 122db41..0000000
--- a/tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-TEMPLATE = app
-TARGET = validator_org-example-echo
-QMAKE_PROJECT_NAME = $$TARGET
-LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_frontend)
-
-DESTDIR = ..
-
-CONFIG += c++11 ivigenerator
-CONFIG -= app_bundle
-
-INCLUDEPATH += $$OUT_PWD/../frontend
-
-QT += qml quick core ivicore
-
-QFACE_FORMAT = generation_validator
-QFACE_SOURCES = ../../../org.example.echo.qface