ProjectExplorer: Consolidate RunConfiguration identifications

The previously per-Project/RunConfiguration changing meanings of
BuildTargetInfo::buildTarget have by now been split
into separate values in BuildTargetInfo:
  - buildKey     a handle to one item in Target::applicationTargetList
  - displayName  a user-visible string in the run settings page

The buildKey was tweaked to coincide with the previous 'extraId',
i.e. the non-RunConfiguration-type part of the project configuration
id that (still) use id mangling.

This allows replacing the cases of locally stored seven different
versions of buildKey(-ish) data by one RunConfiguration::m_buildKey,
and do all remaining extraId handling in RC::{from,to}Map only,
i.e. remove the base ProjectConfiguration::extraId() virtual and
remove the "re-try fromMap with mangled id" hack entirely.

The id mangling is still used to temporarily maintain .user file
compatibility in some cases for now, but should be replaced by
storing the build key and the RunConfiguration type soon. Qbs
already changes in here to only use the uniqueProductName as
buildKey, without the previously added display name which is
stored as part of the ProjectConfiguration already.

It turns out that RunConfiguration::buildSystemTarget was intended
and used to retrieve an item from the Target::applicationTargetList
for some configurations, coinciding with what buildKey does always.
So use that insteand and drop RunConfiguration::buildSystemTarget.

There is clearly is further consolidation potential left.

handling of (default)displayNames is still a per-runconfiguration
mess and there is further consolidation potential left.

Change-Id: I448ed30f1b562fb91b970e328a42fa5f6fb2e43e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-04-09 12:33:10 +02:00
parent 4ab7c19e84
commit bc698d4ce6
30 changed files with 100 additions and 296 deletions

View File

@@ -104,11 +104,6 @@ IosRunConfiguration::IosRunConfiguration(Target *target)
this, &IosRunConfiguration::deviceChanges);
}
QString IosRunConfiguration::extraId() const
{
return m_profilePath.toString();
}
void IosRunConfiguration::deviceChanges()
{
updateDisplayNames();
@@ -159,7 +154,7 @@ void IosRunConfiguration::updateEnabledState()
bool IosRunConfiguration::canRunForNode(const Node *node) const
{
return node->filePath() == m_profilePath;
return node->filePath() == profilePath();
}
IosDeployStep *IosRunConfiguration::deployStep() const
@@ -170,7 +165,7 @@ IosDeployStep *IosRunConfiguration::deployStep() const
FileName IosRunConfiguration::profilePath() const
{
return m_profilePath;
return FileName::fromString(buildKey());
}
static QmakeProFile *proFile(const IosRunConfiguration *rc)
@@ -247,9 +242,6 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map)
if (!RunConfiguration::fromMap(map))
return false;
QString extraId = idFromMap(map).suffixAfter(id());
m_profilePath = Utils::FileName::fromString(extraId);
bool deviceTypeIsInt;
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) {
@@ -263,11 +255,6 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map)
return true;
}
void IosRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
{
m_profilePath = Utils::FileName::fromString(info.buildKey);
}
QVariantMap IosRunConfiguration::toMap() const
{
QVariantMap res = RunConfiguration::toMap();
@@ -275,11 +262,6 @@ QVariantMap IosRunConfiguration::toMap() const
return res;
}
QString IosRunConfiguration::buildSystemTarget() const
{
return m_profilePath.toString();
}
QString IosRunConfiguration::disabledReason() const
{
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());