diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-02-14 14:14:20 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-02-15 09:24:24 +0000 |
commit | 229a889342de306a51fb6c13787708085f631e03 (patch) | |
tree | 6659af3c7a085ccc8f763803228bffa1c975356c /tests | |
parent | 63535355c257fb7d7283db0797068a5df451865b (diff) |
Fix connection to rules of dependencies
... for the case that auxiliaryInputs or explicitlyDependsOn contains
"installable". They must be considered in addition to
inputsFromDependencies, because they also match target artifacts of
dependencies.
Change-Id: Ib960001a8e67034d6d1382bacc385bdcd9ddfb99
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
3 files changed, 86 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs b/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs new file mode 100644 index 000000000..822473157 --- /dev/null +++ b/tests/auto/blackbox/testdata/installable-as-auxiliary-input/installable-as-auxiliary-input.qbs @@ -0,0 +1,78 @@ +import qbs +import qbs.File +import qbs.FileInfo +import qbs.TextFile + +Project { + name: "p" + CppApplication { + name: "app" + Depends { name: "installed-header" } + Rule { + multiplex: true + auxiliaryInputs: ["installable"] + Artifact { filePath: "main.cpp"; fileTags: "cpp" } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "creating " + output.fileName; + cmd.sourceCode = function() { + var f = new TextFile(output.filePath, TextFile.WriteOnly); + f.writeLine("#include <theheader.h>"); + f.writeLine("int main() {"); + f.writeLine(" f();"); + f.writeLine("}"); + f.close(); + }; + return cmd; + } + } + } + + Product { + name: "installed-header" + type: ["header"] + + property string installDir: "include" + + Group { + fileTagsFilter: "header" + qbs.install: true + qbs.installDir: installDir + } + + Export { + Depends { name: "cpp" } + cpp.includePaths: FileInfo.joinPaths(qbs.installRoot, product.installDir); + } + + Rule { + multiplex: true + Artifact { filePath: "theheader.h.in"; fileTags: "header.in" } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Creating " + output.fileName; + cmd.sourceCode = function() { + for (var i = 0; i < 1000; ++i) { // Artificial delay. + var file = new TextFile(output.filePath, TextFile.WriteOnly); + file.writeLine("#include <iostream>"); + file.writeLine("inline void f() {"); + file.writeLine(' std::cout << "f-impl" << std::endl;'); + file.writeLine("}"); + file.close(); + } + }; + return [cmd]; + } + } + Rule { + inputs: "header.in" + Artifact { filePath: "theheader.h"; fileTags: "header" } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Creating " + output.fileName; + cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); }; + return [cmd]; + } + } + } +} diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index 8c3673c41..a4da8cd2f 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -3377,6 +3377,13 @@ void TestBlackbox::installable() QCOMPARE(installList.readAll().count('\n'), 2); } +void TestBlackbox::installableAsAuxiliaryInput() +{ + QDir::setCurrent(testDataDir + "/installable-as-auxiliary-input"); + QCOMPARE(runQbs(QbsRunParameters("run")), 0); + QVERIFY2(m_qbsStdout.contains("f-impl"), m_qbsStdout.constData()); +} + void TestBlackbox::installTree() { QDir::setCurrent(testDataDir + "/install-tree"); diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h index 89807ce1e..9cf76ab5a 100644 --- a/tests/auto/blackbox/tst_blackbox.h +++ b/tests/auto/blackbox/tst_blackbox.h @@ -113,6 +113,7 @@ private slots: void innoSetupDependencies(); void inputsFromDependencies(); void installable(); + void installableAsAuxiliaryInput(); void installedApp(); void installDuplicates(); void installDuplicatesNoError(); |