diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-03-05 10:42:51 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-03-05 11:05:10 +0000 |
commit | 90a0d19462a1f781382c355fda19969b54c27e73 (patch) | |
tree | e6af4831f503f0244fe354e473dbb5fdc27c858e | |
parent | d447d42bf2684b6021ec8238f46b59dc7a31b9ce (diff) |
Qt templates: Fix detection of QtQuick compiler
In Qt 5.11, the features/qtquickcompiler.prf file is always present,
even if the QtQuick compiler is not.
Task-number: QBS-1299
Change-Id: Ibc7f925f1b1753d870ddad939fd510637c3b7642
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | doc/reference/modules/qt-quick-module.qdoc | 12 | ||||
-rw-r--r-- | src/lib/qtprofilesetup/qtenvironment.h | 1 | ||||
-rw-r--r-- | src/lib/qtprofilesetup/qtprofilesetup.cpp | 9 | ||||
-rw-r--r-- | src/lib/qtprofilesetup/templates/quick.qbs | 20 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 4 |
5 files changed, 28 insertions, 18 deletions
diff --git a/doc/reference/modules/qt-quick-module.qdoc b/doc/reference/modules/qt-quick-module.qdoc index d26c65480..8a39b92fc 100644 --- a/doc/reference/modules/qt-quick-module.qdoc +++ b/doc/reference/modules/qt-quick-module.qdoc @@ -62,7 +62,17 @@ Whether the Qt installation contains the Qt Quick compiler. - \defaultvalue Determined by \l{setup-qt}. + \defaultvalue auto-detected + \since 1.10 +*/ + +/*! + \qmlproperty bool Qt.quick::useCompiler + + Whether to make use of the Qt Quick compiler. + + \defaultvalue \l compilerAvailable + \since 1.11 */ /*! diff --git a/src/lib/qtprofilesetup/qtenvironment.h b/src/lib/qtprofilesetup/qtenvironment.h index 19b27871b..0b6ab8e51 100644 --- a/src/lib/qtprofilesetup/qtenvironment.h +++ b/src/lib/qtprofilesetup/qtenvironment.h @@ -81,7 +81,6 @@ public: Version msvcVersion; bool staticBuild = false; bool frameworkBuild = false; - bool hasQtQuickCompiler = false; }; } // namespace qbs diff --git a/src/lib/qtprofilesetup/qtprofilesetup.cpp b/src/lib/qtprofilesetup/qtprofilesetup.cpp index 63a51838c..f9feb3a58 100644 --- a/src/lib/qtprofilesetup/qtprofilesetup.cpp +++ b/src/lib/qtprofilesetup/qtprofilesetup.cpp @@ -464,11 +464,6 @@ static void replaceSpecialValues(QByteArray *content, const Profile &profile, s << indent << "property string qmlImportsPath: " << pathToJSLiteral(qtEnvironment.qmlImportPath); - if (module.qbsName == QLatin1String("quick")) { - s << endl << indent << "property bool compilerAvailable: " - << toJSLiteral(qtEnvironment.hasQtQuickCompiler); - } - const QByteArray baIndent(4, ' '); compilerDefines = "{\n" + baIndent + baIndent + "var result = " + compilerDefines + ";\n" @@ -760,10 +755,6 @@ void doSetupQtProfile(const QString &profileName, Settings *settings, Profile profile(profileName, settings); profile.removeProfile(); - if (QFileInfo::exists(qtEnvironment.mkspecBasePath - + QStringLiteral("/features/qtquickcompiler.prf"))) { - qtEnvironment.hasQtQuickCompiler = true; - } createModules(profile, settings, qtEnvironment); } diff --git a/src/lib/qtprofilesetup/templates/quick.qbs b/src/lib/qtprofilesetup/templates/quick.qbs index 539fbfee6..5b676d823 100644 --- a/src/lib/qtprofilesetup/templates/quick.qbs +++ b/src/lib/qtprofilesetup/templates/quick.qbs @@ -29,8 +29,9 @@ ****************************************************************************/ import qbs -import qbs.Process +import qbs.File import qbs.FileInfo +import qbs.Process import qbs.TextFile import '../QtModule.qbs' as QtModule import 'quick.js' as QC @@ -60,22 +61,28 @@ QtModule { cpp.includePaths: @includes@ cpp.libraryPaths: @libraryPaths@ @special_properties@ + + property string compilerFilePath: FileInfo.joinPaths(Qt.core.binPath, + "qtquickcompiler" + product.cpp.executableSuffix) + property bool compilerAvailable: File.exists(compilerFilePath); + property bool useCompiler: compilerAvailable + Scanner { - condition: compilerAvailable + condition: useCompiler inputs: 'qt.quick.qrc' searchPaths: [FileInfo.path(input.filePath)] scan: QC.scanQrc(input.filePath) } FileTagger { - condition: compilerAvailable + condition: useCompiler patterns: "*.qrc" fileTags: ["qt.quick.qrc"] priority: 100 } Rule { - condition: compilerAvailable + condition: useCompiler inputs: ["qt.quick.qrc"] Artifact { filePath: input.fileName + ".json" @@ -97,7 +104,7 @@ QtModule { } Rule { - condition: compilerAvailable + condition: useCompiler inputs: ["qt.quick.qrcinfo"] outputFileTags: ["cpp", "qrc"] multiplex: true @@ -139,8 +146,7 @@ QtModule { }); var cmds = []; - var qmlCompiler = FileInfo.joinPaths(product.Qt.core.binPath, - "qtquickcompiler" + product.cpp.executableSuffix); + var qmlCompiler = product.Qt.quick.compilerFilePath; var cmd; var loaderFlags = []; diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 26d1dbd58..3f94f564b 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -270,6 +270,10 @@ void TestBlackboxQt::quickCompiler() QCOMPARE(m_qbsStdout.contains("compiling qml_subdir_test_qml.cpp"), hasCompiler); if (doesNotHaveCompiler) QSKIP("qtquickcompiler not available"); + QCOMPARE(runQbs(QbsRunParameters(QStringList{"config:off", + "modules.Qt.quick.useCompiler:false"})), 0); + QVERIFY2(m_qbsStdout.contains("compiling"), m_qbsStdout.constData()); + QVERIFY2(!m_qbsStdout.contains("compiling qml_subdir_test_qml.cpp"), m_qbsStdout.constData()); } void TestBlackboxQt::qtScxml() |