Commit 870da8e7 authored by dt's avatar dt
Browse files

Make the build parser for custom build steps depend on the toolchain

The API addtition to BuildConfiguration of knowing of the default parser
is rather strange, but a necessary evil for this.

Reviewed-By: Thorbjorn

Task-Nr: QTCREATORBUG-514
parent 008d8cb1
......@@ -153,6 +153,13 @@ void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
emit msvcVersionChanged();
}
ProjectExplorer::IOutputParser *CMakeBuildConfiguration::createOutputParser() const
{
if (m_toolChain)
return m_toolChain->outputParser();
return 0;
}
/*!
\class CMakeBuildConfigurationFactory
*/
......
......@@ -62,6 +62,8 @@ public:
QVariantMap toMap() const;
ProjectExplorer::IOutputParser *createOutputParser() const;
signals:
void msvcVersionChanged();
......
......@@ -50,6 +50,7 @@ const char * const BUILD_DIRECTORY_KEY("GenericProjectManager.GenericBuildConfig
GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent)
: BuildConfiguration(parent, QLatin1String(GENERIC_BC_ID))
{
}
GenericBuildConfiguration::GenericBuildConfiguration(GenericTarget *parent, const QString &id)
......@@ -116,6 +117,14 @@ GenericTarget *GenericBuildConfiguration::genericTarget() const
return static_cast<GenericTarget *>(target());
}
ProjectExplorer::IOutputParser *GenericBuildConfiguration::createOutputParser() const
{
ProjectExplorer::ToolChain *tc = genericTarget()->genericProject()->toolChain();
if (tc)
return tc->outputParser();
return 0;
}
/*!
\class GenericBuildConfigurationFactory
......
......@@ -57,6 +57,8 @@ public:
QVariantMap toMap() const;
ProjectExplorer::IOutputParser *createOutputParser() const;
protected:
GenericBuildConfiguration(GenericTarget *parent, GenericBuildConfiguration *source);
GenericBuildConfiguration(GenericTarget *parent, const QString &id);
......
......@@ -44,6 +44,7 @@
namespace ProjectExplorer {
class Target;
class IOutputParser;
class PROJECTEXPLORER_EXPORT BuildConfiguration : public ProjectConfiguration
{
......@@ -73,6 +74,13 @@ public:
virtual QVariantMap toMap() const;
// Creates a suitable outputparser for custom build steps
// (based on the toolchain)
// TODO this is not great API
// it's mainly so that custom build systems are better integrated
// with the generic project manager
virtual IOutputParser *createOutputParser() const = 0;
signals:
void environmentChanged();
void buildDirectoryChanged();
......
......@@ -94,7 +94,7 @@ bool ProcessStep::init()
AbstractProcessStep::setCommand(m_command);
AbstractProcessStep::setEnabled(m_enabled);
AbstractProcessStep::setArguments(m_arguments);
setOutputParser(0);
setOutputParser(buildConfiguration()->createOutputParser());
return AbstractProcessStep::init();
}
......
......@@ -556,6 +556,14 @@ QString Qt4BuildConfiguration::extractSpecFromArgumentList(const QStringList &li
return parsedSpec;
}
ProjectExplorer::IOutputParser *Qt4BuildConfiguration::createOutputParser() const
{
ToolChain *tc = toolChain();
if (tc)
return toolChain()->outputParser();
return 0;
}
/*!
\class Qt4BuildConfigurationFactory
*/
......
......@@ -106,6 +106,8 @@ public:
QVariantMap toMap() const;
ProjectExplorer::IOutputParser *createOutputParser() const;
signals:
/// emitted if the qt version changes (either directly, or because the default qt version changed
/// or because the user changed the settings for the qt version
......
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