Utils: Start Environment/EnvironmentChange consolidation

The plan is now to keep 'Environment' as the concept name, but
have what is currently 'EnvironmentChange' as implementation,
as keeping a full env vs env change(set) distiction gets messy.

First step is to cut the direct dependency of EnvironmentChange
from a (current) Environment that causes circularity when moving
the implementation.

Change-Id: Id8b512b311071611b750b27af59549ce7c2ce8e6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2023-01-26 16:26:39 +01:00
parent bc87abec32
commit 5f359a1dff
10 changed files with 31 additions and 13 deletions

View File

@@ -417,10 +417,10 @@ void EnvironmentChange::addAppendToPath(const FilePaths &values)
m_changeItems.append(Item{std::in_place_index_t<AppendToPath>(), value});
}
EnvironmentChange EnvironmentChange::fromFixedEnvironment(const Environment &fixedEnv)
EnvironmentChange EnvironmentChange::fromDictionary(const NameValueDictionary &dict)
{
EnvironmentChange change;
change.m_changeItems.append(Item{std::in_place_index_t<SetFixedEnvironment>(), fixedEnv});
change.m_changeItems.append(Item{std::in_place_index_t<SetFixedDictionary>(), dict});
return change;
}
@@ -431,8 +431,8 @@ void EnvironmentChange::applyToEnvironment(Environment &env) const
case SetSystemEnvironment:
env = Environment::systemEnvironment();
break;
case SetFixedEnvironment:
env = std::get<SetFixedEnvironment>(item);
case SetFixedDictionary:
env = Environment(std::get<SetFixedDictionary>(item));
break;
case SetValue: {
const QPair<QString, QString> data = std::get<SetValue>(item);