forked from qt-creator/qt-creator
QmakeProjectManager: Compare the right set of arguments
... when determining whether to re-run qmake. We need to look at the effective arguments, not the user arguments. Of course, the whole approach is still a shaky heuristic, but it should be more correct now than it was before. Fixes: QTCREATORBUG-24538 Change-Id: I763f8095becacde0f9549890161b8a47c6344b6b Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -126,13 +126,12 @@ void dumpQMakeAssignments(const QList<QMakeAssignment> &list)
|
||||
}
|
||||
}
|
||||
|
||||
void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments)
|
||||
QList<QMakeAssignment> MakeFileParse::parseAssignments(const QList<QMakeAssignment> &assignments)
|
||||
{
|
||||
bool foundSeparateDebugInfo = false;
|
||||
bool foundForceDebugInfo = false;
|
||||
QList<QMakeAssignment> oldAssignments = *assignments;
|
||||
assignments->clear();
|
||||
foreach (const QMakeAssignment &qa, oldAssignments) {
|
||||
QList<QMakeAssignment> filteredAssignments;
|
||||
foreach (const QMakeAssignment &qa, assignments) {
|
||||
if (qa.variable == QLatin1String("CONFIG")) {
|
||||
QStringList values = qa.value.split(QLatin1Char(' '));
|
||||
QStringList newValues;
|
||||
@@ -218,10 +217,10 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments)
|
||||
if (!newValues.isEmpty()) {
|
||||
QMakeAssignment newQA = qa;
|
||||
newQA.value = newValues.join(QLatin1Char(' '));
|
||||
assignments->append(newQA);
|
||||
filteredAssignments.append(newQA);
|
||||
}
|
||||
} else {
|
||||
assignments->append(qa);
|
||||
filteredAssignments.append(qa);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,15 +232,16 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments)
|
||||
newQA.variable = QLatin1String("CONFIG");
|
||||
newQA.op = QLatin1String("+=");
|
||||
newQA.value = QLatin1String("force_debug_info");
|
||||
assignments->append(newQA);
|
||||
filteredAssignments.append(newQA);
|
||||
} else if (foundSeparateDebugInfo) {
|
||||
// Found only separate_debug_info, so readd it
|
||||
QMakeAssignment newQA;
|
||||
newQA.variable = QLatin1String("CONFIG");
|
||||
newQA.op = QLatin1String("+=");
|
||||
newQA.value = QLatin1String("separate_debug_info");
|
||||
assignments->append(newQA);
|
||||
filteredAssignments.append(newQA);
|
||||
}
|
||||
return filteredAssignments;
|
||||
}
|
||||
|
||||
static FilePath findQMakeBinaryFromMakefile(const QString &makefile)
|
||||
@@ -270,7 +270,7 @@ static FilePath findQMakeBinaryFromMakefile(const QString &makefile)
|
||||
return FilePath();
|
||||
}
|
||||
|
||||
MakeFileParse::MakeFileParse(const QString &makefile)
|
||||
MakeFileParse::MakeFileParse(const QString &makefile, Mode mode) : m_mode(mode)
|
||||
{
|
||||
qCDebug(logging()) << "Parsing makefile" << makefile;
|
||||
if (!QFileInfo::exists(makefile)) {
|
||||
@@ -367,9 +367,9 @@ void MakeFileParse::parseCommandLine(const QString &command, const QString &proj
|
||||
dumpQMakeAssignments(assignments);
|
||||
|
||||
// Filter out CONFIG arguments we know into m_qmakeBuildConfig and m_config
|
||||
parseAssignments(&assignments);
|
||||
const QList<QMakeAssignment> filteredAssignments = parseAssignments(assignments);
|
||||
qCDebug(logging()) << " After parsing";
|
||||
dumpQMakeAssignments(assignments);
|
||||
dumpQMakeAssignments(filteredAssignments);
|
||||
|
||||
qCDebug(logging()) << " Explicit Debug" << m_qmakeBuildConfig.explicitDebug;
|
||||
qCDebug(logging()) << " Explicit Release" << m_qmakeBuildConfig.explicitRelease;
|
||||
@@ -385,7 +385,9 @@ void MakeFileParse::parseCommandLine(const QString &command, const QString &proj
|
||||
<< (m_config.separateDebugInfo == TriState::Enabled);
|
||||
|
||||
// Create command line of all unfiltered arguments
|
||||
foreach (const QMakeAssignment &qa, assignments)
|
||||
const QList<QMakeAssignment> &assignmentsToUse = m_mode == Mode::FilterKnownConfigValues
|
||||
? filteredAssignments : assignments;
|
||||
foreach (const QMakeAssignment &qa, assignmentsToUse)
|
||||
QtcProcess::addArg(&m_unparsedArguments, qa.variable + qa.op + qa.value);
|
||||
if (!afterAssignments.isEmpty()) {
|
||||
QtcProcess::addArg(&m_unparsedArguments, QLatin1String("-after"));
|
||||
@@ -517,7 +519,7 @@ void QmakeProjectManagerPlugin::testMakefileParser()
|
||||
QFETCH(bool, separateDebugInfo);
|
||||
QFETCH(int, effectiveBuildConfig);
|
||||
|
||||
MakeFileParse parser("/tmp/something");
|
||||
MakeFileParse parser("/tmp/something", MakeFileParse::Mode::FilterKnownConfigValues);
|
||||
parser.parseCommandLine(command, project);
|
||||
|
||||
QCOMPARE(Utils::QtcProcess::splitArgs(parser.unparsedArguments()),
|
||||
|
||||
Reference in New Issue
Block a user