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:
Christian Kandeler
2013-09-02 10:12:37 +02:00
committed by Tobias Hunger
parent cf1b600967
commit f27b738f65
3 changed files with 43 additions and 1 deletions

View File

@@ -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"));