diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-12-19 17:59:45 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-12-20 10:25:48 +0000 |
commit | f5f1f9987866931ed3eec1a87c6189a30b1a3043 (patch) | |
tree | 8561d6bd3f7f09f8eb8d03275382ae508e482711 | |
parent | 702a77528e60b084146ec9087ba028c3098ee7fd (diff) |
Fix qtquickcompiler support properly
This partially reverts 193f3f02aa. The findOutput() function was really
supposed to take a file name. The fact that file paths could come in was
due to a subtle mis-use of JavaScript's String.replace() function, of
which you (absurdly) have to use the regex variant if you want to
replace more than one occurrence.
Task-number: QBS-1261
Change-Id: I8aa90e2c008c1acd7c4a9e445954d7a4d8f2234a
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
-rw-r--r-- | src/lib/qtprofilesetup/templates/quick.js | 2 | ||||
-rw-r--r-- | src/lib/qtprofilesetup/templates/quick.qbs | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/qtprofilesetup/templates/quick.js b/src/lib/qtprofilesetup/templates/quick.js index 0ab10606b..4f3da2fb0 100644 --- a/src/lib/qtprofilesetup/templates/quick.js +++ b/src/lib/qtprofilesetup/templates/quick.js @@ -53,7 +53,7 @@ function scanQrc(qrcFilePath) { } function qtQuickCompilerOutputName(filePath) { - var str = filePath.replace('/', '_'); + var str = filePath.replace(/\//g, '_'); var i = str.lastIndexOf('.'); if (i != -1) str = str.substr(0, i) + '_' + str.substr(i + 1); diff --git a/src/lib/qtprofilesetup/templates/quick.qbs b/src/lib/qtprofilesetup/templates/quick.qbs index 8079c9af9..5358a684f 100644 --- a/src/lib/qtprofilesetup/templates/quick.qbs +++ b/src/lib/qtprofilesetup/templates/quick.qbs @@ -143,15 +143,15 @@ QtModule { var cmd; var loaderFlags = []; - function findOutput(relFilePath) { + function findOutput(fileName) { for (var k in outputs) { for (var i in outputs[k]) { - if (outputs[k][i].filePath.endsWith(relFilePath)) + if (outputs[k][i].fileName === fileName) return outputs[k][i]; } } throw new Error("Qt Quick compiler rule: Cannot find output artifact " - + relFilePath + "."); + + fileName + "."); } infos.forEach(function (info) { diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index c21924b25..e0fbc92f3 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -266,7 +266,7 @@ void TestBlackboxQt::quickCompiler() const bool hasCompiler = m_qbsStdout.contains("compiler available"); const bool doesNotHaveCompiler = m_qbsStdout.contains("compiler not available"); QVERIFY2(hasCompiler || doesNotHaveCompiler, m_qbsStdout.constData()); - QCOMPARE(m_qbsStdout.contains("compiling test_qml.cpp"), hasCompiler); + QCOMPARE(m_qbsStdout.contains("compiling qml_subdir_test_qml.cpp"), hasCompiler); if (doesNotHaveCompiler) QSKIP("qtquickcompiler not available"); } |