let "build file" only run one build step

For example, C++ source files will be compiled but the build
stops before linking.

Task-number: QBS-283

Change-Id: If0573ea58b9a047980aab0fd8e4828f3d0c315b8
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Joerg Bornemann
2013-07-24 16:47:02 +02:00
parent 0a8f93268b
commit c883498e3b
6 changed files with 31 additions and 4 deletions

View File

@@ -193,6 +193,16 @@ QStringList QbsBuildConfiguration::changedFiles() const
return m_changedFiles;
}
void QbsBuildConfiguration::setActiveFileTags(const QStringList &fileTags)
{
m_activeFileTags = fileTags;
}
QStringList QbsBuildConfiguration::activeFileTags() const
{
return m_activeFileTags;
}
void QbsBuildConfiguration::setProducts(const QStringList &products)
{
m_products = products;

View File

@@ -73,6 +73,9 @@ public:
void setChangedFiles(const QStringList &files);
QStringList changedFiles() const;
void setActiveFileTags(const QStringList &fileTags);
QStringList activeFileTags() const;
void setProducts(const QStringList &products);
QStringList products() const;
@@ -99,6 +102,7 @@ private:
bool m_parsingError;
Utils::FileName m_buildDirectory;
QStringList m_changedFiles;
QStringList m_activeFileTags;
QStringList m_products;
friend class QbsBuildConfigurationFactory;

View File

@@ -107,6 +107,7 @@ bool QbsBuildStep::init()
m_parser->appendOutputParser(parser);
m_changedFiles = bc->changedFiles();
m_activeFileTags = bc->activeFileTags();
m_products = bc->products();
connect(m_parser, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)),
@@ -124,6 +125,7 @@ void QbsBuildStep::run(QFutureInterface<bool> &fi)
QbsProject *pro = static_cast<QbsProject *>(project());
qbs::BuildOptions options(m_qbsBuildOptions);
options.setChangedFiles(m_changedFiles);
options.setActiveFileTags(m_activeFileTags);
m_job = pro->build(options, m_products);

View File

@@ -100,6 +100,7 @@ private:
// Temporary data:
QStringList m_changedFiles;
QStringList m_activeFileTags;
QStringList m_products;
QFutureInterface<bool> *m_fi;

View File

@@ -301,7 +301,7 @@ void QbsProjectManagerPlugin::buildFileContextMenu()
QTC_ASSERT(m_currentNode, return);
QTC_ASSERT(m_currentProject, return);
buildFiles(m_currentProject, QStringList(m_currentNode->path()));
buildSingleFile(m_currentProject, m_currentNode->path());
}
void QbsProjectManagerPlugin::buildFile()
@@ -316,7 +316,7 @@ void QbsProjectManagerPlugin::buildFile()
if (!project || file.isEmpty())
return;
buildFiles(project, QStringList(file));
buildSingleFile(project, file);
}
void QbsProjectManagerPlugin::buildProductContextMenu()
@@ -345,7 +345,8 @@ void QbsProjectManagerPlugin::buildProduct()
buildProducts(project, QStringList(product->displayName()));
}
void QbsProjectManagerPlugin::buildFiles(QbsProject *project, const QStringList &files)
void QbsProjectManagerPlugin::buildFiles(QbsProject *project, const QStringList &files,
const QStringList &activeFileTags)
{
QTC_ASSERT(project, return);
QTC_ASSERT(!files.isEmpty(), return);
@@ -362,6 +363,7 @@ void QbsProjectManagerPlugin::buildFiles(QbsProject *project, const QStringList
return;
bc->setChangedFiles(files);
bc->setActiveFileTags(activeFileTags);
bc->setProducts(QStringList());
const Core::Id buildStep = Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
@@ -372,6 +374,12 @@ void QbsProjectManagerPlugin::buildFiles(QbsProject *project, const QStringList
bc->setChangedFiles(QStringList());
}
void QbsProjectManagerPlugin::buildSingleFile(QbsProject *project, const QString &file)
{
buildFiles(project, QStringList(file), QStringList()
<< QLatin1String("obj") << QLatin1String("hpp"));
}
void QbsProjectManagerPlugin::buildProducts(QbsProject *project, const QStringList &products)
{
QTC_ASSERT(project, return);

View File

@@ -80,7 +80,9 @@ private slots:
void reparseCurrentProject();
private:
void buildFiles(QbsProject *project, const QStringList &files);
void buildFiles(QbsProject *project, const QStringList &files,
const QStringList &activeFileTags);
void buildSingleFile(QbsProject *project, const QString &file);
void buildProducts(QbsProject *project, const QStringList &products);
QbsManager *m_manager;