From 4a59a7d714bdfdf54e279d6dc8de11383fff7ccd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 25 Oct 2016 21:24:34 +0200 Subject: [PATCH] remove duplicate resolution of sources from cumulative pass instead of resolving all sources both in the exact and the cumulative pass and de-duplicating the joined list in the end, resolve only these files from the cumulative pass which are unique to it to start with. Change-Id: Ie3327799ecd94f8710f8b99bcc46998790ba2c74 Reviewed-by: Tobias Hunger --- src/plugins/qmakeprojectmanager/qmakenodes.cpp | 9 ++++----- src/shared/proparser/profileevaluator.cpp | 7 ++++++- src/shared/proparser/profileevaluator.h | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 994431c24f6..9f20ebeead4 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -1934,18 +1934,19 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) FileType type = fileTypes.at(i).type; QStringList qmakeVariables = varNames(type, exactReader); foreach (const QString &qmakeVariable, qmakeVariables) { + QHash handled; if (result->state == EvalResult::EvalOk) { QStringList vPathsExact = fullVPaths( baseVPathsExact, exactReader, qmakeVariable, input.projectDir); auto sourceFiles = exactReader->absoluteFileValues( - qmakeVariable, input.projectDir, vPathsExact); + qmakeVariable, input.projectDir, vPathsExact, &handled); exactSourceFiles[qmakeVariable] = sourceFiles; extractSources(proToResult, &result->includedFiles.result, sourceFiles, type); } QStringList vPathsCumulative = fullVPaths( baseVPathsCumulative, cumulativeReader, qmakeVariable, input.projectDir); auto sourceFiles = cumulativeReader->absoluteFileValues( - qmakeVariable, input.projectDir, vPathsCumulative); + qmakeVariable, input.projectDir, vPathsCumulative, &handled); cumulativeSourceFiles[qmakeVariable] = sourceFiles; extractSources(proToResult, &result->includedFiles.result, sourceFiles, type); } @@ -1962,15 +1963,13 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) result->newVarValues[IncludePathVar] = includePaths(exactReader, input.sysroot, input.buildDirectory, input.projectDir); result->newVarValues[CppFlagsVar] = exactReader->values(QLatin1String("QMAKE_CXXFLAGS")); - QStringList allSources = + result->newVarValues[SourceVar] = fileListForVar(exactSourceFiles, QLatin1String("SOURCES")) + fileListForVar(cumulativeSourceFiles, QLatin1String("SOURCES")) + fileListForVar(exactSourceFiles, QLatin1String("HEADERS")) + fileListForVar(cumulativeSourceFiles, QLatin1String("HEADERS")) + fileListForVar(exactSourceFiles, QLatin1String("OBJECTIVE_HEADERS")) + fileListForVar(cumulativeSourceFiles, QLatin1String("OBJECTIVE_HEADERS")); - allSources.removeDuplicates(); - result->newVarValues[SourceVar] = allSources; result->newVarValues[UiDirVar] = QStringList() << uiDirPath(exactReader, input.buildDirectory); result->newVarValues[HeaderExtensionVar] = QStringList() << exactReader->value(QLatin1String("QMAKE_EXT_H")); result->newVarValues[CppExtensionVar] = QStringList() << exactReader->value(QLatin1String("QMAKE_EXT_CPP")); diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 2c179a2584a..3124b273319 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -120,11 +120,16 @@ QStringList ProFileEvaluator::absolutePathValues( } QVector ProFileEvaluator::absoluteFileValues( - const QString &variable, const QString &baseDirectory, const QStringList &searchDirs) const + const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, + QHash *handled) const { QMakeVfs::VfsFlags flags = (d->m_cumulative ? QMakeVfs::VfsCumulative : QMakeVfs::VfsExact); QVector result; foreach (const ProString &str, d->values(ProKey(variable))) { + bool &seen = (*handled)[str]; + if (seen) + continue; + seen = true; const QString &el = d->m_option->expandEnvVars(str.toQString()); QString absEl; if (IoUtils::isAbsolutePath(el)) { diff --git a/src/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h index c6d4a79cfae..a356dadaf7a 100644 --- a/src/shared/proparser/profileevaluator.h +++ b/src/shared/proparser/profileevaluator.h @@ -85,7 +85,8 @@ public: const QString &variable, const QString &baseDirectory, const QString &buildDirectory) const; QStringList absolutePathValues(const QString &variable, const QString &baseDirectory) const; QVector absoluteFileValues( - const QString &variable, const QString &baseDirectory, const QStringList &searchDirs) const; + const QString &variable, const QString &baseDirectory, const QStringList &searchDirs, + QHash *handled) const; QString propertyValue(const QString &val) const; private: