Qmake: Switch back to old way of collecting deployment info

Apparently, there are subtle differences between traversing the nodes
and directly looking at the QmakeProFile children. I'm not quite sure
what they are, so let's go back to the old implementation for now, which
fixes the reported crash.
This partially reverts ccd5955843.

Fixes: QTCREATORBUG-22124
Change-Id: I35a3c20bb09666e8c3af797ebd88761141b7db10
Reviewed-by: Steve Mokris <smokris@softpixel.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-03-14 16:00:50 +01:00
parent ed43e6d99f
commit 7c69460702
2 changed files with 17 additions and 21 deletions

View File

@@ -984,7 +984,7 @@ void QmakeProject::updateBuildSystemData()
return; return;
DeploymentData deploymentData; DeploymentData deploymentData;
collectData(rootProjectNode(), deploymentData); collectData(file, deploymentData);
target->setDeploymentData(deploymentData); target->setDeploymentData(deploymentData);
BuildTargetInfoList appTargetList; BuildTargetInfoList appTargetList;
@@ -1025,7 +1025,7 @@ void QmakeProject::updateBuildSystemData()
workingDir += '/' + ti.target + ".app/Contents/MacOS"; workingDir += '/' + ti.target + ".app/Contents/MacOS";
BuildTargetInfo bti; BuildTargetInfo bti;
bti.targetFilePath = FileName::fromString(executableFor(node)); bti.targetFilePath = FileName::fromString(executableFor(node->proFile()));
bti.projectFilePath = node->filePath(); bti.projectFilePath = node->filePath();
bti.workingDirectory = FileName::fromString(workingDir); bti.workingDirectory = FileName::fromString(workingDir);
bti.displayName = bti.projectFilePath.toFileInfo().completeBaseName(); bti.displayName = bti.projectFilePath.toFileInfo().completeBaseName();
@@ -1077,9 +1077,8 @@ void QmakeProject::updateBuildSystemData()
target->setApplicationTargets(appTargetList); target->setApplicationTargets(appTargetList);
} }
void QmakeProject::collectData(const QmakeProFileNode *node, DeploymentData &deploymentData) void QmakeProject::collectData(const QmakeProFile *file, DeploymentData &deploymentData)
{ {
QmakeProFile *file = node->proFile();
if (!file->isSubProjectDeployable(file->filePath())) if (!file->isSubProjectDeployable(file->filePath()))
return; return;
@@ -1094,31 +1093,29 @@ void QmakeProject::collectData(const QmakeProFileNode *node, DeploymentData &dep
switch (file->projectType()) { switch (file->projectType()) {
case ProjectType::ApplicationTemplate: case ProjectType::ApplicationTemplate:
if (!installsList.targetPath.isEmpty()) if (!installsList.targetPath.isEmpty())
collectApplicationData(node, deploymentData); collectApplicationData(file, deploymentData);
break; break;
case ProjectType::SharedLibraryTemplate: case ProjectType::SharedLibraryTemplate:
case ProjectType::StaticLibraryTemplate: case ProjectType::StaticLibraryTemplate:
collectLibraryData(file, deploymentData); collectLibraryData(file, deploymentData);
break; break;
case ProjectType::SubDirsTemplate: case ProjectType::SubDirsTemplate:
node->forEachNode({}, [this, &deploymentData](Node *subNode) { for (const QmakePriFile *const subPriFile : file->subPriFilesExact()) {
if (auto subProject = dynamic_cast<QmakeProFileNode *>(subNode)) { auto subProFile = dynamic_cast<const QmakeProFile *>(subPriFile);
QTC_ASSERT(subProject->priFile(), return ); if (subProFile)
if (subProject->priFile()->includedInExactParse()) collectData(subProFile, deploymentData);
collectData(subProject, deploymentData); }
}
});
break; break;
default: default:
break; break;
} }
} }
void QmakeProject::collectApplicationData(const QmakeProFileNode *node, DeploymentData &deploymentData) void QmakeProject::collectApplicationData(const QmakeProFile *file, DeploymentData &deploymentData)
{ {
QString executable = executableFor(node); QString executable = executableFor(file);
if (!executable.isEmpty()) if (!executable.isEmpty())
deploymentData.addFile(executable, node->proFile()->installsList().targetPath, deploymentData.addFile(executable, file->installsList().targetPath,
DeployableFile::TypeExecutable); DeployableFile::TypeExecutable);
} }
@@ -1305,17 +1302,16 @@ void QmakeProject::warnOnToolChainMismatch(const QmakeProFile *pro) const
getFullPathOf(pro, Variable::QmakeCxx, bc)); getFullPathOf(pro, Variable::QmakeCxx, bc));
} }
QString QmakeProject::executableFor(const QmakeProFileNode *node) QString QmakeProject::executableFor(const QmakeProFile *file)
{ {
const Kit *const kit = activeTarget() ? activeTarget()->kit() : nullptr; const Kit *const kit = activeTarget() ? activeTarget()->kit() : nullptr;
const ToolChain *const tc = ToolChainKitInformation::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID); const ToolChain *const tc = ToolChainKitInformation::toolChain(kit, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
if (!tc) if (!tc)
return QString(); return QString();
TargetInformation ti = node->targetInformation(); TargetInformation ti = file->targetInformation();
QString target; QString target;
QmakeProFile *file = node->proFile();
QTC_ASSERT(file, return QString()); QTC_ASSERT(file, return QString());
if (tc->targetAbi().os() == Abi::DarwinOS if (tc->targetAbi().os() == Abi::DarwinOS

View File

@@ -126,7 +126,7 @@ private:
void setAllBuildConfigurationsEnabled(bool enabled); void setAllBuildConfigurationsEnabled(bool enabled);
QString executableFor(const QmakeProFileNode *node); QString executableFor(const QmakeProFile *file);
void updateRunConfigurations(); void updateRunConfigurations();
void updateCppCodeModel(); void updateCppCodeModel();
@@ -135,8 +135,8 @@ private:
static bool equalFileList(const QStringList &a, const QStringList &b); static bool equalFileList(const QStringList &a, const QStringList &b);
void updateBuildSystemData(); void updateBuildSystemData();
void collectData(const QmakeProFileNode *node, ProjectExplorer::DeploymentData &deploymentData); void collectData(const QmakeProFile *file, ProjectExplorer::DeploymentData &deploymentData);
void collectApplicationData(const QmakeProFileNode *file, void collectApplicationData(const QmakeProFile *file,
ProjectExplorer::DeploymentData &deploymentData); ProjectExplorer::DeploymentData &deploymentData);
void collectLibraryData(const QmakeProFile *file, void collectLibraryData(const QmakeProFile *file,
ProjectExplorer::DeploymentData &deploymentData); ProjectExplorer::DeploymentData &deploymentData);