forked from qt-creator/qt-creator
Qmake: Add some debug output for file add/remove operations
This will help collecting feedback from users affected by bugs. Task-number: QTCREATORBUG-22508 Change-Id: Idfc22245587dd2d71b229b4ab6c7562fb7a5ecfc Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -217,6 +217,9 @@ bool QmakeBuildSystem::addFiles(Node *context, const QStringList &filePaths, QSt
|
|||||||
actualFilePaths.removeOne(e);
|
actualFilePaths.removeOne(e);
|
||||||
if (notAdded)
|
if (notAdded)
|
||||||
*notAdded = alreadyPresentFiles;
|
*notAdded = alreadyPresentFiles;
|
||||||
|
qCDebug(qmakeNodesLog) << Q_FUNC_INFO << "file paths:" << filePaths
|
||||||
|
<< "already present:" << alreadyPresentFiles
|
||||||
|
<< "actual file paths:" << actualFilePaths;
|
||||||
return pri->addFiles(actualFilePaths, notAdded);
|
return pri->addFiles(actualFilePaths, notAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ uint qHash(FileOrigin fo) { return ::qHash(int(fo)); }
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(qmakeNodesLog, "qtc.qmake.nodes", QtWarningMsg)
|
||||||
|
|
||||||
class QmakeEvalInput
|
class QmakeEvalInput
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -901,6 +903,8 @@ void QmakePriFile::changeFiles(const QString &mimeType,
|
|||||||
if (!includeFile)
|
if (!includeFile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
qCDebug(qmakeNodesLog) << Q_FUNC_INFO << "mime type:" << mimeType << "file paths:"
|
||||||
|
<< filePaths << "change type:" << int(change) << "mode:" << int(mode);
|
||||||
if (change == AddToProFile) {
|
if (change == AddToProFile) {
|
||||||
// Use the first variable for adding.
|
// Use the first variable for adding.
|
||||||
ProWriter::addFiles(includeFile, &lines, filePaths, varNameForAdding(mimeType),
|
ProWriter::addFiles(includeFile, &lines, filePaths, varNameForAdding(mimeType),
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@@ -108,6 +109,7 @@ enum class Variable {
|
|||||||
uint qHash(Variable key, uint seed = 0);
|
uint qHash(Variable key, uint seed = 0);
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(qmakeNodesLog)
|
||||||
class QmakeEvalInput;
|
class QmakeEvalInput;
|
||||||
class QmakeEvalResult;
|
class QmakeEvalResult;
|
||||||
class QmakePriFileEvalResult;
|
class QmakePriFileEvalResult;
|
||||||
|
|||||||
@@ -30,9 +30,12 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QLoggingCategory>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(prowriterLog, "qtc.prowriter", QtWarningMsg)
|
||||||
|
|
||||||
using namespace QmakeProjectManager::Internal;
|
using namespace QmakeProjectManager::Internal;
|
||||||
|
|
||||||
static uint getBlockLen(const ushort *&tokPtr)
|
static uint getBlockLen(const ushort *&tokPtr)
|
||||||
@@ -309,6 +312,9 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
|
|||||||
const QString &var, PutFlags flags, const QString &scope,
|
const QString &var, PutFlags flags, const QString &scope,
|
||||||
const QString &continuationIndent)
|
const QString &continuationIndent)
|
||||||
{
|
{
|
||||||
|
qCDebug(prowriterLog) << Q_FUNC_INFO << "lines:" << *lines << "values:" << values
|
||||||
|
<< "var:" << var << "flags:" << int(flags) << "scope:" << scope
|
||||||
|
<< "indent:" << continuationIndent;
|
||||||
const QString indent = scope.isEmpty() ? QString() : continuationIndent;
|
const QString indent = scope.isEmpty() ? QString() : continuationIndent;
|
||||||
const auto effectiveContIndent = [indent, continuationIndent](const ContinuationInfo &ci) {
|
const auto effectiveContIndent = [indent, continuationIndent](const ContinuationInfo &ci) {
|
||||||
return !ci.indent.isEmpty() ? ci.indent : continuationIndent + indent;
|
return !ci.indent.isEmpty() ? ci.indent : continuationIndent + indent;
|
||||||
@@ -325,10 +331,12 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
|
|||||||
if (eqs >= 0) // If this is not true, we mess up the file a bit.
|
if (eqs >= 0) // If this is not true, we mess up the file a bit.
|
||||||
line.truncate(eqs + 1);
|
line.truncate(eqs + 1);
|
||||||
// put new values
|
// put new values
|
||||||
|
qCDebug(prowriterLog) << 1 << "old line value:" << line;
|
||||||
for (const QString &v : values) {
|
for (const QString &v : values) {
|
||||||
line += ((flags & MultiLine) ? QString(" \\\n") + effectiveContIndent(contInfo)
|
line += ((flags & MultiLine) ? QString(" \\\n") + effectiveContIndent(contInfo)
|
||||||
: QString(" ")) + v;
|
: QString(" ")) + v;
|
||||||
}
|
}
|
||||||
|
qCDebug(prowriterLog) << "new line value:" << line;
|
||||||
} else {
|
} else {
|
||||||
const ContinuationInfo contInfo = skipContLines(lines, lineNo, false);
|
const ContinuationInfo contInfo = skipContLines(lines, lineNo, false);
|
||||||
int endLineNo = contInfo.lineNo;
|
int endLineNo = contInfo.lineNo;
|
||||||
@@ -343,6 +351,8 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
|
|||||||
} else {
|
} else {
|
||||||
newLine += " \\";
|
newLine += " \\";
|
||||||
}
|
}
|
||||||
|
qCDebug(prowriterLog) << 2 << "adding new line" << newLine
|
||||||
|
<< "at line " << curLineNo;
|
||||||
lines->insert(curLineNo, newLine);
|
lines->insert(curLineNo, newLine);
|
||||||
++endLineNo;
|
++endLineNo;
|
||||||
}
|
}
|
||||||
@@ -360,8 +370,10 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
|
|||||||
const QRegularExpression rx("\\A(\\s*" + scope + "\\s*:\\s*)[^\\s{].*\\z");
|
const QRegularExpression rx("\\A(\\s*" + scope + "\\s*:\\s*)[^\\s{].*\\z");
|
||||||
const QRegularExpressionMatch match(rx.match(lines->at(scopeStart)));
|
const QRegularExpressionMatch match(rx.match(lines->at(scopeStart)));
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
|
qCDebug(prowriterLog) << 3 << "old line value:" << (*lines)[scopeStart];
|
||||||
(*lines)[scopeStart].replace(0, match.captured(1).length(),
|
(*lines)[scopeStart].replace(0, match.captured(1).length(),
|
||||||
scope + " {\n" + continuationIndent);
|
scope + " {\n" + continuationIndent);
|
||||||
|
qCDebug(prowriterLog) << "new line value:" << (*lines)[scopeStart];
|
||||||
contInfo = skipContLines(lines, scopeStart, false);
|
contInfo = skipContLines(lines, scopeStart, false);
|
||||||
lNo = contInfo.lineNo;
|
lNo = contInfo.lineNo;
|
||||||
scopeStart = -1;
|
scopeStart = -1;
|
||||||
@@ -395,6 +407,7 @@ void ProWriter::putVarValues(ProFile *profile, QStringList *lines, const QString
|
|||||||
}
|
}
|
||||||
if (!scope.isEmpty() && scopeStart < 0)
|
if (!scope.isEmpty() && scopeStart < 0)
|
||||||
added += "\n}";
|
added += "\n}";
|
||||||
|
qCDebug(prowriterLog) << 4 << "adding" << added << "at line" << lNo;
|
||||||
lines->insert(lNo, added);
|
lines->insert(lNo, added);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user