aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@digia.com>2014-07-17 17:33:03 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-07-18 11:15:58 +0200
commita451094914fe3df13d68e5c131014b82a71f7b50 (patch)
tree923aafe29add2567c343c5727399e55bf2da40b7
parent22c5846e6cf12787439ea70ec7ee25b71fd82573 (diff)
fix up-to-date check wrt missing file dependencies
Missing file dependencies (e.g. header files that are not part of the project) must trigger a rebuild their dependents. Change-Id: I502e696d886c86a503e8950ae60254075f7e9415 Task-number: QBS-631 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
-rw-r--r--src/lib/corelib/buildgraph/executor.cpp7
-rw-r--r--tests/auto/blackbox/testdata/removeFileDependency/main.cpp9
-rw-r--r--tests/auto/blackbox/testdata/removeFileDependency/removeFileDependency.qbs7
-rw-r--r--tests/auto/blackbox/testdata/removeFileDependency/someheader.h1
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp11
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
6 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp
index 8371ffad9..f6066e6ec 100644
--- a/src/lib/corelib/buildgraph/executor.cpp
+++ b/src/lib/corelib/buildgraph/executor.cpp
@@ -348,6 +348,13 @@ bool Executor::isUpToDate(Artifact *artifact) const
if (!fileDependency->timestamp().isValid()) {
FileInfo fi(fileDependency->filePath());
fileDependency->setTimestamp(fi.lastModified());
+ if (!fileDependency->timestamp().isValid()) {
+ if (m_doDebug) {
+ m_logger.qbsDebug() << "[UTD] file dependency doesn't exist "
+ << fileDependency->filePath();
+ }
+ return false;
+ }
}
if (m_doDebug) {
m_logger.qbsDebug() << "[UTD] file dependency timestamp "
diff --git a/tests/auto/blackbox/testdata/removeFileDependency/main.cpp b/tests/auto/blackbox/testdata/removeFileDependency/main.cpp
new file mode 100644
index 000000000..77727cf42
--- /dev/null
+++ b/tests/auto/blackbox/testdata/removeFileDependency/main.cpp
@@ -0,0 +1,9 @@
+#include "someheader.h"
+#include <cstdio>
+
+int main()
+{
+ printf("The magic value is %d.\n", magicValue());
+ return 0;
+}
+
diff --git a/tests/auto/blackbox/testdata/removeFileDependency/removeFileDependency.qbs b/tests/auto/blackbox/testdata/removeFileDependency/removeFileDependency.qbs
new file mode 100644
index 000000000..8ed927761
--- /dev/null
+++ b/tests/auto/blackbox/testdata/removeFileDependency/removeFileDependency.qbs
@@ -0,0 +1,7 @@
+import qbs
+
+CppApplication {
+ files: ["main.cpp"]
+ // Do not reference header files here to force them to be FileDependency objects.
+}
+
diff --git a/tests/auto/blackbox/testdata/removeFileDependency/someheader.h b/tests/auto/blackbox/testdata/removeFileDependency/someheader.h
new file mode 100644
index 000000000..b895e465c
--- /dev/null
+++ b/tests/auto/blackbox/testdata/removeFileDependency/someheader.h
@@ -0,0 +1 @@
+inline int magicValue() { return 156; }
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 30cf99cd1..605582961 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -662,6 +662,17 @@ void TestBlackbox::rc()
QCOMPARE(rcFileWasCompiled, HostOsInfo::isWindowsHost());
}
+void TestBlackbox::removeFileDependency()
+{
+ QDir::setCurrent(testDataDir + "/removeFileDependency");
+ QCOMPARE(runQbs(), 0);
+ QFile::remove("someheader.h");
+ QbsRunParameters params;
+ params.expectFailure = true;
+ QVERIFY(runQbs(params) != 0);
+ QVERIFY(m_qbsStdout.contains("compiling main.cpp"));
+}
+
void TestBlackbox::renameDependency()
{
QDir::setCurrent(testDataDir + "/renameDependency");
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index c975a9815..cf3ebb146 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -147,6 +147,7 @@ private slots:
void exportWithRecursiveDepends();
void fileTagger();
void rc();
+ void removeFileDependency();
void renameDependency();
void renameProduct();
void renameTargetArtifact();