diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2009-12-09 13:54:46 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2009-12-09 18:39:03 +0100 |
commit | ec025c6dbf1b3c9b6ff4ac7859d61f03b35c21f4 (patch) | |
tree | 5e3d5b2a0fcbd4928826466e59394a43c8b1b0d0 /src/plugins/cmakeprojectmanager | |
parent | a0abde6306571fb7f12fe1d176cec1c8dba4d358 (diff) | |
download | qt-creator-ec025c6dbf1b3c9b6ff4ac7859d61f03b35c21f4.tar.gz |
Rework Build Parser handling
* Rework IBuildParser:
* Remove name() method.
* Remove enterDirectory and leaveDirectory signals.
* Allow chaining of parsers.
* Rename IBuildParser to IOutputParser.
* Implement GnuMakeParser.
* Remove entering/leaving directory related code from all other parsers
* Move filename fixup heuristic based on entering/leaving directory
massages from gnumake here from AbstractMakeStep.
* Add outputParser method to ToolChain: This removes the need to map
toolchains to BuildParser names in the BuildSteps.
* Enhance AbstractProcessStep to accept a IOutputParser to parse its output.
* Remove AbstractMakeStep.
* Set the appropriate Parsers in all classes deriving from AbstractProcessStep
and append the ToolChain's parser to the parser chain.
* Remove BuildParserFactories: There is no more need for them.
* Remove constants used to identify the BuildParsers.
* Clean up some names:
* Replace stdOut with stdOutput.
* Replace addToTaskWindow with addTask and addToOutputWindow with
addOutput. Do this wherever it is not yet clear that this will end up
in the Task/Output window.
Reviewed-by: dt
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
4 files changed, 18 insertions, 30 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 8116243fea..eb7115d7a5 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -136,21 +136,6 @@ QString CMakeBuildConfiguration::buildDirectory() const return buildDirectory; } -QString CMakeBuildConfiguration::buildParser() const -{ - if (!m_toolChain) - return QString::null; - if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC - //|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC - || m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) { - return ProjectExplorer::Constants::BUILD_PARSER_GCC; - } else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC - || m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) { - return ProjectExplorer::Constants::BUILD_PARSER_MSVC; - } - return QString::null; -} - ProjectExplorer::ToolChain::ToolChainType CMakeBuildConfiguration::toolChainType() const { if (m_toolChain) diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h index 24064ed347..bdd9765bd6 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h @@ -57,7 +57,6 @@ public: void setUseSystemEnvironment(bool b); virtual QString buildDirectory() const; - QString buildParser() const; ProjectExplorer::ToolChain::ToolChainType toolChainType() const; ProjectExplorer::ToolChain *toolChain() const; diff --git a/src/plugins/cmakeprojectmanager/makestep.cpp b/src/plugins/cmakeprojectmanager/makestep.cpp index 332f2fcc62..86a74073e5 100644 --- a/src/plugins/cmakeprojectmanager/makestep.cpp +++ b/src/plugins/cmakeprojectmanager/makestep.cpp @@ -32,6 +32,7 @@ #include "cmakebuildconfiguration.h" #include <projectexplorer/projectexplorer.h> +#include <projectexplorer/gnumakeparser.h> #include <QtGui/QFormLayout> #include <QtGui/QGroupBox> @@ -43,14 +44,14 @@ using namespace CMakeProjectManager; using namespace CMakeProjectManager::Internal; using namespace ProjectExplorer; -MakeStep::MakeStep(BuildConfiguration *bc) - : AbstractMakeStep(bc), m_clean(false), m_futureInterface(0) +MakeStep::MakeStep(BuildConfiguration *bc) : + AbstractProcessStep(bc), m_clean(false), m_futureInterface(0) { m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]"); } -MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc) - : AbstractMakeStep(bs, bc), +MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc) : + AbstractProcessStep(bs, bc), m_clean(bs->m_clean), m_futureInterface(0), m_buildTargets(bs->m_buildTargets), @@ -78,7 +79,7 @@ void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map) { if (map.value("clean").isValid() && map.value("clean").toBool()) m_clean = true; - AbstractMakeStep::restoreFromGlobalMap(map); + AbstractProcessStep::restoreFromGlobalMap(map); } void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map) @@ -87,7 +88,7 @@ void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map) m_additionalArguments = map["additionalArguments"].toStringList(); if (map.value("clean").isValid() && map.value("clean").toBool()) m_clean = true; - AbstractMakeStep::restoreFromLocalMap(map); + AbstractProcessStep::restoreFromLocalMap(map); } void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map) @@ -96,13 +97,12 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map) map["additionalArguments"] = m_additionalArguments; if (m_clean) map["clean"] = true; - AbstractMakeStep::storeIntoLocalMap(map); + AbstractProcessStep::storeIntoLocalMap(map); } bool MakeStep::init() { CMakeBuildConfiguration *bc = cmakeBuildConfiguration(); - setBuildParser(bc->buildParser()); setEnabled(true); setWorkingDirectory(bc->buildDirectory()); @@ -115,14 +115,18 @@ bool MakeStep::init() setEnvironment(bc->environment()); setIgnoreReturnValue(m_clean); - return AbstractMakeStep::init(); + setOutputParser(new ProjectExplorer::GnuMakeParser(workingDirectory())); + if (bc->toolChain()) + appendOutputParser(bc->toolChain()->outputParser()); + + return AbstractProcessStep::init(); } void MakeStep::run(QFutureInterface<bool> &fi) { m_futureInterface = &fi; m_futureInterface->setProgressRange(0, 100); - AbstractMakeStep::run(fi); + AbstractProcessStep::run(fi); m_futureInterface->setProgressValue(100); m_futureInterface->reportFinished(); m_futureInterface = 0; @@ -135,7 +139,7 @@ QString MakeStep::name() QString MakeStep::displayName() { - return "Make"; + return QLatin1String("Make"); } BuildStepConfigWidget *MakeStep::createConfigWidget() @@ -156,7 +160,7 @@ void MakeStep::stdOut(const QString &line) if (ok) m_futureInterface->setProgressValue(percent); } - AbstractMakeStep::stdOut(line); + AbstractProcessStep::stdOutput(line); } bool MakeStep::buildsTarget(const QString &target) const diff --git a/src/plugins/cmakeprojectmanager/makestep.h b/src/plugins/cmakeprojectmanager/makestep.h index 9242e545b3..6859915fd1 100644 --- a/src/plugins/cmakeprojectmanager/makestep.h +++ b/src/plugins/cmakeprojectmanager/makestep.h @@ -30,7 +30,7 @@ #ifndef MAKESTEP_H #define MAKESTEP_H -#include <projectexplorer/abstractmakestep.h> +#include <projectexplorer/abstractprocessstep.h> QT_BEGIN_NAMESPACE class QLineEdit; @@ -43,7 +43,7 @@ namespace Internal { class CMakeBuildConfiguration; -class MakeStep : public ProjectExplorer::AbstractMakeStep +class MakeStep : public ProjectExplorer::AbstractProcessStep { Q_OBJECT friend class MakeStepConfigWidget; // TODO remove |