forked from qt-creator/qt-creator
CMake: Use new AbstractProcessStep convenience functions
This is actually a slight change in behavior insofar as the summary now uses the same environment as the build itself. This should not matter, or even be more correct. Change-Id: I48e5be6cb7b97606f80f563ba399c4b6ff61c3bf Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -50,6 +50,7 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -136,7 +137,6 @@ static bool isCurrentExecutableTarget(const QString &target)
|
|||||||
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
||||||
AbstractProcessStep(bsl, id)
|
AbstractProcessStep(bsl, id)
|
||||||
{
|
{
|
||||||
m_ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
|
||||||
//: Default display name for the cmake make step.
|
//: Default display name for the cmake make step.
|
||||||
setDefaultDisplayName(tr("CMake Build"));
|
setDefaultDisplayName(tr("CMake Build"));
|
||||||
|
|
||||||
@@ -146,6 +146,13 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
|||||||
|
|
||||||
setLowPriority();
|
setLowPriority();
|
||||||
|
|
||||||
|
setEnvironmentModifier([](Environment &env) {
|
||||||
|
const QString ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
||||||
|
Environment::setupEnglishOutput(&env);
|
||||||
|
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(ninjaProgressString))
|
||||||
|
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
|
||||||
|
});
|
||||||
|
|
||||||
connect(target(), &Target::parsingFinished,
|
connect(target(), &Target::parsingFinished,
|
||||||
this, &CMakeBuildStep::handleBuildTargetsChanges);
|
this, &CMakeBuildStep::handleBuildTargetsChanges);
|
||||||
}
|
}
|
||||||
@@ -241,13 +248,7 @@ bool CMakeBuildStep::init()
|
|||||||
setIgnoreReturnValue(m_buildTargets == QStringList(CMakeBuildStep::cleanTarget()));
|
setIgnoreReturnValue(m_buildTargets == QStringList(CMakeBuildStep::cleanTarget()));
|
||||||
|
|
||||||
ProcessParameters *pp = processParameters();
|
ProcessParameters *pp = processParameters();
|
||||||
pp->setMacroExpander(bc->macroExpander());
|
setupProcessParameters(pp);
|
||||||
Utils::Environment env = bc->environment();
|
|
||||||
Utils::Environment::setupEnglishOutput(&env);
|
|
||||||
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(m_ninjaProgressString))
|
|
||||||
env.set("NINJA_STATUS", m_ninjaProgressString + "%o/sec] ");
|
|
||||||
pp->setEnvironment(env);
|
|
||||||
pp->setWorkingDirectory(bc->buildDirectory());
|
|
||||||
pp->setCommandLine(cmakeCommand(rc));
|
pp->setCommandLine(cmakeCommand(rc));
|
||||||
pp->resolveAll();
|
pp->resolveAll();
|
||||||
|
|
||||||
@@ -568,9 +569,7 @@ void CMakeBuildStepConfigWidget::updateBuildTargets()
|
|||||||
void CMakeBuildStepConfigWidget::updateDetails()
|
void CMakeBuildStepConfigWidget::updateDetails()
|
||||||
{
|
{
|
||||||
ProcessParameters param;
|
ProcessParameters param;
|
||||||
param.setMacroExpander(m_buildStep->macroExpander());
|
m_buildStep->setupProcessParameters(¶m);
|
||||||
param.setEnvironment(m_buildStep->buildEnvironment());
|
|
||||||
param.setWorkingDirectory(m_buildStep->buildDirectory());
|
|
||||||
param.setCommandLine(m_buildStep->cmakeCommand(nullptr));
|
param.setCommandLine(m_buildStep->cmakeCommand(nullptr));
|
||||||
|
|
||||||
setSummaryText(param.summary(displayName()));
|
setSummaryText(param.summary(displayName()));
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ private:
|
|||||||
|
|
||||||
QMetaObject::Connection m_runTrigger;
|
QMetaObject::Connection m_runTrigger;
|
||||||
|
|
||||||
QString m_ninjaProgressString;
|
|
||||||
QStringList m_buildTargets;
|
QStringList m_buildTargets;
|
||||||
QString m_cmakeArguments;
|
QString m_cmakeArguments;
|
||||||
QString m_toolArguments;
|
QString m_toolArguments;
|
||||||
|
|||||||
Reference in New Issue
Block a user