forked from qt-creator/qt-creator
make VFS aware of exact vs. cumulative evaluation
the cumulative evaluation has a good chance to make a mess of the virtual file contents created by the exact parsing, so better contain it to its own namespace. the ProFile cache also needs to keep the files separate. this specifically addresses the side issue discussed in QTCREATORBUG-10779. it also fixes attempts to deploy the wrong build when the variant is selected through a cache file, as in QTCREATORBUG-15815. in the project explorer, we don't track from which evaluation pass particular files came from, so we try the cumulative first to get the most contents, and fall back to the exact one if the former file is empty (or does not exist at all). Task-number: QTCREATORBUG-15815 Change-Id: I2c1eb16c97526fa275a1c6a2eae9266d385859ac Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -581,7 +581,12 @@ struct InternalNode
|
||||
foreach (const FileName &file, resourcesToAdd) {
|
||||
auto vfs = static_cast<QmakePriFileNode *>(folder->projectNode())->m_project->qmakeVfs();
|
||||
QString contents;
|
||||
vfs->readVirtualFile(file.toString(), &contents);
|
||||
// Prefer the cumulative file if it's non-empty, based on the assumption
|
||||
// that it contains more "stuff".
|
||||
vfs->readVirtualFile(file.toString(), QMakeVfs::VfsCumulative, &contents);
|
||||
// If the cumulative evaluation botched the file too much, try the exact one.
|
||||
if (contents.isEmpty())
|
||||
vfs->readVirtualFile(file.toString(), QMakeVfs::VfsExact, &contents);
|
||||
nodesToAdd.append(new ResourceEditor::ResourceTopLevelNode(file, contents, folder));
|
||||
}
|
||||
|
||||
@@ -1953,10 +1958,10 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input)
|
||||
result->newVarValues[HeaderExtensionVar] = QStringList() << input.readerExact->value(QLatin1String("QMAKE_EXT_H"));
|
||||
result->newVarValues[CppExtensionVar] = QStringList() << input.readerExact->value(QLatin1String("QMAKE_EXT_CPP"));
|
||||
result->newVarValues[MocDirVar] = QStringList() << mocDirPath(input.readerExact, input.buildDirectory);
|
||||
result->newVarValues[ResourceVar] = fileListForVar(input.readerExact, input.readerCumulative,
|
||||
QLatin1String("RESOURCES"), input.projectDir, input.buildDirectory);
|
||||
result->newVarValues[ExactResourceVar] = fileListForVar(input.readerExact, 0,
|
||||
QLatin1String("RESOURCES"), input.projectDir, input.buildDirectory);
|
||||
result->newVarValues[CumulativeResourceVar] = fileListForVar(input.readerCumulative, 0,
|
||||
QLatin1String("RESOURCES"), input.projectDir, input.buildDirectory);
|
||||
result->newVarValues[PkgConfigVar] = input.readerExact->values(QLatin1String("PKGCONFIG"));
|
||||
result->newVarValues[PrecompiledHeaderVar] = input.readerExact->fixifiedValues(
|
||||
QLatin1String("PRECOMPILED_HEADER"), input.projectDir, input.buildDirectory);
|
||||
|
||||
Reference in New Issue
Block a user