forked from qt-creator/qt-creator
ProjectExplorer: Add "build for current run config" menu entry
This lets users build the executable corresponding to the currently active run configuration. It's functionally equivalent to locating the corresponding node in the project tree and choosing "Build" from the context menu. Fixes: QTCREATORBUG-22403 Change-Id: Ic2b729c7ce17f1ad944dc06746bb9d6db90b6c61 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "qbsnodetreebuilder.h"
|
||||
#include "qbsproject.h"
|
||||
#include "qbsprojectmanagerconstants.h"
|
||||
#include "qbsprojectmanagerplugin.h"
|
||||
#include "qbsrunconfiguration.h"
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
@@ -391,6 +392,12 @@ bool QbsProductNode::renameFile(const QString &filePath, const QString &newFileP
|
||||
return prjNode->project()->renameFileInProduct(filePath, newFilePath, m_qbsProductData, grp);
|
||||
}
|
||||
|
||||
void QbsProductNode::build()
|
||||
{
|
||||
QbsProjectManagerPlugin::buildNamedProduct(static_cast<QbsProject *>(getProject()),
|
||||
QbsProject::uniqueProductName(qbsProductData()));
|
||||
}
|
||||
|
||||
QStringList QbsProductNode::targetApplications() const
|
||||
{
|
||||
return QStringList{m_qbsProductData.targetExecutable()};
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
bool addFiles(const QStringList &filePaths, QStringList *notAdded = nullptr) override;
|
||||
bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = nullptr) override;
|
||||
bool renameFile(const QString &filePath, const QString &newFilePath) override;
|
||||
void build() override;
|
||||
QStringList targetApplications() const override;
|
||||
|
||||
QString buildKey() const override;
|
||||
|
||||
@@ -129,6 +129,7 @@ QbsProject::QbsProject(const FilePath &fileName) :
|
||||
|
||||
setId(Constants::PROJECT_ID);
|
||||
setProjectLanguages(Context(ProjectExplorer::Constants::CXX_LANGUAGE_ID));
|
||||
setCanBuildProducts();
|
||||
|
||||
rebuildProjectTree();
|
||||
|
||||
|
||||
@@ -578,5 +578,11 @@ void QbsProjectManagerPlugin::reparseProject(QbsProject *project)
|
||||
project->parseCurrentBuildConfiguration();
|
||||
}
|
||||
|
||||
void QbsProjectManagerPlugin::buildNamedProduct(QbsProject *project, const QString &product)
|
||||
{
|
||||
QbsProjectManagerPlugin::runStepsForProducts(project, QStringList(product),
|
||||
{Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD)});
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
|
||||
@@ -42,6 +42,10 @@ class QbsProjectManagerPlugin : public ExtensionSystem::IPlugin
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "QbsProjectManager.json")
|
||||
|
||||
public:
|
||||
static void buildNamedProduct(QbsProject *project, const QString &product);
|
||||
|
||||
private:
|
||||
~QbsProjectManagerPlugin() final;
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||
@@ -77,8 +81,8 @@ class QbsProjectManagerPlugin : public ExtensionSystem::IPlugin
|
||||
const QStringList &activeFileTags);
|
||||
void buildSingleFile(QbsProject *project, const QString &file);
|
||||
|
||||
void runStepsForProducts(QbsProject *project, const QStringList &products,
|
||||
const QList<Core::Id> &stepTypes);
|
||||
static void runStepsForProducts(QbsProject *project, const QStringList &products,
|
||||
const QList<Core::Id> &stepTypes);
|
||||
|
||||
QbsProjectManagerPluginPrivate *d = nullptr;
|
||||
QAction *m_reparseQbs = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user