forked from qt-creator/qt-creator
QbsProjectManager: Add support for remote targets.
After parsing, we tell the target about deployable files and executables, so it can make use of that information for deployment and remote execution, respectively. In addition, the current default deploy configuration (consisting of just an install step) is now set up only for the desktop device, since other targets will likely provide specialized deployment solutions. The most noticeable effect of this patch is that the RemoteLinux target and its descendants now work out of the box with qbs projects. Change-Id: I512d4e215f2fa540efd4de5f5c1e53abaa0596d1 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
committed by
Tobias Hunger
parent
cf1b600967
commit
f27b738f65
@@ -33,6 +33,8 @@
|
|||||||
#include "qbsproject.h"
|
#include "qbsproject.h"
|
||||||
|
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
|
#include <projectexplorer/kitinformation.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
namespace QbsProjectManager {
|
namespace QbsProjectManager {
|
||||||
@@ -88,8 +90,11 @@ QbsDeployConfigurationFactory::QbsDeployConfigurationFactory(QObject *parent) :
|
|||||||
QList<Core::Id> QbsDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
QList<Core::Id> QbsDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
|
||||||
{
|
{
|
||||||
QList<Core::Id> ids;
|
QList<Core::Id> ids;
|
||||||
if (qobject_cast<QbsProject *>(parent->project()))
|
const Core::Id deviceId = ProjectExplorer::DeviceKitInformation::deviceId(parent->kit());
|
||||||
|
if (qobject_cast<QbsProject *>(parent->project())
|
||||||
|
&& deviceId == ProjectExplorer::Constants::DESKTOP_DEVICE_ID) {
|
||||||
ids << genericQbsDeployConfigurationId();
|
ids << genericQbsDeployConfigurationId();
|
||||||
|
}
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
#include <cpptools/cppmodelmanager.h>
|
#include <cpptools/cppmodelmanager.h>
|
||||||
#include <projectexplorer/buildenvironmentwidget.h>
|
#include <projectexplorer/buildenvironmentwidget.h>
|
||||||
|
#include <projectexplorer/buildtargetinfo.h>
|
||||||
|
#include <projectexplorer/deploymentdata.h>
|
||||||
#include <projectexplorer/kit.h>
|
#include <projectexplorer/kit.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
@@ -280,6 +282,8 @@ void QbsProject::handleQbsParsingDone(bool success)
|
|||||||
|
|
||||||
updateCppCodeModel(m_rootProjectNode->qbsProjectData());
|
updateCppCodeModel(m_rootProjectNode->qbsProjectData());
|
||||||
updateQmlJsCodeModel(m_rootProjectNode->qbsProjectData());
|
updateQmlJsCodeModel(m_rootProjectNode->qbsProjectData());
|
||||||
|
updateApplicationTargets(m_rootProjectNode->qbsProjectData());
|
||||||
|
updateDeploymentInfo(m_rootProjectNode->qbsProject());
|
||||||
|
|
||||||
foreach (Target *t, targets())
|
foreach (Target *t, targets())
|
||||||
t->updateDefaultRunConfigurations();
|
t->updateDefaultRunConfigurations();
|
||||||
@@ -617,6 +621,37 @@ void QbsProject::updateQmlJsCodeModel(const qbs::ProjectData &prj)
|
|||||||
modelManager->updateProjectInfo(projectInfo);
|
modelManager->updateProjectInfo(projectInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QbsProject::updateApplicationTargets(const qbs::ProjectData &projectData)
|
||||||
|
{
|
||||||
|
ProjectExplorer::BuildTargetInfoList applications;
|
||||||
|
foreach (const qbs::ProductData &productData, projectData.allProducts()) {
|
||||||
|
foreach (const qbs::TargetArtifact &ta, productData.targetArtifacts()) {
|
||||||
|
QTC_ASSERT(ta.isValid(), continue);
|
||||||
|
if (!ta.isExecutable())
|
||||||
|
continue;
|
||||||
|
applications.list << ProjectExplorer::BuildTargetInfo(Utils::FileName::fromString(ta.filePath()),
|
||||||
|
Utils::FileName::fromString(productData.location().fileName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeTarget()->setApplicationTargets(applications);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QbsProject::updateDeploymentInfo(const qbs::Project *project)
|
||||||
|
{
|
||||||
|
ProjectExplorer::DeploymentData deploymentData;
|
||||||
|
if (project) {
|
||||||
|
qbs::InstallOptions installOptions;
|
||||||
|
installOptions.setInstallRoot(QLatin1String("/"));
|
||||||
|
foreach (const qbs::InstallableFile &f,
|
||||||
|
project->installableFilesForProject(project->projectData(), installOptions)) {
|
||||||
|
deploymentData.addFile(f.sourceFilePath(), f.targetDirectory(), f.isExecutable()
|
||||||
|
? ProjectExplorer::DeployableFile::TypeExecutable
|
||||||
|
: ProjectExplorer::DeployableFile::TypeNormal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
activeTarget()->setDeploymentData(deploymentData);
|
||||||
|
}
|
||||||
|
|
||||||
QString QbsProject::qbsBuildDir() const
|
QString QbsProject::qbsBuildDir() const
|
||||||
{
|
{
|
||||||
QString buildDir = Environment::systemEnvironment().value(QLatin1String("QBS_BUILD_DIR"));
|
QString buildDir = Environment::systemEnvironment().value(QLatin1String("QBS_BUILD_DIR"));
|
||||||
|
|||||||
@@ -128,6 +128,8 @@ private:
|
|||||||
void updateDocuments(const QSet<QString> &files);
|
void updateDocuments(const QSet<QString> &files);
|
||||||
void updateCppCodeModel(const qbs::ProjectData &prj);
|
void updateCppCodeModel(const qbs::ProjectData &prj);
|
||||||
void updateQmlJsCodeModel(const qbs::ProjectData &prj);
|
void updateQmlJsCodeModel(const qbs::ProjectData &prj);
|
||||||
|
void updateApplicationTargets(const qbs::ProjectData &projectData);
|
||||||
|
void updateDeploymentInfo(const qbs::Project *project);
|
||||||
QString qbsBuildDir() const;
|
QString qbsBuildDir() const;
|
||||||
|
|
||||||
QbsManager *const m_manager;
|
QbsManager *const m_manager;
|
||||||
|
|||||||
Reference in New Issue
Block a user