diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-23 19:00:29 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-12-03 12:09:26 +0100 |
| commit | 58ff7aa4fed5b3a27b6a859fc02f9ee27dd1a6cc (patch) | |
| tree | cd8d455066d5e9e6d14988e945f4ba421765b743 /tests/auto/qml/qmlcppcodegen/data/testlogger.js | |
| parent | c2f50cf90d143d96313ab3cfdbb9e4552a095cbb (diff) | |
Compile QML files ahead of time with qmlcachegen
qmlcachegen compiles bindings and functions to C++ as far as
QQmlJSAotCompiler can. It does respect "pragma Strict" and rejects the
file if it's violated. Furthermore, it sets up the logger to follow the
qt.qml.compiler.aot logging category. By default it's completely silent.
Compiling the examples with qmlcachegen exposes a bug in the type
resolver where it returns an invalid generic type. It should never do
that. Fix it by returning JSValue.
[ChangeLog][QtQml][Important Behavior Changes] QML bindings and
functions are now compiled to C++ by qmlcachegen, if possible. Use the
qt.qml.compiler.aot logging category to receive diagnostics about the
compilation.
Task-number: QTBUG-98305
Change-Id: I6953812c3fd20b68339617a5714fcbe16a384360
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcppcodegen/data/testlogger.js')
| -rw-r--r-- | tests/auto/qml/qmlcppcodegen/data/testlogger.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcppcodegen/data/testlogger.js b/tests/auto/qml/qmlcppcodegen/data/testlogger.js new file mode 100644 index 0000000000..77dded4e7b --- /dev/null +++ b/tests/auto/qml/qmlcppcodegen/data/testlogger.js @@ -0,0 +1,76 @@ +/****************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt JavaScript to C++ compiler. +** +** $QT_BEGIN_LICENSE:COMM$ +** +** Commercial License Usage +** Licensees holding valid commercial Qt 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. +** +** $QT_END_LICENSE$ +** +******************************************************************************/ + +.pragma library + +var testResults = null; + +function log_init_results() +{ + if (!testResults) { + testResults = { + reportedStart: false, + nextId: 0, + testCases: [] + } + } +} + +function log_register_test(name) +{ + log_init_results() + var testId = testResults.nextId++ + testResults.testCases.push(testId) + return testId +} + +function log_optional_test(testId) +{ + log_init_results() + var index = testResults.testCases.indexOf(testId) + if (index >= 0) + testResults.testCases.splice(index, 1) +} + +function log_mandatory_test(testId) +{ + log_init_results() + var index = testResults.testCases.indexOf(testId) + if (index == -1) + testResults.testCases.push(testId) +} + +function log_start_test() +{ + log_init_results() + if (testResults.reportedStart) + return false + testResults.reportedStart = true + return true +} + +function log_complete_test(testId) +{ + var index = testResults.testCases.indexOf(testId) + if (index >= 0) + testResults.testCases.splice(index, 1) + return testResults.testCases.length > 0 +} |
