forked from qt-creator/qt-creator
ProjectExplorer: Simplify LocalEnvspect's BaseEnvironmentModifier
The run configuration is known at setup time, and fixed. Change-Id: Iad7837bf39fb5eeed49bd71b7f14b9692014ea9d Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -44,11 +44,11 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
// Workaround for QTCREATORBUG-19354:
|
||||
auto cmakeRunEnvironmentModifier = [](RunConfiguration *rc, Utils::Environment &env) {
|
||||
if (!Utils::HostOsInfo::isWindowsHost() || !rc)
|
||||
auto cmakeRunEnvironmentModifier = [target](Utils::Environment &env) {
|
||||
if (!Utils::HostOsInfo::isWindowsHost())
|
||||
return;
|
||||
|
||||
const Kit *k = rc->target()->kit();
|
||||
const Kit *k = target->kit();
|
||||
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(k);
|
||||
if (qt)
|
||||
env.prependOrSetPath(qt->qmakeProperty("QT_INSTALL_BINS"));
|
||||
|
||||
@@ -56,7 +56,7 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
|
||||
}
|
||||
|
||||
if (m_baseEnvironmentModifier)
|
||||
m_baseEnvironmentModifier(runConfiguration(), env);
|
||||
m_baseEnvironmentModifier(env);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class PROJECTEXPLORER_EXPORT LocalEnvironmentAspect : public EnvironmentAspect
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef std::function<void(RunConfiguration *, Utils::Environment &)> BaseEnvironmentModifier;
|
||||
typedef std::function<void(Utils::Environment &)> BaseEnvironmentModifier;
|
||||
LocalEnvironmentAspect(RunConfiguration *parent, const BaseEnvironmentModifier &modifier);
|
||||
|
||||
Utils::Environment baseEnvironment() const override;
|
||||
|
||||
@@ -53,9 +53,7 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(
|
||||
[](RunConfiguration *rc, Environment &env) {
|
||||
static_cast<QbsRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||
});
|
||||
[this](Environment &env) { addToBaseEnvironment(env); });
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
|
||||
@@ -63,8 +63,8 @@ const char PRO_FILE_KEY[] = "Qt4ProjectManager.Qt4RunConfiguration.ProFile";
|
||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>([](RunConfiguration *rc, Environment &env) {
|
||||
static_cast<DesktopQmakeRunConfiguration *>(rc)->addToBaseEnvironment(env);
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>([this](Environment &env) {
|
||||
addToBaseEnvironment(env);
|
||||
});
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
|
||||
Reference in New Issue
Block a user