qdbusxml2cpp: Use the mtime on the input XML to avoid needless source changes.

These can cause rebuilds unnecessarily when repeatedly running qdbusxml2cpp.

Change-Id: I902954d4bed6fe68802183e51d82700fe30af437
Reviewed-by: Mathias Hasselmann <mathias.hasselmann@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Robin Burchell 2013-11-28 11:37:11 +01:00 committed by The Qt Project
parent c6cf7520ec
commit 2a76ef7e99

View File

@ -43,6 +43,7 @@
#include <qdatetime.h>
#include <qdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qtextstream.h>
@ -65,6 +66,7 @@ static QString parentClassName;
static QString proxyFile;
static QString adaptorFile;
static QString inputFile;
static QDateTime classCreationTime;
static bool skipNamespaces;
static bool verbose;
static bool includeMocs;
@ -216,10 +218,13 @@ static void parseCmdLine(QStringList args)
static QDBusIntrospection::Interfaces readInput()
{
QFile input(inputFile);
if (inputFile.isEmpty() || inputFile == QLatin1String("-"))
if (inputFile.isEmpty() || inputFile == QLatin1String("-")) {
input.open(stdin, QIODevice::ReadOnly);
else
classCreationTime = QDateTime::currentDateTime();
} else {
input.open(QIODevice::ReadOnly);
classCreationTime = QFileInfo(input).lastModified();
}
QByteArray data = input.readAll();
@ -556,7 +561,7 @@ static void writeProxy(const QString &filename, const QDBusIntrospection::Interf
}
includeGuard = QString(QLatin1String("%1_%2"))
.arg(includeGuard)
.arg(QDateTime::currentDateTime().toTime_t());
.arg(classCreationTime.toTime_t());
hs << "#ifndef " << includeGuard << endl
<< "#define " << includeGuard << endl
<< endl;