Commit f27b738f authored by Christian Kandeler's avatar Christian Kandeler Committed by Tobias Hunger
Browse files

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: default avatarTobias Hunger <tobias.hunger@digia.com>
parent cf1b6009
......@@ -33,6 +33,8 @@
#include "qbsproject.h"
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h>
namespace QbsProjectManager {
......@@ -88,8 +90,11 @@ QbsDeployConfigurationFactory::QbsDeployConfigurationFactory(QObject *parent) :
QList<Core::Id> QbsDeployConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
{
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();
}
return ids;
}
......
......@@ -47,6 +47,8 @@
#include <coreplugin/mimedatabase.h>
#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/buildenvironmentwidget.h>
#include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorer.h>
......@@ -280,6 +282,8 @@ void QbsProject::handleQbsParsingDone(bool success)
updateCppCodeModel(m_rootProjectNode->qbsProjectData());
updateQmlJsCodeModel(m_rootProjectNode->qbsProjectData());
updateApplicationTargets(m_rootProjectNode->qbsProjectData());
updateDeploymentInfo(m_rootProjectNode->qbsProject());
foreach (Target *t, targets())
t->updateDefaultRunConfigurations();
......@@ -617,6 +621,37 @@ void QbsProject::updateQmlJsCodeModel(const qbs::ProjectData &prj)
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 buildDir = Environment::systemEnvironment().value(QLatin1String("QBS_BUILD_DIR"));
......
......@@ -128,6 +128,8 @@ private:
void updateDocuments(const QSet<QString> &files);
void updateCppCodeModel(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;
QbsManager *const m_manager;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment