summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZoltan Gera <zoltan.gera@qt.io>2025-11-26 14:55:20 +0200
committerZoltan Gera <zoltan.gera@qt.io>2025-12-08 14:32:39 +0200
commit547ec7e27325ea62f1ffd79d9eededa1520a2371 (patch)
tree756ba80ac363d7d0b37609b4619949f8c5d13dd8
parentdd1404b846721a966ea10e00ff160c1d289b6959 (diff)
Compatibility layer for deprecated and commonly used Jinja files
Using deprecated common template files is still possible from other templates but a warning is given about their deprecation. We aim to remove them in Qt 7. A test is also modified to enforce this removal when the time comes. [ChangeLog][ifcodegen] Renamed Jinja template files to use standard .jinja extensions, deprecated old .tpl extensions. Fixes: QTBUG-140720 Pick-to: 6.11 Change-Id: Icd359ca338215408810fb482b3ffbc8e1cf65da7 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r--src/tools/ifcodegen/CMakeLists.txt25
-rw-r--r--src/tools/ifcodegen/templates/common/backend_simulation.cpp.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/backend_simulation.h.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/backend_simulation.qml.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/designer.metainfo.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/generated_comment.cmake.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/generated_comment.cpp.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/generated_comment.qmake.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/generated_comment.qml.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/generated_comment.rep.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/interface.rep.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/module_simulation.qml.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/pagingmodel_simulation.cpp.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/pagingmodel_simulation.h.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/plugins.qmltypes.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/qmldir.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/qtif_macros.j22
-rw-r--r--src/tools/ifcodegen/templates/common/simulation.qmltypes.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/simulation.qrc.tpl2
-rw-r--r--src/tools/ifcodegen/templates/common/simulation_data.json.tpl2
-rw-r--r--tests/auto/core/ifcodegen/custom-template/templates/legacy-custom-test/tst_custom.h.jinja6
21 files changed, 68 insertions, 1 deletions
diff --git a/src/tools/ifcodegen/CMakeLists.txt b/src/tools/ifcodegen/CMakeLists.txt
index 3e5884b6..82bff2ca 100644
--- a/src/tools/ifcodegen/CMakeLists.txt
+++ b/src/tools/ifcodegen/CMakeLists.txt
@@ -237,6 +237,31 @@ add_custom_target(generator SOURCES
## INSTALL Targets
#####################################################################
+# Combatibility layer for deprecated file with .tpl extension
+qt_copy_or_install(
+ FILES
+ templates/common/generated_comment.cpp.tpl
+ templates/common/generated_comment.cmake.tpl
+ templates/common/generated_comment.qmake.tpl
+ templates/common/generated_comment.qml.tpl
+ templates/common/generated_comment.rep.tpl
+ templates/common/qtif_macros.j2
+ templates/common/simulation.qmltypes.tpl
+ templates/common/plugins.qmltypes.tpl
+ templates/common/designer.metainfo.tpl
+ templates/common/qmldir.tpl
+ templates/common/interface.rep.tpl
+ templates/common/simulation_data.json.tpl
+ templates/common/simulation.qrc.tpl
+ templates/common/module_simulation.qml.tpl
+ templates/common/backend_simulation.cpp.tpl
+ templates/common/backend_simulation.h.tpl
+ templates/common/backend_simulation.qml.tpl
+ templates/common/pagingmodel_simulation.h.tpl
+ templates/common/pagingmodel_simulation.cpp.tpl
+ DESTINATION "${templates_install_dir}/common"
+ )
+
qt_copy_or_install(
FILES
templates/common/generated_comment.cpp.jinja
diff --git a/src/tools/ifcodegen/templates/common/backend_simulation.cpp.tpl b/src/tools/ifcodegen/templates/common/backend_simulation.cpp.tpl
new file mode 100644
index 00000000..a4157ba2
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/backend_simulation.cpp.tpl
@@ -0,0 +1,2 @@
+{% include 'common/backend_simulation.cpp.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/backend_simulation.h.tpl b/src/tools/ifcodegen/templates/common/backend_simulation.h.tpl
new file mode 100644
index 00000000..9ae7b324
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/backend_simulation.h.tpl
@@ -0,0 +1,2 @@
+{% include 'common/backend_simulation.h.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/backend_simulation.qml.tpl b/src/tools/ifcodegen/templates/common/backend_simulation.qml.tpl
new file mode 100644
index 00000000..bd15b8a9
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/backend_simulation.qml.tpl
@@ -0,0 +1,2 @@
+{% include 'common/backend_simulation.qml.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/designer.metainfo.tpl b/src/tools/ifcodegen/templates/common/designer.metainfo.tpl
new file mode 100644
index 00000000..2f096c5c
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/designer.metainfo.tpl
@@ -0,0 +1,2 @@
+{% include 'common/designer.metainfo.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/generated_comment.cmake.tpl b/src/tools/ifcodegen/templates/common/generated_comment.cmake.tpl
new file mode 100644
index 00000000..a5a249cc
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/generated_comment.cmake.tpl
@@ -0,0 +1,2 @@
+{% include 'common/generated_comment.cmake.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/generated_comment.cpp.tpl b/src/tools/ifcodegen/templates/common/generated_comment.cpp.tpl
new file mode 100644
index 00000000..9dae5f9e
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/generated_comment.cpp.tpl
@@ -0,0 +1,2 @@
+{% include 'common/generated_comment.cpp.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/generated_comment.qmake.tpl b/src/tools/ifcodegen/templates/common/generated_comment.qmake.tpl
new file mode 100644
index 00000000..2e822a4c
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/generated_comment.qmake.tpl
@@ -0,0 +1,2 @@
+{% include 'common/generated_comment.qmake.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/generated_comment.qml.tpl b/src/tools/ifcodegen/templates/common/generated_comment.qml.tpl
new file mode 100644
index 00000000..8295d5c3
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/generated_comment.qml.tpl
@@ -0,0 +1,2 @@
+{% include 'common/generated_comment.qml.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/generated_comment.rep.tpl b/src/tools/ifcodegen/templates/common/generated_comment.rep.tpl
new file mode 100644
index 00000000..3a0494d7
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/generated_comment.rep.tpl
@@ -0,0 +1,2 @@
+{% include 'common/generated_comment.rep.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/interface.rep.tpl b/src/tools/ifcodegen/templates/common/interface.rep.tpl
new file mode 100644
index 00000000..a8c86864
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/interface.rep.tpl
@@ -0,0 +1,2 @@
+{% include 'common/interface.rep.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/module_simulation.qml.tpl b/src/tools/ifcodegen/templates/common/module_simulation.qml.tpl
new file mode 100644
index 00000000..89999e09
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/module_simulation.qml.tpl
@@ -0,0 +1,2 @@
+{% include 'common/module_simulation.qml.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/pagingmodel_simulation.cpp.tpl b/src/tools/ifcodegen/templates/common/pagingmodel_simulation.cpp.tpl
new file mode 100644
index 00000000..84965d62
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/pagingmodel_simulation.cpp.tpl
@@ -0,0 +1,2 @@
+{% include 'common/pagingmodel_simulation.cpp.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/pagingmodel_simulation.h.tpl b/src/tools/ifcodegen/templates/common/pagingmodel_simulation.h.tpl
new file mode 100644
index 00000000..bba11205
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/pagingmodel_simulation.h.tpl
@@ -0,0 +1,2 @@
+{% include 'common/pagingmodel_simulation.h.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/plugins.qmltypes.tpl b/src/tools/ifcodegen/templates/common/plugins.qmltypes.tpl
new file mode 100644
index 00000000..73061c58
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/plugins.qmltypes.tpl
@@ -0,0 +1,2 @@
+{% include 'common/plugins.qmltypes.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/qmldir.tpl b/src/tools/ifcodegen/templates/common/qmldir.tpl
new file mode 100644
index 00000000..3a988a40
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/qmldir.tpl
@@ -0,0 +1,2 @@
+{% include 'common/qmldir.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/qtif_macros.j2 b/src/tools/ifcodegen/templates/common/qtif_macros.j2
new file mode 100644
index 00000000..ccfe2e44
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/qtif_macros.j2
@@ -0,0 +1,2 @@
+{% include 'common/qtif_macros.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use .jinja extension instead of the deprecated .j2 extension for this file.') }}
diff --git a/src/tools/ifcodegen/templates/common/simulation.qmltypes.tpl b/src/tools/ifcodegen/templates/common/simulation.qmltypes.tpl
new file mode 100644
index 00000000..670b18c4
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/simulation.qmltypes.tpl
@@ -0,0 +1,2 @@
+{% include 'common/simulation.qmltypes.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/simulation.qrc.tpl b/src/tools/ifcodegen/templates/common/simulation.qrc.tpl
new file mode 100644
index 00000000..58a21e6d
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/simulation.qrc.tpl
@@ -0,0 +1,2 @@
+{% include 'common/simulation.qrc.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/src/tools/ifcodegen/templates/common/simulation_data.json.tpl b/src/tools/ifcodegen/templates/common/simulation_data.json.tpl
new file mode 100644
index 00000000..a39ee1ac
--- /dev/null
+++ b/src/tools/ifcodegen/templates/common/simulation_data.json.tpl
@@ -0,0 +1,2 @@
+{% include 'common/simulation_data.json.jinja' %}
+{{ deprecate_with_qt7_removal('6.11', 'Use the template file with .jinja extension instead of the deprecated .tpl one.') }}
diff --git a/tests/auto/core/ifcodegen/custom-template/templates/legacy-custom-test/tst_custom.h.jinja b/tests/auto/core/ifcodegen/custom-template/templates/legacy-custom-test/tst_custom.h.jinja
index 626246f2..70e1211e 100644
--- a/tests/auto/core/ifcodegen/custom-template/templates/legacy-custom-test/tst_custom.h.jinja
+++ b/tests/auto/core/ifcodegen/custom-template/templates/legacy-custom-test/tst_custom.h.jinja
@@ -4,7 +4,11 @@
# Copyright (C) 2018 Pelagicore AG
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#}
-{% include "common/generated_comment.cpp.jinja" %}
+{#
+This one is intentionally left with legacy extension to trigger the removal of
+deprecated .tpl files from templates/common in Qt 7.
+#}
+{% include "common/generated_comment.cpp.tpl" %}
#include <QTest>