forked from qt-creator/qt-creator
Cache BuildConfiguration::environment()
Change-Id: I865593f46feb332c385733c53de5884e5cd3751a Reviewed-by: Aurindam Jana <aurindam.jana@digia.com> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -89,6 +89,8 @@ BuildConfiguration::BuildConfiguration(Target *target, const Core::Id id) :
|
|||||||
bsl->setDefaultDisplayName(tr("Clean"));
|
bsl->setDefaultDisplayName(tr("Clean"));
|
||||||
m_stepLists.append(bsl);
|
m_stepLists.append(bsl);
|
||||||
|
|
||||||
|
emitEnvironmentChanged();
|
||||||
|
|
||||||
connect(target, SIGNAL(kitChanged()),
|
connect(target, SIGNAL(kitChanged()),
|
||||||
this, SLOT(handleKitUpdate()));
|
this, SLOT(handleKitUpdate()));
|
||||||
}
|
}
|
||||||
@@ -104,6 +106,8 @@ BuildConfiguration::BuildConfiguration(Target *target, BuildConfiguration *sourc
|
|||||||
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
// otherwise BuildStepFactories might reject to set up a BuildStep for us
|
||||||
// since we are not yet the derived class!
|
// since we are not yet the derived class!
|
||||||
|
|
||||||
|
emitEnvironmentChanged();
|
||||||
|
|
||||||
connect(target, SIGNAL(kitChanged()),
|
connect(target, SIGNAL(kitChanged()),
|
||||||
this, SLOT(handleKitUpdate()));
|
this, SLOT(handleKitUpdate()));
|
||||||
}
|
}
|
||||||
@@ -159,7 +163,7 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
|
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
|
||||||
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
m_userEnvironmentChanges = Utils::EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
||||||
|
|
||||||
m_lastEnvironment = environment();
|
emitEnvironmentChanged();
|
||||||
|
|
||||||
qDeleteAll(m_stepLists);
|
qDeleteAll(m_stepLists);
|
||||||
m_stepLists.clear();
|
m_stepLists.clear();
|
||||||
@@ -193,11 +197,12 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
|
|
||||||
void BuildConfiguration::emitEnvironmentChanged()
|
void BuildConfiguration::emitEnvironmentChanged()
|
||||||
{
|
{
|
||||||
Utils::Environment env = environment();
|
Utils::Environment env = baseEnvironment();
|
||||||
if (env == m_lastEnvironment)
|
env.modify(userEnvironmentChanges());
|
||||||
return;
|
if (env == m_cachedEnvironment)
|
||||||
m_lastEnvironment = env;
|
return;
|
||||||
emit environmentChanged();
|
m_cachedEnvironment = env;
|
||||||
|
emit environmentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::handleKitUpdate()
|
void BuildConfiguration::handleKitUpdate()
|
||||||
@@ -229,9 +234,7 @@ QString BuildConfiguration::baseEnvironmentText() const
|
|||||||
|
|
||||||
Utils::Environment BuildConfiguration::environment() const
|
Utils::Environment BuildConfiguration::environment() const
|
||||||
{
|
{
|
||||||
Utils::Environment env = baseEnvironment();
|
return m_cachedEnvironment;
|
||||||
env.modify(userEnvironmentChanges());
|
|
||||||
return env;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::setUseSystemEnvironment(bool b)
|
void BuildConfiguration::setUseSystemEnvironment(bool b)
|
||||||
|
@@ -111,7 +111,7 @@ private:
|
|||||||
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
|
QList<Utils::EnvironmentItem> m_userEnvironmentChanges;
|
||||||
QList<BuildStepList *> m_stepLists;
|
QList<BuildStepList *> m_stepLists;
|
||||||
Utils::AbstractMacroExpander *m_macroExpander;
|
Utils::AbstractMacroExpander *m_macroExpander;
|
||||||
Utils::Environment m_lastEnvironment;
|
mutable Utils::Environment m_cachedEnvironment;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory :
|
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory :
|
||||||
|
Reference in New Issue
Block a user