Commit 49564401 authored by Christian Kandeler's avatar Christian Kandeler Committed by con
Browse files

Maemo: Fix logic deciding on package rebuilding.

The time stamp check must descend into directories.

Task-number: QTCREATORBUG-2920
Reviewed-by: con
parent c4a8e6da
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#include <qt4project.h> #include <qt4project.h>
#include <qt4target.h> #include <qt4target.h>
#include <QtCore/QDateTime>
#include <QtCore/QProcess> #include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment> #include <QtCore/QProcessEnvironment>
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
...@@ -401,9 +402,8 @@ bool MaemoPackageCreationStep::packagingNeeded() const ...@@ -401,9 +402,8 @@ bool MaemoPackageCreationStep::packagingNeeded() const
const int deployableCount = deployables->deployableCount(); const int deployableCount = deployables->deployableCount();
for (int i = 0; i < deployableCount; ++i) { for (int i = 0; i < deployableCount; ++i) {
if (packageInfo.lastModified() if (isFileNewerThan(deployables->deployableAt(i).localFilePath,
<= QFileInfo(deployables->deployableAt(i).localFilePath) packageInfo.lastModified()))
.lastModified())
return true; return true;
} }
...@@ -423,6 +423,25 @@ bool MaemoPackageCreationStep::packagingNeeded() const ...@@ -423,6 +423,25 @@ bool MaemoPackageCreationStep::packagingNeeded() const
return false; return false;
} }
bool MaemoPackageCreationStep::isFileNewerThan(const QString &filePath,
const QDateTime &timeStamp) const
{
QFileInfo fileInfo(filePath);
if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp)
return true;
if (fileInfo.isDir()) {
const QStringList dirContents = QDir(filePath)
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QString &curFileName, dirContents) {
const QString curFilePath
= filePath + QLatin1Char('/') + curFileName;
if (isFileNewerThan(curFilePath, timeStamp))
return true;
}
}
return false;
}
QString MaemoPackageCreationStep::packageFilePath() const QString MaemoPackageCreationStep::packageFilePath() const
{ {
QString error; QString error;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <projectexplorer/buildstep.h> #include <projectexplorer/buildstep.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QDateTime;
class QFile; class QFile;
class QProcess; class QProcess;
QT_END_NAMESPACE QT_END_NAMESPACE
...@@ -112,6 +113,8 @@ private: ...@@ -112,6 +113,8 @@ private:
QString targetRoot() const; QString targetRoot() const;
static QString nativePath(const QFile &file); static QString nativePath(const QFile &file);
bool packagingNeeded() const; bool packagingNeeded() const;
bool isFileNewerThan(const QString &filePath,
const QDateTime &timeStamp) const;
void raiseError(const QString &shortMsg, void raiseError(const QString &shortMsg,
const QString &detailedMsg = QString()); const QString &detailedMsg = QString());
QString buildDirectory() const; QString buildDirectory() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment