GenericProject: Use own target instead of activeTarget()

... when updating deployment data.

Change-Id: Ifa18d4f4fce2fddba91989e2c3094299d4d1f0ac
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-02-05 12:32:44 +01:00
parent ea6da69e8b
commit 4ad4871fdc

View File

@@ -576,23 +576,20 @@ void GenericBuildSystem::updateDeploymentData()
{ {
static const QString fileName("QtCreatorDeployment.txt"); static const QString fileName("QtCreatorDeployment.txt");
Utils::FilePath deploymentFilePath; Utils::FilePath deploymentFilePath;
Target *target = project()->activeTarget(); BuildConfiguration *bc = target()->activeBuildConfiguration();
if (target && target->activeBuildConfiguration()) { if (bc)
deploymentFilePath = target->activeBuildConfiguration()->buildDirectory() deploymentFilePath = bc->buildDirectory().pathAppended(fileName);
.pathAppended(fileName);
}
bool hasDeploymentData = QFileInfo::exists(deploymentFilePath.toString()); bool hasDeploymentData = QFileInfo::exists(deploymentFilePath.toString());
if (!hasDeploymentData) { if (!hasDeploymentData) {
deploymentFilePath = projectDirectory().pathAppended(fileName); deploymentFilePath = projectDirectory().pathAppended(fileName);
hasDeploymentData = QFileInfo::exists(deploymentFilePath.toString()); hasDeploymentData = QFileInfo::exists(deploymentFilePath.toString());
} }
if (hasDeploymentData) { if (hasDeploymentData) {
if (target) { DeploymentData deploymentData;
DeploymentData deploymentData; deploymentData.addFilesFromDeploymentFile(deploymentFilePath.toString(),
deploymentData.addFilesFromDeploymentFile(deploymentFilePath.toString(), projectDirectory().toString());
projectDirectory().toString()); setDeploymentData(deploymentData);
setDeploymentData(deploymentData);
}
if (m_deployFileWatcher.files() != QStringList(deploymentFilePath.toString())) { if (m_deployFileWatcher.files() != QStringList(deploymentFilePath.toString())) {
m_deployFileWatcher.removeFiles(m_deployFileWatcher.files()); m_deployFileWatcher.removeFiles(m_deployFileWatcher.files());
m_deployFileWatcher.addFile(deploymentFilePath.toString(), m_deployFileWatcher.addFile(deploymentFilePath.toString(),