forked from qt-creator/qt-creator
CMakePM: Migrate build environment settings also to configure step
This allows a project to be properly configured with Qt Creator 9 when the build environment had user defined changes. Qt Creator version prior to 9 had one setting for both configure and build steps. Fixes: QTCREATORBUG-28372 Change-Id: I0da8065085bd6628ba75923c17b46648eb031801 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1621,10 +1621,24 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
|||||||
m_buildSystem->setInitialCMakeArguments(cmd.splitArguments());
|
m_buildSystem->setInitialCMakeArguments(cmd.splitArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_clearSystemConfigureEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY))
|
// Upgrading from Qt Creator version <9 to 9, if the build environment is set
|
||||||
.toBool();
|
// apply the specific values to the configure environment
|
||||||
|
auto settingsKey = [map](const QLatin1String &configureKey, const QLatin1String &buildKey) {
|
||||||
|
if (!map.contains(configureKey) && map.contains(buildKey))
|
||||||
|
return buildKey;
|
||||||
|
return configureKey;
|
||||||
|
};
|
||||||
|
|
||||||
|
const QLatin1String clearSystemEnvironmentKey
|
||||||
|
= settingsKey(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY),
|
||||||
|
QLatin1String(ProjectExplorer::Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY));
|
||||||
|
const QLatin1String userEnvironmentChangesKey
|
||||||
|
= settingsKey(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY),
|
||||||
|
QLatin1String(ProjectExplorer::Constants::USER_ENVIRONMENT_CHANGES_KEY));
|
||||||
|
|
||||||
|
d->m_clearSystemConfigureEnvironment = map.value(clearSystemEnvironmentKey).toBool();
|
||||||
d->m_userConfigureEnvironmentChanges = EnvironmentItem::fromStringList(
|
d->m_userConfigureEnvironmentChanges = EnvironmentItem::fromStringList(
|
||||||
map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
map.value(userEnvironmentChangesKey).toStringList());
|
||||||
|
|
||||||
updateAndEmitConfigureEnvironmentChanged();
|
updateAndEmitConfigureEnvironmentChanged();
|
||||||
|
|
||||||
|
@@ -46,8 +46,6 @@ using namespace Utils;
|
|||||||
|
|
||||||
const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
|
const char BUILD_STEP_LIST_COUNT[] = "ProjectExplorer.BuildConfiguration.BuildStepListCount";
|
||||||
const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
|
const char BUILD_STEP_LIST_PREFIX[] = "ProjectExplorer.BuildConfiguration.BuildStepList.";
|
||||||
const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "ProjectExplorer.BuildConfiguration.ClearSystemEnvironment";
|
|
||||||
const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration.UserEnvironmentChanges";
|
|
||||||
const char CUSTOM_PARSERS_KEY[] = "ProjectExplorer.BuildConfiguration.CustomParsers";
|
const char CUSTOM_PARSERS_KEY[] = "ProjectExplorer.BuildConfiguration.CustomParsers";
|
||||||
const char PARSE_STD_OUT_KEY[] = "ProjectExplorer.BuildConfiguration.ParseStandardOutput";
|
const char PARSE_STD_OUT_KEY[] = "ProjectExplorer.BuildConfiguration.ParseStandardOutput";
|
||||||
|
|
||||||
@@ -378,8 +376,9 @@ QVariantMap BuildConfiguration::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map = ProjectConfiguration::toMap();
|
QVariantMap map = ProjectConfiguration::toMap();
|
||||||
|
|
||||||
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), d->m_clearSystemEnvironment);
|
map.insert(QLatin1String(Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY), d->m_clearSystemEnvironment);
|
||||||
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(d->m_userEnvironmentChanges));
|
map.insert(QLatin1String(Constants::USER_ENVIRONMENT_CHANGES_KEY),
|
||||||
|
EnvironmentItem::toStringList(d->m_userEnvironmentChanges));
|
||||||
|
|
||||||
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), 2);
|
map.insert(QLatin1String(BUILD_STEP_LIST_COUNT), 2);
|
||||||
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(0), d->m_buildSteps.toMap());
|
map.insert(QLatin1String(BUILD_STEP_LIST_PREFIX) + QString::number(0), d->m_buildSteps.toMap());
|
||||||
@@ -393,8 +392,10 @@ QVariantMap BuildConfiguration::toMap() const
|
|||||||
|
|
||||||
bool BuildConfiguration::fromMap(const QVariantMap &map)
|
bool BuildConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
d->m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY)).toBool();
|
d->m_clearSystemEnvironment = map.value(QLatin1String(Constants::CLEAR_SYSTEM_ENVIRONMENT_KEY))
|
||||||
d->m_userEnvironmentChanges = EnvironmentItem::fromStringList(map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
.toBool();
|
||||||
|
d->m_userEnvironmentChanges = EnvironmentItem::fromStringList(
|
||||||
|
map.value(QLatin1String(Constants::USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
||||||
|
|
||||||
updateCacheAndEmitEnvironmentChanged();
|
updateCacheAndEmitEnvironmentChanged();
|
||||||
|
|
||||||
|
@@ -219,6 +219,8 @@ const char SETTINGS_MENU_HIDE_BUILD[] = "Menu/HideBuild";
|
|||||||
const char SETTINGS_MENU_HIDE_DEBUG[] = "Menu/HideDebug";
|
const char SETTINGS_MENU_HIDE_DEBUG[] = "Menu/HideDebug";
|
||||||
const char SETTINGS_MENU_HIDE_ANALYZE[] = "Menu/HideAnalyze";
|
const char SETTINGS_MENU_HIDE_ANALYZE[] = "Menu/HideAnalyze";
|
||||||
const char SESSION_TASKFILE_KEY[] = "TaskList.File";
|
const char SESSION_TASKFILE_KEY[] = "TaskList.File";
|
||||||
|
const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "ProjectExplorer.BuildConfiguration.ClearSystemEnvironment";
|
||||||
|
const char USER_ENVIRONMENT_CHANGES_KEY[] = "ProjectExplorer.BuildConfiguration.UserEnvironmentChanges";
|
||||||
|
|
||||||
// UI texts
|
// UI texts
|
||||||
PROJECTEXPLORER_EXPORT QString msgAutoDetected();
|
PROJECTEXPLORER_EXPORT QString msgAutoDetected();
|
||||||
|
Reference in New Issue
Block a user