aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-06-22 12:43:02 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-06-22 12:30:08 +0000
commit841b23fc51eb0961bdc1feabbe7d575fad220362 (patch)
tree685efe85f254971b410bdf1363d620eace2cf22e
parentda6c0e50588f08e4650f3a335310509e6be5fecd (diff)
Fix rule input tags in the Exporter modules
We need to make sure all the artifacts are present in the build graph before writing the respective interface file, but we don't need to rewrite it if these artifacts are rebuilt. So use auxiliaryInputs instead of inputs. Change-Id: I82dee65f6630a0bbd24245df9100e4dabf0320f2 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs7
-rw-r--r--share/qbs/modules/Exporter/qbs/qbsexporter.qbs4
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp26
3 files changed, 31 insertions, 6 deletions
diff --git a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs
index 5fbda2bf4..aecad6126 100644
--- a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs
+++ b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs
@@ -32,11 +32,8 @@ Module {
requiresInputs: false
// Make sure all relevant library artifacts have been created by the time we run.
- inputsFromDependencies: autoDetect
- ? ["Exporter.pkgconfig.pc", "staticlibrary", "dynamiclibrary"]
- : []
- inputs: {
- if (!product.Exporter.pkgconfig.autoDetect)
+ auxiliaryInputs: {
+ if (!autoDetect)
return undefined;
if (product.type.contains("staticlibrary"))
return ["staticlibrary"];
diff --git a/share/qbs/modules/Exporter/qbs/qbsexporter.qbs b/share/qbs/modules/Exporter/qbs/qbsexporter.qbs
index 6cdc55891..351edfefe 100644
--- a/share/qbs/modules/Exporter/qbs/qbsexporter.qbs
+++ b/share/qbs/modules/Exporter/qbs/qbsexporter.qbs
@@ -49,7 +49,9 @@ Module {
requiresInputs: false
// Make sure we only run when all other artifacts are already present.
- inputs: product.type.filter(function(t) { return t !== "Exporter.qbs.module"; })
+ // TODO: This also matches target artifacts in dependencies. Should not hurt,
+ // but might be a hint that we should have auxiliaryInputsFromDependencies.
+ auxiliaryInputs: product.type.filter(function(t) { return t !== "Exporter.qbs.module"; })
Artifact {
filePath: product.Exporter.qbs.fileName
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 83c00fa2f..f9033ed09 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -3365,6 +3365,8 @@ void TestBlackbox::exportsPkgconfig()
{
QDir::setCurrent(testDataDir + "/exports-pkgconfig");
QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.contains("Creating TheFirstLib.pc"), m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.contains("Creating TheSecondLib.pc"), m_qbsStdout.constData());
QFile sourcePcFile(HostOsInfo::isWindowsHost() ? "TheFirstLib_windows.pc" : "TheFirstLib.pc");
QString generatedPcFilePath = relativeProductBuildDir("TheFirstLib") + "/TheFirstLib.pc";
QFile generatedPcFile(generatedPcFilePath);
@@ -3379,6 +3381,12 @@ void TestBlackbox::exportsPkgconfig()
QVERIFY2(sourcePcFile.open(QIODevice::ReadOnly), qPrintable(sourcePcFile.errorString()));
QVERIFY2(generatedPcFile.open(QIODevice::ReadOnly), qPrintable(generatedPcFile.errorString()));
QCOMPARE(generatedPcFile.readAll(), sourcePcFile.readAll());
+ WAIT_FOR_NEW_TIMESTAMP();
+ touch("firstlib.cpp");
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.contains("linking"), m_qbsStdout.constData());
+ QVERIFY2(!m_qbsStdout.contains("Creating TheFirstLib.pc"), m_qbsStdout.constData());
+ QVERIFY2(!m_qbsStdout.contains("Creating TheSecondLib.pc"), m_qbsStdout.constData());
}
void TestBlackbox::exportsQbs()
@@ -3431,6 +3439,24 @@ void TestBlackbox::exportsQbs()
QCOMPARE(runQbs(QStringList({"-p", "MyTool"})), 0);
QVERIFY2(!m_qbsStdout.contains("Creating MyTool.qbs"), m_qbsStdout.constData());
+ // Rebuilding the target binary should not cause recreating the module file.
+ WAIT_FOR_NEW_TIMESTAMP();
+ touch("mylib.cpp");
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.count("linking") >= 2, m_qbsStdout.constData());
+ QVERIFY2(!m_qbsStdout.contains("Creating MyLib"), m_qbsStdout.constData());
+ QVERIFY2(!m_qbsStdout.contains("Creating MyTool.qbs"), m_qbsStdout.constData());
+
+ // Changing a setting that influences the name of a target artifact should cause
+ // recreating the module file.
+ const QbsRunParameters resolveParams("resolve", QStringList{"-f", "exports-qbs.qbs",
+ "modules.cpp.dynamicLibrarySuffix:blubb"});
+ QCOMPARE(runQbs(resolveParams), 0);
+ QCOMPARE(runQbs(), 0);
+ QVERIFY2(m_qbsStdout.count("linking") >= 2, m_qbsStdout.constData());
+ QVERIFY2(m_qbsStdout.count("Creating MyLib") == 2, m_qbsStdout.constData());
+ QVERIFY2(!m_qbsStdout.contains("Creating MyTool.qbs"), m_qbsStdout.constData());
+
// Change tracking for accesses to product.exports (positive).
WAIT_FOR_NEW_TIMESTAMP();
REPLACE_IN_FILE("tool.qbs", "product.toolTags", "[]");